Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions impeller/aiks/picture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ std::shared_ptr<Texture> Picture::RenderToTexture(
"Picture Snapshot MSAA", // label
RenderTarget::
kDefaultColorAttachmentConfigMSAA, // color_attachment_config
std::nullopt // stencil_attachment_config
RenderTarget::
kDefaultStencilAttachmentConfig // stencil_attachment_config
);
} else {
target = render_target_allocator.CreateOffscreen(
Expand All @@ -76,7 +77,8 @@ std::shared_ptr<Texture> Picture::RenderToTexture(
/*mip_count=*/1,
"Picture Snapshot", // label
RenderTarget::kDefaultColorAttachmentConfig, // color_attachment_config
std::nullopt // stencil_attachment_config
RenderTarget::
kDefaultStencilAttachmentConfig // stencil_attachment_config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just these changes in picture.cc are needed to get us over the line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The remaining backdrop blur goldens for GLES were fixed with #51173

);
}
if (!target.IsValid()) {
Expand Down
38 changes: 11 additions & 27 deletions impeller/entity/entity_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -459,29 +459,11 @@ bool EntityPass::Render(ContentContext& renderer,
// this method.
auto color0 = root_render_target.GetColorAttachments().find(0u)->second;

// If a root stencil was provided by the caller, then verify that it has a
// configuration which can be used to render this pass.
auto stencil_attachment = root_render_target.GetStencilAttachment();
auto depth_attachment = root_render_target.GetDepthAttachment();
if (stencil_attachment.has_value() && depth_attachment.has_value()) {
auto stencil_texture = stencil_attachment->texture;
if (!stencil_texture) {
VALIDATION_LOG << "The root RenderTarget must have a stencil texture.";
return false;
}

auto stencil_storage_mode =
stencil_texture->GetTextureDescriptor().storage_mode;
if (reads_from_onscreen_backdrop &&
stencil_storage_mode == StorageMode::kDeviceTransient) {
VALIDATION_LOG << "The given root RenderTarget stencil needs to be read, "
"but it's marked as transient.";
return false;
}
}
// Setup a new root stencil with an optimal configuration if one wasn't
// provided by the caller.
else {
if (!stencil_attachment.has_value() || !depth_attachment.has_value()) {
// Setup a new root stencil with an optimal configuration if one wasn't
// provided by the caller.
root_render_target.SetupDepthStencilAttachments(
*renderer.GetContext(), *renderer.GetContext()->GetResourceAllocator(),
color0.texture->GetSize(),
Expand Down Expand Up @@ -739,12 +721,7 @@ bool EntityPass::RenderElement(Entity& element_entity,
return false;
}

// If the pass context returns a backdrop texture, we need to draw it to the
// current pass. We do this because it's faster and takes significantly less
// memory than storing/loading large MSAA textures. Also, it's not possible to
// blit the non-MSAA resolve texture of the previous pass to MSAA textures
// (let alone a transient one).
if (result.backdrop_texture) {
if (result.just_created) {
// Restore any clips that were recorded before the backdrop filter was
// applied.
auto& replay_entities = clip_replay_->GetReplayEntities();
Expand All @@ -753,7 +730,14 @@ bool EntityPass::RenderElement(Entity& element_entity,
VALIDATION_LOG << "Failed to render entity for clip restore.";
}
}
}

// If the pass context returns a backdrop texture, we need to draw it to the
// current pass. We do this because it's faster and takes significantly less
// memory than storing/loading large MSAA textures. Also, it's not possible to
// blit the non-MSAA resolve texture of the previous pass to MSAA textures
// (let alone a transient one).
if (result.backdrop_texture) {
auto size_rect = Rect::MakeSize(result.pass->GetRenderTargetSize());
auto msaa_backdrop_contents = TextureContents::MakeRect(size_rect);
msaa_backdrop_contents->SetStencilEnabled(false);
Expand Down
1 change: 1 addition & 0 deletions impeller/entity/inline_pass_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ InlinePassContext::RenderPassResult InlinePassContext::GetRenderPass(
" Count=" + std::to_string(pass_count_));

result.pass = pass_;
result.just_created = true;

if (!renderer_.GetContext()->GetCapabilities()->SupportsReadFromResolve() &&
result.backdrop_texture ==
Expand Down