From 9ed8a70eef308e8f2fb12066448f8505d31ef9f8 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 6 Jul 2023 15:22:57 -0700 Subject: [PATCH] [Impeller] Set up the clear color for non-MSAA render targets This is needed when using the "collapse DrawRects into clear colors" optimization on GLES. --- impeller/entity/entity_pass.cc | 1 + impeller/renderer/render_target.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/impeller/entity/entity_pass.cc b/impeller/entity/entity_pass.cc index 8b1aac582550e..e6ed2d97578ba 100644 --- a/impeller/entity/entity_pass.cc +++ b/impeller/entity/entity_pass.cc @@ -210,6 +210,7 @@ static EntityPassTarget CreateRenderTarget(ContentContext& renderer, .storage_mode = StorageMode::kDevicePrivate, .load_action = LoadAction::kDontCare, .store_action = StoreAction::kDontCare, + .clear_color = clear_color, }, // color_attachment_config GetDefaultStencilConfig(readable) // stencil_attachment_config ); diff --git a/impeller/renderer/render_target.cc b/impeller/renderer/render_target.cc index 0b52640fff117..46ca72b0a815b 100644 --- a/impeller/renderer/render_target.cc +++ b/impeller/renderer/render_target.cc @@ -232,7 +232,7 @@ RenderTarget RenderTarget::CreateOffscreen( static_cast(TextureUsage::kShaderRead); ColorAttachment color0; - color0.clear_color = Color::BlackTransparent(); + color0.clear_color = color_attachment_config.clear_color; color0.load_action = color_attachment_config.load_action; color0.store_action = color_attachment_config.store_action; color0.texture = context.GetResourceAllocator()->CreateTexture(color_tex0);