From ab8789dd8423fb491b59985025ad552d4e7c5d8f Mon Sep 17 00:00:00 2001 From: Tony Barbour Date: Thu, 2 Feb 2017 09:31:30 -0700 Subject: layers: Tolerate null handles in destroy and free routines Several CTS tests call destroy routines with null pointers. This keeps validation layers from crashing or reporting false positives Change-Id: I95a3bee21902598dffc0df28e53f5ff253cb6207 --- layers/object_tracker.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'layers/object_tracker.cpp') diff --git a/layers/object_tracker.cpp b/layers/object_tracker.cpp index f4acbe36..41811e94 100644 --- a/layers/object_tracker.cpp +++ b/layers/object_tracker.cpp @@ -3475,7 +3475,9 @@ VKAPI_ATTR void VKAPI_CALL FreeCommandBuffers(VkDevice device, VkCommandPool com ValidateObject(device, commandPool, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT, false, VALIDATION_ERROR_00099); ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false, VALIDATION_ERROR_00098); for (uint32_t i = 0; i < commandBufferCount; i++) { - skip_call |= ValidateCommandBuffer(device, commandPool, pCommandBuffers[i]); + if (pCommandBuffers[i] != VK_NULL_HANDLE) { + skip_call |= ValidateCommandBuffer(device, commandPool, pCommandBuffers[i]); + } } for (uint32_t i = 0; i < commandBufferCount; i++) { @@ -3521,7 +3523,9 @@ VKAPI_ATTR VkResult VKAPI_CALL FreeDescriptorSets(VkDevice device, VkDescriptorP ValidateObject(device, descriptorPool, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, false, VALIDATION_ERROR_00924); skip_call |= ValidateObject(device, device, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, false, VALIDATION_ERROR_00923); for (uint32_t i = 0; i < descriptorSetCount; i++) { - skip_call |= ValidateDescriptorSet(device, descriptorPool, pDescriptorSets[i]); + if (pDescriptorSets[i] != VK_NULL_HANDLE) { + skip_call |= ValidateDescriptorSet(device, descriptorPool, pDescriptorSets[i]); + } } for (uint32_t i = 0; i < descriptorSetCount; i++) { -- cgit v1.2.3