Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 503d196

Browse files
committed
Allow depth/stencil attachment to be VK_ATTACHMENT_UNUSED in clear
Test: dEQP-VK.renderpass.suballocation.unused_clear_attachments.*depth* Bug: b/144280552 Change-Id: I37072270105caf206ed3ab6cb2895d32ef22f653 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/38108 Tested-by: Chris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Reviewed-by: Nicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
1 parent 3c4707d commit 503d196

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/Vulkan/VkFramebuffer.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,22 @@ void Framebuffer::clearAttachment(const RenderPass* renderPass, uint32_t subpass
9696
}
9797
else if (attachment.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT))
9898
{
99-
ASSERT(subpass.pDepthStencilAttachment->attachment < attachmentCount);
100-
ImageView *imageView = attachments[subpass.pDepthStencilAttachment->attachment];
99+
uint32_t attachmentIndex = subpass.pDepthStencilAttachment->attachment;
101100

102-
if (renderPass->isMultiView())
103-
{
104-
imageView->clearWithLayerMask(attachment.clearValue, attachment.aspectMask, rect.rect,
105-
renderPass->getViewMask(subpassIndex));
106-
}
107-
else
101+
if (attachmentIndex != VK_ATTACHMENT_UNUSED)
108102
{
109-
imageView->clear(attachment.clearValue, attachment.aspectMask, rect);
103+
ASSERT(attachmentIndex < attachmentCount);
104+
ImageView *imageView = attachments[attachmentIndex];
105+
106+
if (renderPass->isMultiView())
107+
{
108+
imageView->clearWithLayerMask(attachment.clearValue, attachment.aspectMask, rect.rect,
109+
renderPass->getViewMask(subpassIndex));
110+
}
111+
else
112+
{
113+
imageView->clear(attachment.clearValue, attachment.aspectMask, rect);
114+
}
110115
}
111116
}
112117
}

0 commit comments

Comments
 (0)