From 35d90f8dcb50c407acc56311513b48c4ae4b3aa9 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Thu, 15 Feb 2024 20:19:36 -0800 Subject: [PATCH] fix autoReleaseFence race condition --- src/Refresh_Driver_Vulkan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index 749d564..92d8032 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -9661,6 +9661,7 @@ static Refresh_CommandBuffer* VULKAN_AcquireCommandBuffer( commandBuffer->computeUniformBuffer = NULL; commandBuffer->renderPassColorTargetCount = 0; + commandBuffer->autoReleaseFence = 1; /* Reset the command buffer here to avoid resets being called * from a separate thread than where the command buffer was acquired @@ -10322,11 +10323,11 @@ static Refresh_Fence* VULKAN_SubmitAndAcquireFence( ) { VulkanCommandBuffer *vulkanCommandBuffer; - VULKAN_Submit(driverData, commandBuffer); - vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer; vulkanCommandBuffer->autoReleaseFence = 0; + VULKAN_Submit(driverData, commandBuffer); + return (Refresh_Fence*) vulkanCommandBuffer->inFlightFence; } @@ -10377,7 +10378,6 @@ static void VULKAN_Submit( VULKAN_INTERNAL_EndCommandBuffer(renderer, vulkanCommandBuffer); - vulkanCommandBuffer->autoReleaseFence = 1; vulkanCommandBuffer->inFlightFence = VULKAN_INTERNAL_AcquireFenceFromPool(renderer); submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;