SDL: Vulkan Renderer - closes #9385. When the vertex buffer size is exceeded, make sure to wait for outstanding work before...

From 650ba8f3ec8caeb8eced140076dbd2490892d75d Mon Sep 17 00:00:00 2001
From: danginsburg <[EMAIL REDACTED]>
Date: Mon, 1 Apr 2024 09:19:58 -0400
Subject: [PATCH] Vulkan Renderer - closes #9385.  When the vertex buffer size
 is exceeded, make sure to wait for outstanding work before resizing it.  This
 fixes validation errors/crash found with using Imgui SDL3 renderer on Vulkan.

---
 src/render/vulkan/SDL_render_vulkan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/render/vulkan/SDL_render_vulkan.c b/src/render/vulkan/SDL_render_vulkan.c
index ea3d9adc8ce74..a38d65c94b8fd 100644
--- a/src/render/vulkan/SDL_render_vulkan.c
+++ b/src/render/vulkan/SDL_render_vulkan.c
@@ -3146,6 +3146,8 @@ static SDL_bool VULKAN_UpdateVertexBuffer(SDL_Renderer *renderer,
     }
     /* If the existing vertex buffer isn't big enough, we need to recreate a big enough one */
     if (dataSizeInBytes > rendererData->vertexBuffers[vbidx].size) {
+        VULKAN_IssueBatch(rendererData);
+        VULKAN_WaitForGPU(rendererData);
         VULKAN_CreateVertexBuffer(rendererData, vbidx, dataSizeInBytes);
     }