[Impeller] Ensure that missing color attachment 0u does not cause crash in embedder API (flutter/engine#43705)

https://github.com/flutter/flutter/issues/130619
This commit is contained in:
Jonah Williams 2023-07-14 15:17:56 -07:00 committed by GitHub
parent 389b81e4ac
commit 4698c6b307
3 changed files with 4 additions and 4 deletions

View File

@ -247,7 +247,8 @@ bool EntityPass::Render(ContentContext& renderer,
const RenderTarget& render_target) const {
auto root_render_target = render_target;
if (root_render_target.GetColorAttachments().empty()) {
if (root_render_target.GetColorAttachments().find(0u) ==
root_render_target.GetColorAttachments().end()) {
VALIDATION_LOG << "The root RenderTarget must have a color attachment.";
return false;
}
@ -341,7 +342,7 @@ bool EntityPass::Render(ContentContext& renderer,
// The safety check for fetching this color attachment is at the beginning of
// this method.
auto color0 = root_render_target.GetColorAttachments().find(0)->second;
auto color0 = root_render_target.GetColorAttachments().find(0u)->second;
// If a root stencil was provided by the caller, then verify that it has a
// configuration which can be used to render this pass.

View File

@ -83,7 +83,6 @@ std::unique_ptr<SurfaceFrame> GPUSurfaceGLImpeller::AcquireFrame(
GLFrameInfo frame_info = {static_cast<uint32_t>(size.width()),
static_cast<uint32_t>(size.height())};
const GLFBOInfo fbo_info = delegate_->GLContextFBO(frame_info);
auto surface = impeller::SurfaceGLES::WrapFBO(
impeller_context_, // context
swap_callback, // swap_callback

View File

@ -999,7 +999,7 @@ MakeRenderTargetFromBackingStoreImpeller(
impeller::RenderTarget render_target_desc;
render_target_desc.SetColorAttachment(color0, framebuffer->target);
render_target_desc.SetColorAttachment(color0, 0u);
render_target_desc.SetStencilAttachment(stencil0);
return std::make_unique<flutter::EmbedderRenderTargetImpeller>(