fix autoReleaseFence race condition

pull/50/head
cosmonaut 2024-02-15 20:19:36 -08:00
parent 86099fb7ee
commit 35d90f8dcb
1 changed files with 3 additions and 3 deletions

View File

@ -9661,6 +9661,7 @@ static Refresh_CommandBuffer* VULKAN_AcquireCommandBuffer(
commandBuffer->computeUniformBuffer = NULL; commandBuffer->computeUniformBuffer = NULL;
commandBuffer->renderPassColorTargetCount = 0; commandBuffer->renderPassColorTargetCount = 0;
commandBuffer->autoReleaseFence = 1;
/* Reset the command buffer here to avoid resets being called /* Reset the command buffer here to avoid resets being called
* from a separate thread than where the command buffer was acquired * from a separate thread than where the command buffer was acquired
@ -10322,11 +10323,11 @@ static Refresh_Fence* VULKAN_SubmitAndAcquireFence(
) { ) {
VulkanCommandBuffer *vulkanCommandBuffer; VulkanCommandBuffer *vulkanCommandBuffer;
VULKAN_Submit(driverData, commandBuffer);
vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer; vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
vulkanCommandBuffer->autoReleaseFence = 0; vulkanCommandBuffer->autoReleaseFence = 0;
VULKAN_Submit(driverData, commandBuffer);
return (Refresh_Fence*) vulkanCommandBuffer->inFlightFence; return (Refresh_Fence*) vulkanCommandBuffer->inFlightFence;
} }
@ -10377,7 +10378,6 @@ static void VULKAN_Submit(
VULKAN_INTERNAL_EndCommandBuffer(renderer, vulkanCommandBuffer); VULKAN_INTERNAL_EndCommandBuffer(renderer, vulkanCommandBuffer);
vulkanCommandBuffer->autoReleaseFence = 1;
vulkanCommandBuffer->inFlightFence = VULKAN_INTERNAL_AcquireFenceFromPool(renderer); vulkanCommandBuffer->inFlightFence = VULKAN_INTERNAL_AcquireFenceFromPool(renderer);
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;