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
diff --git a/layers/object_tracker.cpp b/layers/object_tracker.cpp
index f4acbe3..41811e9 100644
--- a/layers/object_tracker.cpp
+++ b/layers/object_tracker.cpp
@@ -3475,7 +3475,9 @@
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 @@
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++) {