From fbfc941fd1ef655b32873d2f61c346cf4e0a2a87 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Mon, 20 Jun 2016 18:49:25 -0600 Subject: 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 --- layers/core_validation.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'layers/core_validation.cpp') 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 == -- cgit v1.2.3