diff options
author | Tony Barbour <tony@LunarG.com> | 2017-04-26 13:59:35 -0600 |
---|---|---|
committer | Tony-LunarG <tony@lunarg.com> | 2017-04-27 09:55:25 -0600 |
commit | 85e85ed4999c43107f117fa8ff832d40c0137a7a (patch) | |
tree | ff07b32152517b1cad937fdf72725ceb9d84dc28 | |
parent | d1952820d1c5b4e2b85d6a97519b001bca56c748 (diff) |
layers: Guard checks of pQueueFamilyIndices
Only examine pQueueFamilyIndices if sharingMode is VK_SHARING_MODE_CONCURRENT
This fixes a crash in CTS when sharing mode was VK_SHARING_MODE_EXCLUSIVE
and queueFamilyIndexCount was VK_QUEUE_FAMILY_IGNORED
Change-Id: I72b1f140e8949e711723e98bdaead15655ab07a5
-rw-r--r-- | layers/core_validation_types.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/layers/core_validation_types.h b/layers/core_validation_types.h index 48d92b44..16175c74 100644 --- a/layers/core_validation_types.h +++ b/layers/core_validation_types.h @@ -209,7 +209,7 @@ class BUFFER_STATE : public BINDABLE { VkBuffer buffer; VkBufferCreateInfo createInfo; BUFFER_STATE(VkBuffer buff, const VkBufferCreateInfo *pCreateInfo) : buffer(buff), createInfo(*pCreateInfo) { - if (createInfo.queueFamilyIndexCount > 0) { + if ((createInfo.sharingMode == VK_SHARING_MODE_CONCURRENT) && (createInfo.queueFamilyIndexCount > 0)) { uint32_t *pQueueFamilyIndices = new uint32_t[createInfo.queueFamilyIndexCount]; for (uint32_t i = 0; i < createInfo.queueFamilyIndexCount; i++) { pQueueFamilyIndices[i] = pCreateInfo->pQueueFamilyIndices[i]; @@ -225,7 +225,7 @@ class BUFFER_STATE : public BINDABLE { BUFFER_STATE(BUFFER_STATE const &rh_obj) = delete; ~BUFFER_STATE() { - if (createInfo.queueFamilyIndexCount > 0) { + if ((createInfo.sharingMode == VK_SHARING_MODE_CONCURRENT) && (createInfo.queueFamilyIndexCount > 0)) { delete createInfo.pQueueFamilyIndices; createInfo.pQueueFamilyIndices = nullptr; } @@ -255,7 +255,7 @@ class IMAGE_STATE : public BINDABLE { bool acquired; // If this is a swapchain image, has it been acquired by the app. IMAGE_STATE(VkImage img, const VkImageCreateInfo *pCreateInfo) : image(img), createInfo(*pCreateInfo), valid(false), acquired(false) { - if (createInfo.queueFamilyIndexCount > 0) { + if ((createInfo.sharingMode == VK_SHARING_MODE_CONCURRENT) && (createInfo.queueFamilyIndexCount > 0)) { uint32_t *pQueueFamilyIndices = new uint32_t[createInfo.queueFamilyIndexCount]; for (uint32_t i = 0; i < createInfo.queueFamilyIndexCount; i++) { pQueueFamilyIndices[i] = pCreateInfo->pQueueFamilyIndices[i]; @@ -271,7 +271,7 @@ class IMAGE_STATE : public BINDABLE { IMAGE_STATE(IMAGE_STATE const &rh_obj) = delete; ~IMAGE_STATE() { - if (createInfo.queueFamilyIndexCount > 0) { + if ((createInfo.sharingMode == VK_SHARING_MODE_CONCURRENT) && (createInfo.queueFamilyIndexCount > 0)) { delete createInfo.pQueueFamilyIndices; createInfo.pQueueFamilyIndices = nullptr; } |