aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-06-30 16:56:15 +1200
committerChris Forbes <chrisforbes@google.com>2016-07-01 12:02:31 +1200
commit90be8218a551f261ff1391af28bf24d0b091f35e (patch)
treeae9e220dbab442c4401eb750a60e74d0488b8d56 /layers/core_validation.cpp
parentb18697e25ba49b3e86264be6e4c837454358508c (diff)
downloadusermoji-90be8218a551f261ff1391af28bf24d0b091f35e.tar.xz
layers: Make TransitionSubpassLayouts work with VK_ATTACHMENT_UNUSED
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp23
1 files changed, 15 insertions, 8 deletions
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);
}
}