Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions impeller/entity/inline_pass_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,38 @@ InlinePassContext::RenderPassResult InlinePassContext::GetRenderPass(
" Count=" + std::to_string(pass_count_));

RenderPassResult result;

if (pass_count_ > 0) {
result.backdrop_texture =
pass_target_.Flip(*context_->GetResourceAllocator());
if (!result.backdrop_texture) {
VALIDATION_LOG << "Could not flip the EntityPass render target.";
{
// If the pass target has a resolve texture, then we're using MSAA.
bool is_msaa = pass_target_.GetRenderTarget()
.GetColorAttachments()
.find(0)
->second.resolve_texture != nullptr;
if (pass_count_ > 0 && is_msaa) {
result.backdrop_texture =
pass_target_.Flip(*context_->GetResourceAllocator());
if (!result.backdrop_texture) {
VALIDATION_LOG << "Could not flip the EntityPass render target.";
}
}
}

// Find the color attachment a second time, since the target may have just
// flipped.
auto color0 =
pass_target_.GetRenderTarget().GetColorAttachments().find(0)->second;
bool is_msaa = color0.resolve_texture != nullptr;

color0.load_action =
pass_count_ > 0 ? LoadAction::kDontCare : LoadAction::kClear;
if (pass_count_ > 0) {
// When MSAA is being used, we end up overriding the entire backdrop by
// drawing the previous pass texture, and so we don't have to clear it and
// can use kDontCare.
color0.load_action = is_msaa ? LoadAction::kDontCare : LoadAction::kLoad;
} else {
color0.load_action = LoadAction::kClear;
}

color0.store_action = color0.resolve_texture
? StoreAction::kMultisampleResolve
: StoreAction::kStore;
color0.store_action =
is_msaa ? StoreAction::kMultisampleResolve : StoreAction::kStore;

auto stencil = pass_target_.GetRenderTarget().GetStencilAttachment();
if (!stencil.has_value()) {
Expand Down