Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shell/platform/embedder/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ test_fixtures("fixtures") {
"fixtures/dpr_noxform.png",
"fixtures/dpr_xform.png",
"fixtures/gradient.png",
"fixtures/impeller_gl_gradient.png",
"fixtures/impeller_gl_test.png",
"fixtures/vk_dpr_noxform.png",
"fixtures/vk_gradient.png",
"fixtures/gradient_metal.png",
Expand Down
5 changes: 5 additions & 0 deletions shell/platform/embedder/embedder_surface_gl_impeller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ EmbedderSurfaceGLImpeller::GLContextFramebufferInfo() const {

// |EmbedderSurface|
std::unique_ptr<Surface> EmbedderSurfaceGLImpeller::CreateGPUSurface() {
// Ensure that the GL context is current before creating the GPU surface.
// GPUSurfaceGLImpeller initialization will set up shader pipelines, and the
// current thread needs to be able to execute reactor operations.
GLContextMakeCurrent();

return std::make_unique<GPUSurfaceGLImpeller>(
this, // GPU surface GL delegate
impeller_context_, // Impeller context
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions shell/platform/embedder/fixtures/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1364,3 +1364,21 @@ void render_gradient_retained() {
};
PlatformDispatcher.instance.scheduleFrame();
}

@pragma('vm:entry-point')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this test do differently than the entrypoint you're replacing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test executes a series of canvas draw calls that makes the EntityPass render a Contents that needs to obtain a Pipeline before the ReactorGLES is flushed.

Without this patch, the test hangs when SolidColorContents::Render tries to get its shader pipeline.

void render_impeller_gl_test() {
PlatformDispatcher.instance.onBeginFrame = (Duration duration) {
final SceneBuilder builder = SceneBuilder();
builder.pushOffset(0.0, 0.0);
final Paint paint = Paint();
paint.color = Color.fromARGB(255, 0, 0, 255);
final PictureRecorder baseRecorder = PictureRecorder();
final Canvas canvas = Canvas(baseRecorder);
canvas.drawPaint(Paint()..color = Color.fromARGB(255, 255, 0, 0));
canvas.drawRect(Rect.fromLTRB(20.0, 20.0, 200.0, 150.0), paint);
builder.addPicture(Offset.zero, baseRecorder.endRecording());
builder.pop();
PlatformDispatcher.instance.views.first.render(builder.build());
};
PlatformDispatcher.instance.scheduleFrame();
}
4 changes: 2 additions & 2 deletions shell/platform/embedder/tests/embedder_gl_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4711,7 +4711,7 @@ TEST_F(EmbedderTest, CanRenderWithImpellerOpenGL) {
});

builder.AddCommandLineArgument("--enable-impeller");
builder.SetDartEntrypoint("render_gradient");
builder.SetDartEntrypoint("render_impeller_gl_test");
builder.SetOpenGLRendererConfig(SkISize::Make(800, 600));
builder.SetCompositor();
builder.SetRenderTargetType(
Expand All @@ -4733,7 +4733,7 @@ TEST_F(EmbedderTest, CanRenderWithImpellerOpenGL) {

ASSERT_TRUE(ImageMatchesFixture(
FixtureNameForBackend(EmbedderTestContextType::kOpenGLContext,
"impeller_gl_gradient.png"),
"impeller_gl_test.png"),
rendered_scene));

// The scene will be rendered by the compositor, and the surface present
Expand Down