From 031c4955e910991648e5763160a564d86e5da4f2 Mon Sep 17 00:00:00 2001 From: Cam Mannett Date: Wed, 18 Sep 2024 09:08:29 +0100 Subject: [PATCH] Check command buffer callback queue before VkDevice is destroyed We only check for signaled events on each queue submit, so the last submission before exit will never be checked. This change makes sure we release for completed submissions just before the device is destroyed (typically target application exit). In this case the callbacks are not called. --- .../driver/vulkan/wrappers/vk_device_funcs.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp index 3f5064cbd..a7447d865 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_device_funcs.cpp @@ -4660,6 +4660,19 @@ void WrappedVulkan::vkDestroyDevice(VkDevice device, const VkAllocationCallbacks SubmitSemaphores(); FlushQ(); + { + SCOPED_LOCK(m_PendingCmdBufferCallbacksLock); + + for(VkPendingSubmissionCompleteCallbacks *pending : m_PendingCmdBufferCallbacks) + { + const VkResult vkr = ObjDisp(m_Device)->GetEventStatus(Unwrap(m_Device), pending->event); + if(vkr == VK_EVENT_SET) + pending->Release(); + } + + m_PendingCmdBufferCallbacks.clear(); + } + // idle the device as well so that external queues are idle. VkResult vkr = ObjDisp(m_Device)->DeviceWaitIdle(Unwrap(m_Device)); CHECK_VKR(this, vkr);