[Impeller] fix render pass depth descriptor. (flutter/engine#51031)

Depth+stencil should be treated as the same attachment. Adding more than one d/s attachment in the render pass descriptor seems to be confusing swiftshader.

@bdero 

This fixes things for me locally, lets let CI take a spin
This commit is contained in:
Jonah Williams 2024-02-28 12:33:51 -08:00 committed by GitHub
parent 98c96670b4
commit 8acca62755
4 changed files with 12 additions and 17 deletions

View File

@ -158,15 +158,18 @@ InlinePassContext::RenderPassResult InlinePassContext::GetRenderPass(
pass_target_.target_.SetDepthAttachment(depth.value());
}
auto depth = pass_target_.GetRenderTarget().GetDepthAttachment();
auto stencil = pass_target_.GetRenderTarget().GetStencilAttachment();
if (!stencil.has_value()) {
VALIDATION_LOG << "Stencil attachment unexpectedly missing from the "
if (!depth.has_value() || !stencil.has_value()) {
VALIDATION_LOG << "Stencil/Depth attachment unexpectedly missing from the "
"EntityPass render target.";
return {};
}
stencil->load_action = LoadAction::kClear;
stencil->store_action = StoreAction::kDontCare;
depth->load_action = LoadAction::kClear;
depth->store_action = StoreAction::kDontCare;
pass_target_.target_.SetDepthAttachment(depth);
pass_target_.target_.SetStencilAttachment(stencil.value());
pass_target_.target_.SetColorAttachment(color0, 0);

View File

@ -600,10 +600,8 @@ void ContextVK::InitializeCommonlyUsedShadersIfNeeded() const {
depth->load_action, //
depth->store_action //
);
}
if (auto stencil = render_target.GetStencilAttachment();
stencil.has_value()) {
} else if (auto stencil = render_target.GetStencilAttachment();
stencil.has_value()) {
builder.SetStencilAttachment(
stencil->texture->GetTextureDescriptor().format, //
stencil->texture->GetTextureDescriptor().sample_count, //

View File

@ -142,9 +142,7 @@ static vk::UniqueRenderPass CreateCompatRenderPassForPipeline(
LoadAction::kDontCare, //
StoreAction::kDontCare //
);
}
if (desc.HasStencilAttachmentDescriptors()) {
} else if (desc.HasStencilAttachmentDescriptors()) {
builder.SetStencilAttachment(desc.GetStencilPixelFormat(), //
desc.GetSampleCount(), //
LoadAction::kDontCare, //

View File

@ -68,9 +68,7 @@ static std::vector<vk::ClearValue> GetVKClearValues(
if (depth.has_value()) {
clears.emplace_back(VKClearValueFromDepthStencil(
stencil ? stencil->clear_stencil : 0u, depth->clear_depth));
}
if (stencil.has_value()) {
} else if (stencil.has_value()) {
clears.emplace_back(VKClearValueFromDepthStencil(
stencil->clear_stencil, depth ? depth->clear_depth : 0.0f));
}
@ -116,10 +114,8 @@ SharedHandleVK<vk::RenderPass> RenderPassVK::CreateVKRenderPass(
depth->store_action //
);
TextureVK::Cast(*depth->texture).SetLayout(barrier);
}
if (auto stencil = render_target_.GetStencilAttachment();
stencil.has_value()) {
} else if (auto stencil = render_target_.GetStencilAttachment();
stencil.has_value()) {
builder.SetStencilAttachment(
stencil->texture->GetTextureDescriptor().format, //
stencil->texture->GetTextureDescriptor().sample_count, //