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.
This commit is contained in:
Cam Mannett
2024-09-18 09:08:29 +01:00
committed by Baldur Karlsson
parent 0f8ad0d1fe
commit 031c4955e9
@@ -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);