From 67ceff4d766749ec40ba90071fe9f68a67ef3e87 Mon Sep 17 00:00:00 2001 From: Mark Mueller Date: Wed, 24 Aug 2016 10:42:17 -0600 Subject: layers: GH428 Adding skip_call to DestroySemaphore Use skip_call return from log_msg callback to decide whether or not to pass the call to lower layers. Change-Id: I96090539e9001bbda32533055b143c872d88e4bf --- layers/core_validation.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'layers') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 46b1d616..16303868 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -5238,18 +5238,23 @@ VKAPI_ATTR void VKAPI_CALL DestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) { layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); + bool skip_call = false; std::unique_lock lock(global_lock); auto item = dev_data->semaphoreMap.find(semaphore); if (item != dev_data->semaphoreMap.end()) { if (item->second.in_use.load()) { - log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT, - reinterpret_cast(semaphore), __LINE__, DRAWSTATE_OBJECT_INUSE, "DS", - "Cannot delete semaphore 0x%" PRIx64 " which is in use.", reinterpret_cast(semaphore)); + skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT, + reinterpret_cast(semaphore), __LINE__, DRAWSTATE_OBJECT_INUSE, "DS", + "Cannot delete semaphore 0x%" PRIx64 " which is in use.", reinterpret_cast(semaphore)); + } + if (!skip_call) { + dev_data->semaphoreMap.erase(semaphore); } - dev_data->semaphoreMap.erase(semaphore); } lock.unlock(); - dev_data->device_dispatch_table->DestroySemaphore(device, semaphore, pAllocator); + if (!skip_call) { + dev_data->device_dispatch_table->DestroySemaphore(device, semaphore, pAllocator); + } } VKAPI_ATTR void VKAPI_CALL DestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) { -- cgit v1.2.3