Commit c72c8d76 by Chris Forbes

Fix vkClearAttachments VK_ATTACHMENT_UNUSED handling

Bug: b/140178640 Test: dEQP-VK.renderpass.suballocation.unused* Change-Id: I3ad3ef55946e4f63e941e6df11a02ca4e2ac6e26 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/35554Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 2fb2bde6
...@@ -74,11 +74,13 @@ void Framebuffer::clearAttachment(const RenderPass* renderPass, uint32_t subpass ...@@ -74,11 +74,13 @@ void Framebuffer::clearAttachment(const RenderPass* renderPass, uint32_t subpass
if (attachment.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) if (attachment.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT)
{ {
if (attachment.colorAttachment != VK_ATTACHMENT_UNUSED) ASSERT(attachment.colorAttachment < subpass.colorAttachmentCount);
uint32_t attachmentIndex = subpass.pColorAttachments[attachment.colorAttachment].attachment;
if (attachmentIndex != VK_ATTACHMENT_UNUSED)
{ {
ASSERT(attachment.colorAttachment < subpass.colorAttachmentCount); ASSERT(attachmentIndex < attachmentCount);
ASSERT(subpass.pColorAttachments[attachment.colorAttachment].attachment < attachmentCount); ImageView *imageView = attachments[attachmentIndex];
ImageView *imageView = attachments[subpass.pColorAttachments[attachment.colorAttachment].attachment];
if (renderPass->isMultiView()) if (renderPass->isMultiView())
{ {
...@@ -143,4 +145,4 @@ size_t Framebuffer::ComputeRequiredAllocationSize(const VkFramebufferCreateInfo* ...@@ -143,4 +145,4 @@ size_t Framebuffer::ComputeRequiredAllocationSize(const VkFramebufferCreateInfo*
return pCreateInfo->attachmentCount * sizeof(void*); return pCreateInfo->attachmentCount * sizeof(void*);
} }
} // namespace vk } // namespace vk
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment