From e5da75d33a557dd4459d897c28a22f8b26250c09 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Mon, 27 Jun 2022 10:21:40 -0700 Subject: [PATCH] fix exponential growth when submitting multiple command buffers --- src/Refresh_Driver_Vulkan.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Refresh_Driver_Vulkan.c b/src/Refresh_Driver_Vulkan.c index 0e1637f..70f40f6 100644 --- a/src/Refresh_Driver_Vulkan.c +++ b/src/Refresh_Driver_Vulkan.c @@ -9470,9 +9470,9 @@ static void VULKAN_Submit( /* Mark command buffers as submitted */ - if (renderer->submittedCommandBufferCount + commandBufferCount >= renderer->submittedCommandBufferCapacity) + if (renderer->submittedCommandBufferCount + 1 >= renderer->submittedCommandBufferCapacity) { - renderer->submittedCommandBufferCapacity = renderer->submittedCommandBufferCount + commandBufferCount; + renderer->submittedCommandBufferCapacity = renderer->submittedCommandBufferCount + 1; renderer->submittedCommandBuffers = SDL_realloc( renderer->submittedCommandBuffers, @@ -9480,12 +9480,9 @@ static void VULKAN_Submit( ); } - for (i = 0; i < commandBufferCount; i += 1) - { - ((VulkanCommandBuffer*)pCommandBuffers[i])->submitted = 1; - renderer->submittedCommandBuffers[renderer->submittedCommandBufferCount] = (VulkanCommandBuffer*) pCommandBuffers[i]; - renderer->submittedCommandBufferCount += 1; - } + ((VulkanCommandBuffer*)pCommandBuffers[i])->submitted = 1; + renderer->submittedCommandBuffers[renderer->submittedCommandBufferCount] = (VulkanCommandBuffer*) pCommandBuffers[i]; + renderer->submittedCommandBufferCount += 1; /* Present, if applicable */