Skip to content

Commit

Permalink
Fix build failure and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bdero committed Sep 20, 2023
1 parent 64d713b commit 530277d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion impeller/entity/entity_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,17 @@ EntityPass::EntityResult EntityPass::GetEntityForElement(
proc(FilterInput::Make(std::move(texture)),
subpass->xformation_.Basis(), Entity::RenderingMode::kSubpass);

// If the very first thing we render in this EntityPass is a subpass that
// happens to have a backdrop filter, than that backdrop filter will end
// may wind up sampling from the raw, uncleared texture that came straight
// out of the texture cache. By calling `pass_context.GetRenderPass` here,
// we force the texture to pass through at least one RenderPass with the
// correct clear configuration before any sampling occurs.
pass_context.GetRenderPass(pass_depth);

// The subpass will need to read from the current pass texture when
// rendering the backdrop, so if there's an active pass, end it prior to
// rendering the subpass.
pass_context.GetRenderPass(pass_depth);
pass_context.EndPass();
}

Expand Down Expand Up @@ -681,6 +688,13 @@ bool EntityPass::OnRender(
return false;
}

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.
pass_context.GetRenderPass(pass_depth);
}

auto render_element = [&stencil_depth_floor, &pass_context, &pass_depth,
&renderer, &stencil_coverage_stack,
&global_pass_position](Entity& element_entity) {
Expand Down

0 comments on commit 530277d

Please sign in to comment.