Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9babd40

Browse files
[Impeller] Do not use clear color optimization if the subpass is being collapsed into its parent (#43878)
The InlinePassContext will not apply the clear color within a parent pass that is already in progress. Fixes flutter/flutter#130824
1 parent 5f102af commit 9babd40

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

impeller/entity/entity_pass.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -604,12 +604,10 @@ bool EntityPass::OnRender(
604604
return false;
605605
}
606606

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

@@ -752,13 +750,15 @@ bool EntityPass::OnRender(
752750
bool is_collapsing_clear_colors = true;
753751
for (const auto& element : elements_) {
754752
// Skip elements that are incorporated into the clear color.
755-
if (is_collapsing_clear_colors) {
756-
auto [entity_color, _] =
757-
ElementAsBackgroundColor(element, root_pass_size);
758-
if (entity_color.has_value()) {
759-
continue;
753+
if (!collapsed_parent_pass) {
754+
if (is_collapsing_clear_colors) {
755+
auto [entity_color, _] =
756+
ElementAsBackgroundColor(element, root_pass_size);
757+
if (entity_color.has_value()) {
758+
continue;
759+
}
760+
is_collapsing_clear_colors = false;
760761
}
761-
is_collapsing_clear_colors = false;
762762
}
763763

764764
EntityResult result =

0 commit comments

Comments
 (0)