aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-07-01 11:28:00 +1200
committerChris Forbes <chrisforbes@google.com>2016-07-01 12:02:30 +1200
commit3bca19296ac3001ebf1e787ed5d2945e6360aa10 (patch)
treedcc661568cad41959d3b67dfdd9289bd0beed7ce /layers/core_validation.cpp
parent431538ef1f0778bd4c6ef3e41aae944eaa36e72b (diff)
downloadusermoji-3bca19296ac3001ebf1e787ed5d2945e6360aa10.tar.xz
layers: Fix crash in ValidateLayouts 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.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 51c7f065..d4875043 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -8738,6 +8738,10 @@ static bool ValidateLayouts(const layer_data *my_data, VkDevice device, const Vk
for (uint32_t i = 0; i < pCreateInfo->subpassCount; ++i) {
const VkSubpassDescription &subpass = pCreateInfo->pSubpasses[i];
for (uint32_t j = 0; j < subpass.inputAttachmentCount; ++j) {
+ auto attach_index = subpass.pInputAttachments[j].attachment;
+ if (attach_index == VK_ATTACHMENT_UNUSED)
+ continue;
+
if (subpass.pInputAttachments[j].layout != VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL &&
subpass.pInputAttachments[j].layout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) {
if (subpass.pInputAttachments[j].layout == VK_IMAGE_LAYOUT_GENERAL) {
@@ -8752,11 +8756,14 @@ static bool ValidateLayouts(const layer_data *my_data, VkDevice device, const Vk
string_VkImageLayout(subpass.pInputAttachments[j].layout));
}
}
- auto attach_index = subpass.pInputAttachments[j].attachment;
skip |= ValidateLayoutVsAttachmentDescription(my_data->report_data, subpass.pInputAttachments[j].layout, attach_index,
pCreateInfo->pAttachments[attach_index]);
}
for (uint32_t j = 0; j < subpass.colorAttachmentCount; ++j) {
+ auto attach_index = subpass.pColorAttachments[j].attachment;
+ if (attach_index == VK_ATTACHMENT_UNUSED)
+ continue;
+
if (subpass.pColorAttachments[j].layout != VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
if (subpass.pColorAttachments[j].layout == VK_IMAGE_LAYOUT_GENERAL) {
// TODO: Verify Valid Use in spec. I believe this is allowed (valid) but may not be optimal performance
@@ -8770,7 +8777,6 @@ static bool ValidateLayouts(const layer_data *my_data, VkDevice device, const Vk
string_VkImageLayout(subpass.pColorAttachments[j].layout));
}
}
- auto attach_index = subpass.pColorAttachments[j].attachment;
skip |= ValidateLayoutVsAttachmentDescription(my_data->report_data, subpass.pColorAttachments[j].layout, attach_index,
pCreateInfo->pAttachments[attach_index]);
}