Skip to content

Commit eb8f9d8

Browse files
Jonah Williamsharryterkelsen
authored andcommitted
[Impeller] Ensure that missing color attachment 0u does not cause crash in embedder API (flutter#43705)
flutter/flutter#130619
1 parent 7dc8be3 commit eb8f9d8

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

impeller/entity/entity_pass.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ bool EntityPass::Render(ContentContext& renderer,
247247
const RenderTarget& render_target) const {
248248
auto root_render_target = render_target;
249249

250-
if (root_render_target.GetColorAttachments().empty()) {
250+
if (root_render_target.GetColorAttachments().find(0u) ==
251+
root_render_target.GetColorAttachments().end()) {
251252
VALIDATION_LOG << "The root RenderTarget must have a color attachment.";
252253
return false;
253254
}
@@ -341,7 +342,7 @@ bool EntityPass::Render(ContentContext& renderer,
341342

342343
// The safety check for fetching this color attachment is at the beginning of
343344
// this method.
344-
auto color0 = root_render_target.GetColorAttachments().find(0)->second;
345+
auto color0 = root_render_target.GetColorAttachments().find(0u)->second;
345346

346347
// If a root stencil was provided by the caller, then verify that it has a
347348
// configuration which can be used to render this pass.

shell/gpu/gpu_surface_gl_impeller.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceGLImpeller::AcquireFrame(
8383
GLFrameInfo frame_info = {static_cast<uint32_t>(size.width()),
8484
static_cast<uint32_t>(size.height())};
8585
const GLFBOInfo fbo_info = delegate_->GLContextFBO(frame_info);
86-
8786
auto surface = impeller::SurfaceGLES::WrapFBO(
8887
impeller_context_, // context
8988
swap_callback, // swap_callback

shell/platform/embedder/embedder.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ MakeRenderTargetFromBackingStoreImpeller(
999999

10001000
impeller::RenderTarget render_target_desc;
10011001

1002-
render_target_desc.SetColorAttachment(color0, framebuffer->target);
1002+
render_target_desc.SetColorAttachment(color0, 0u);
10031003
render_target_desc.SetStencilAttachment(stencil0);
10041004

10051005
return std::make_unique<flutter::EmbedderRenderTargetImpeller>(

0 commit comments

Comments
 (0)