Skip to content

Commit

Permalink
[Impeller] Do not use clear color optimization if the subpass is bein…
Browse files Browse the repository at this point in the history
…g collapsed into its parent (flutter#43878)

The InlinePassContext will not apply the clear color within a parent pass that is already in progress.

Fixes flutter/flutter#130824
  • Loading branch information
jason-simmons authored Jul 21, 2023
1 parent 5f102af commit 9babd40
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions impeller/entity/entity_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -604,12 +604,10 @@ bool EntityPass::OnRender(
return false;
}

if (!(GetClearColor(root_pass_size) == Color::BlackTransparent())) {
if (!collapsed_parent_pass &&
!GetClearColor(root_pass_size).IsTransparent()) {
// Force the pass context to create at least one new pass if the clear color
// is present. The `EndPass` first ensures that the clear color will get
// applied even if this EntityPass is getting collapsed into the parent
// pass.
pass_context.EndPass();
// is present.
pass_context.GetRenderPass(pass_depth);
}

Expand Down Expand Up @@ -752,13 +750,15 @@ bool EntityPass::OnRender(
bool is_collapsing_clear_colors = true;
for (const auto& element : elements_) {
// Skip elements that are incorporated into the clear color.
if (is_collapsing_clear_colors) {
auto [entity_color, _] =
ElementAsBackgroundColor(element, root_pass_size);
if (entity_color.has_value()) {
continue;
if (!collapsed_parent_pass) {
if (is_collapsing_clear_colors) {
auto [entity_color, _] =
ElementAsBackgroundColor(element, root_pass_size);
if (entity_color.has_value()) {
continue;
}
is_collapsing_clear_colors = false;
}
is_collapsing_clear_colors = false;
}

EntityResult result =
Expand Down

0 comments on commit 9babd40

Please sign in to comment.