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