fix some fence edge cases

submit_rewrite
cosmonaut 2022-01-17 21:09:27 -08:00
parent e59e3e6b02
commit 80fdf09d86
1 changed files with 48 additions and 39 deletions

View File

@ -8469,6 +8469,8 @@ static void VULKAN_INTERNAL_ResetUsedFences(
) {
uint32_t i;
if (renderer->usedFenceCount > 0)
{
/* Prepare the command buffer fence for submission */
renderer->vkResetFences(
renderer->logicalDevice,
@ -8493,6 +8495,7 @@ static void VULKAN_INTERNAL_ResetUsedFences(
}
renderer->usedFenceCount = 0;
}
}
/* Submission structure */
@ -8501,6 +8504,8 @@ static void VULKAN_Wait(
) {
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
if (renderer->usedFenceCount > 0)
{
renderer->vkWaitForFences(
renderer->logicalDevice,
renderer->usedFenceCount,
@ -8511,6 +8516,7 @@ static void VULKAN_Wait(
VULKAN_INTERNAL_ResetUsedFences(renderer);
}
}
static void VULKAN_Submit(
Refresh_Renderer *driverData,
@ -8573,6 +8579,8 @@ static void VULKAN_Submit(
if (present)
{
/* Wait for the previous submission to complete */
if (renderer->usedFenceCount)
{
vulkanResult = renderer->vkWaitForFences(
renderer->logicalDevice,
renderer->usedFenceCount,
@ -8587,6 +8595,7 @@ static void VULKAN_Submit(
LogVulkanResultAsError("vkWaitForFences", vulkanResult);
return;
}
}
VULKAN_INTERNAL_PostWorkCleanup(renderer);