From 0fda7ff2b17ea83f451b59b7dbcf1f2660730eef Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Tue, 22 Mar 2016 10:07:26 -0600 Subject: layers: LX450, Tighten up queueFamilyIndex validation, fix crash For CreateBuffer and CreateImage the QFIs should be ignored unless sharingMode is set to CONCURRENT. Also added QFI validation to CreateCommandPool and added a special case for when an index is incorrectly set to QUEUE_FAMILY_IGNORED. Change-Id: I17639230ea7aa58ab89b9b0dc33e55927e9f1c84 --- layers/core_validation.cpp | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 4ea26ba5..62507903 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -6293,30 +6293,11 @@ vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocation loader_platform_thread_unlock_mutex(&globalLock); } -VkBool32 validate_queue_family_indices(layer_data *dev_data, const char *function_name, const uint32_t count, - const uint32_t *indices) { - VkBool32 skipCall = VK_FALSE; - for (auto i = 0; i < count; i++) { - if (indices[i] >= dev_data->physDevProperties.queue_family_properties.size()) { - skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, - DRAWSTATE_INVALID_QUEUE_INDEX, "DS", - "%s has QueueFamilyIndex greater than the number of QueueFamilies (" PRINTF_SIZE_T_SPECIFIER - ") for this device.", - function_name, dev_data->physDevProperties.queue_family_properties.size()); - } - } - return skipCall; -} - -VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { - VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; +VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); - bool skipCall = validate_queue_family_indices(dev_data, "vkCreateBuffer", pCreateInfo->queueFamilyIndexCount, - pCreateInfo->pQueueFamilyIndices); - if (!skipCall) { - result = dev_data->device_dispatch_table->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); - } + + VkResult result = dev_data->device_dispatch_table->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); if (VK_SUCCESS == result) { loader_platform_thread_lock_mutex(&globalLock); @@ -6350,15 +6331,11 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice devic return result; } -VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage) { - VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; +VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkImage *pImage) { layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); - bool skipCall = validate_queue_family_indices(dev_data, "vkCreateImage", pCreateInfo->queueFamilyIndexCount, - pCreateInfo->pQueueFamilyIndices); - if (!skipCall) { - result = dev_data->device_dispatch_table->CreateImage(device, pCreateInfo, pAllocator, pImage); - } + + VkResult result = dev_data->device_dispatch_table->CreateImage(device, pCreateInfo, pAllocator, pImage); if (VK_SUCCESS == result) { loader_platform_thread_lock_mutex(&globalLock); -- cgit v1.2.3