aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-04-11 18:32:23 +1200
committerTobin Ehlis <tobine@google.com>2016-04-11 09:16:10 -0600
commit5b36324d53c6e6847573a82f2695205b92ba7612 (patch)
treeec1e5801fa04c5302217d9e25526c42c6da92956 /layers/core_validation.cpp
parentb3cc16c5be869aad9ec0af2af2d928023e11a7ba (diff)
downloadusermoji-5b36324d53c6e6847573a82f2695205b92ba7612.tar.xz
layers: renderpass compatibility: there is only one d/s attachment
Previously this function assumed there were as many d/s attachments as color attachments, which is invalid. Besides not making sense, we'd end up dereferencing memory beyond that pointed to by VkSubpassDescription::pDepthStencilAttachment if we had multiple color attachments. Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index f8f1e783..8b62a9f3 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -2185,16 +2185,18 @@ static bool verify_renderpass_compatibility(layer_data *my_data, const VkRenderP
errorStr << "resolve attachments at index " << cIdx << " of subpass index " << spIndex << " are not compatible.";
errorMsg = errorStr.str();
return false;
- } else if (!attachment_references_compatible(cIdx, primaryRPCI->pSubpasses[spIndex].pDepthStencilAttachment,
- primaryColorCount, primaryRPCI->pAttachments,
- secondaryRPCI->pSubpasses[spIndex].pDepthStencilAttachment,
- secondaryColorCount, secondaryRPCI->pAttachments)) {
- errorStr << "depth/stencil attachments at index " << cIdx << " of subpass index " << spIndex
- << " are not compatible.";
- errorMsg = errorStr.str();
- return false;
}
}
+
+ if (!attachment_references_compatible(0, primaryRPCI->pSubpasses[spIndex].pDepthStencilAttachment,
+ 1, primaryRPCI->pAttachments,
+ secondaryRPCI->pSubpasses[spIndex].pDepthStencilAttachment,
+ 1, secondaryRPCI->pAttachments)) {
+ errorStr << "depth/stencil attachments of subpass index " << spIndex << " are not compatible.";
+ errorMsg = errorStr.str();
+ return false;
+ }
+
uint32_t primaryInputCount = primaryRPCI->pSubpasses[spIndex].inputAttachmentCount;
uint32_t secondaryInputCount = secondaryRPCI->pSubpasses[spIndex].inputAttachmentCount;
uint32_t inputMax = std::max(primaryInputCount, secondaryInputCount);