From 90be8218a551f261ff1391af28bf24d0b091f35e Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 30 Jun 2016 16:56:15 +1200 Subject: layers: Make TransitionSubpassLayouts work with VK_ATTACHMENT_UNUSED Signed-off-by: Chris Forbes --- layers/core_validation.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 31cb5a1b..b67df88b 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -9126,6 +9126,16 @@ static bool VerifyFramebufferAndRenderPassLayouts(layer_data *dev_data, GLOBAL_C return skip_call; } +static void TransitionAttachmentRefLayout(layer_data *dev_data, GLOBAL_CB_NODE *pCB, + FRAMEBUFFER_NODE *pFramebuffer, + VkAttachmentReference ref) +{ + if (ref.attachment != VK_ATTACHMENT_UNUSED) { + auto image_view = pFramebuffer->createInfo.pAttachments[ref.attachment]; + SetLayout(dev_data, pCB, image_view, ref.layout); + } +} + static void TransitionSubpassLayouts(layer_data *dev_data, GLOBAL_CB_NODE *pCB, const VkRenderPassBeginInfo *pRenderPassBegin, const int subpass_index) { auto renderPass = getRenderPass(dev_data, pRenderPassBegin->renderPass); @@ -9139,16 +9149,13 @@ static void TransitionSubpassLayouts(layer_data *dev_data, GLOBAL_CB_NODE *pCB, const safe_VkFramebufferCreateInfo &framebufferInfo = framebuffer->createInfo; const VkSubpassDescription &subpass = renderPass->pCreateInfo->pSubpasses[subpass_index]; for (uint32_t j = 0; j < subpass.inputAttachmentCount; ++j) { - const VkImageView &image_view = framebufferInfo.pAttachments[subpass.pInputAttachments[j].attachment]; - SetLayout(dev_data, pCB, image_view, subpass.pInputAttachments[j].layout); + TransitionAttachmentRefLayout(dev_data, pCB, framebuffer, subpass.pInputAttachments[j]); } for (uint32_t j = 0; j < subpass.colorAttachmentCount; ++j) { - const VkImageView &image_view = framebufferInfo.pAttachments[subpass.pColorAttachments[j].attachment]; - SetLayout(dev_data, pCB, image_view, subpass.pColorAttachments[j].layout); + TransitionAttachmentRefLayout(dev_data, pCB, framebuffer, subpass.pColorAttachments[j]); } - if ((subpass.pDepthStencilAttachment != NULL) && (subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)) { - const VkImageView &image_view = framebufferInfo.pAttachments[subpass.pDepthStencilAttachment->attachment]; - SetLayout(dev_data, pCB, image_view, subpass.pDepthStencilAttachment->layout); + if (subpass.pDepthStencilAttachment) { + TransitionAttachmentRefLayout(dev_data, pCB, framebuffer, *subpass.pDepthStencilAttachment); } } @@ -9173,7 +9180,7 @@ static void TransitionFinalSubpassLayouts(layer_data *dev_data, GLOBAL_CB_NODE * return; for (uint32_t i = 0; i < pRenderPassInfo->attachmentCount; ++i) { - const VkImageView &image_view = framebuffer->createInfo.pAttachments[i]; + auto image_view = framebuffer->createInfo.pAttachments[i]; SetLayout(dev_data, pCB, image_view, pRenderPassInfo->pAttachments[i].finalLayout); } } -- cgit v1.2.3