This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
impeller/renderer/backend/vulkan Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,8 @@ SharedHandleVK<vk::RenderPass> RenderPassVK::CreateVKRenderPass(
145145 }
146146 }
147147
148- if (auto depth = render_target_.GetDepthAttachment (); depth.has_value ()) {
148+ auto depth = render_target_.GetDepthAttachment ();
149+ if (depth.has_value ()) {
149150 depth_stencil_ref = vk::AttachmentReference{
150151 static_cast <uint32_t >(attachments.size ()),
151152 vk::ImageLayout::eDepthStencilAttachmentOptimal};
@@ -162,8 +163,13 @@ SharedHandleVK<vk::RenderPass> RenderPassVK::CreateVKRenderPass(
162163 vk::ImageLayout::eDepthStencilAttachmentOptimal};
163164 attachments.emplace_back (CreateAttachmentDescription (
164165 stencil.value (), &Attachment::texture, supports_framebuffer_fetch));
165- SetTextureLayout (stencil.value (), attachments.back (), command_buffer,
166- &Attachment::texture);
166+
167+ // If the depth and stencil are stored in the same texture, we need to make
168+ // sure we don't transition the layout twice.
169+ if (depth.has_value () && depth->texture != stencil->texture ) {
170+ SetTextureLayout (stencil.value (), attachments.back (), command_buffer,
171+ &Attachment::texture);
172+ }
167173 }
168174
169175 vk::SubpassDescription subpass_desc;
You can’t perform that action at this time.
0 commit comments