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 +10
-3
lines changed
impeller/renderer/backend/vulkan Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,8 @@ SharedHandleVK<vk::RenderPass> RenderPassVK::CreateVKRenderPass(
196196 }
197197 }
198198
199- if (auto depth = render_target_.GetDepthAttachment (); depth.has_value ()) {
199+ auto depth = render_target_.GetDepthAttachment ();
200+ if (depth.has_value ()) {
200201 depth_stencil_ref = vk::AttachmentReference{
201202 static_cast <uint32_t >(attachments.size ()),
202203 vk::ImageLayout::eDepthStencilAttachmentOptimal};
@@ -213,8 +214,14 @@ SharedHandleVK<vk::RenderPass> RenderPassVK::CreateVKRenderPass(
213214 vk::ImageLayout::eDepthStencilAttachmentOptimal};
214215 attachments.emplace_back (CreateAttachmentDescription (
215216 stencil.value (), &Attachment::texture, supports_framebuffer_fetch));
216- SetTextureLayout (stencil.value (), attachments.back (), command_buffer,
217- &Attachment::texture);
217+
218+ // If the depth and stencil are stored in the same texture, then we've
219+ // already inserted a memory barrier to transition this texture as part of
220+ // the depth branch above.
221+ if (depth.has_value () && depth->texture != stencil->texture ) {
222+ SetTextureLayout (stencil.value (), attachments.back (), command_buffer,
223+ &Attachment::texture);
224+ }
218225 }
219226
220227 vk::SubpassDescription subpass_desc;
You can’t perform that action at this time.
0 commit comments