aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2016-06-20 18:49:25 -0600
committerMark Lobodzinski <mark@lunarg.com>2016-06-21 09:06:10 -0600
commitfbfc941fd1ef655b32873d2f61c346cf4e0a2a87 (patch)
tree85701f48c515c3e010d1d62a62ff7b400fa45e1b
parent5b423ea3a3613ec792f18528baaa0f54ae348b7b (diff)
downloadusermoji-fbfc941fd1ef655b32873d2f61c346cf4e0a2a87.tar.xz
layers: Fix Windows crash in Dota2
In core_validation attachment_references_compatible(), having array elements set to VK_ATTACHMENT_UNUSED was not handled resulting in invalid memory references. Change-Id: If78aea1467d191db905272bece16cc9f56643136
-rw-r--r--layers/core_validation.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 3cdedc6d..b0b8515f 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -2134,7 +2134,7 @@ static bool validate_draw_state_flags(layer_data *dev_data, GLOBAL_CB_NODE *pCB,
// Verify attachment reference compatibility according to spec
// If one array is larger, treat missing elements of shorter array as VK_ATTACHMENT_UNUSED & other array much match this
-// If both AttachmentReference arrays have requested index, check their corresponding AttachementDescriptions
+// If both AttachmentReference arrays have requested index, check their corresponding AttachmentDescriptions
// to make sure that format and samples counts match.
// If not, they are not compatible.
static bool attachment_references_compatible(const uint32_t index, const VkAttachmentReference *pPrimary,
@@ -2156,7 +2156,12 @@ static bool attachment_references_compatible(const uint32_t index, const VkAttac
} else if (index >= secondaryCount) { // Check primary as if secondary is VK_ATTACHMENT_UNUSED
if (VK_ATTACHMENT_UNUSED == pPrimary[index].attachment)
return true;
- } else { // format and sample count must match
+ } else { // Format and sample count must match
+ if ((pPrimary[index].attachment == VK_ATTACHMENT_UNUSED) && (pSecondary[index].attachment == VK_ATTACHMENT_UNUSED)) {
+ return true;
+ } else if ((pPrimary[index].attachment == VK_ATTACHMENT_UNUSED) || (pSecondary[index].attachment == VK_ATTACHMENT_UNUSED)) {
+ return false;
+ }
if ((pPrimaryAttachments[pPrimary[index].attachment].format ==
pSecondaryAttachments[pSecondary[index].attachment].format) &&
(pPrimaryAttachments[pPrimary[index].attachment].samples ==