From f120511084554d66f495d6090f16c75112586bfd Mon Sep 17 00:00:00 2001 From: Michael Lentine Date: Wed, 10 Feb 2016 09:55:49 -0600 Subject: [PATCH] layers: Also allow fences to be submitted via acquire next image. --- layers/mem_tracker.cpp | 19 ++++++++++++++++--- layers/mem_tracker.h | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp index e883c7a..9a26a7e 100644 --- a/layers/mem_tracker.cpp +++ b/layers/mem_tracker.cpp @@ -1995,9 +1995,18 @@ verifyFenceStatus( skipCall |= log_msg(my_data->report_data, VK_DEBUG_REPORT_INFO_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, (uint64_t) fence, __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM", "%s specified fence %#" PRIxLEAST64 " already in SIGNALED state.", apiCall, (uint64_t) fence); } - if (!pFenceInfo->second.queue) { // Checking status of unsubmitted fence - skipCall |= log_msg(my_data->report_data, VK_DEBUG_REPORT_WARN_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, (uint64_t) fence, __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM", - "%s called for fence %#" PRIxLEAST64 " which has not been submitted on a Queue.", apiCall, (uint64_t) fence); + if (!pFenceInfo->second.queue && + !pFenceInfo->second + .swapchain) { // Checking status of unsubmitted fence + skipCall |= log_msg( + my_data->report_data, VK_DEBUG_REPORT_WARN_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT, + reinterpret_cast(fence), + __LINE__, MEMTRACK_INVALID_FENCE_STATE, "MEM", + "%s called for fence %#" PRIxLEAST64 + " which has not been submitted on a Queue or during " + "acquire next image.", + apiCall, reinterpret_cast(fence)); } } else { pFenceInfo->second.firstTimeFlag = VK_FALSE; @@ -3118,6 +3127,10 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR( } my_data->semaphoreMap[semaphore] = MEMTRACK_SEMAPHORE_STATE_SIGNALLED; } + auto fence_data = my_data->fenceMap.find(fence); + if (fence_data != my_data->fenceMap.end()) { + fence_data->second.swapchain = swapchain; + } loader_platform_thread_unlock_mutex(&globalLock); if (VK_FALSE == skipCall) { result = my_data->device_dispatch_table->AcquireNextImageKHR(device, diff --git a/layers/mem_tracker.h b/layers/mem_tracker.h index 23b57f6..414ae48 100644 --- a/layers/mem_tracker.h +++ b/layers/mem_tracker.h @@ -185,6 +185,8 @@ struct MT_PASS_INFO { struct MT_FENCE_INFO { uint64_t fenceId; // Sequence number for fence at last submit VkQueue queue; // Queue that this fence is submitted against or NULL + VkSwapchainKHR + swapchain; // Swapchain that this fence is submitted against or NULL VkBool32 firstTimeFlag; // Fence was created in signaled state, avoid warnings for first use VkFenceCreateInfo createInfo; }; -- 2.7.4