GPU: Hold submit lock before waiting for device idle

(cherry picked from commit e699f3dca1)
This commit is contained in:
Beyley Cardellio
2025-08-10 00:13:14 -07:00
committed by Sam Lantinga
parent 15cc0f5f91
commit 2287c43b59

View File

@@ -10495,11 +10495,18 @@ static bool VULKAN_Wait(
VkResult result; VkResult result;
Sint32 i; Sint32 i;
SDL_LockMutex(renderer->submitLock);
result = renderer->vkDeviceWaitIdle(renderer->logicalDevice); result = renderer->vkDeviceWaitIdle(renderer->logicalDevice);
CHECK_VULKAN_ERROR_AND_RETURN(result, vkDeviceWaitIdle, false); if (result != VK_SUCCESS) {
if (renderer->debugMode) {
SDL_LockMutex(renderer->submitLock); SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s %s", "vkDeviceWaitIdle", VkErrorMessages(result));
}
SDL_SetError("%s %s", "vkDeviceWaitIdle", VkErrorMessages(result));
SDL_UnlockMutex(renderer->submitLock);
return false;
}
for (i = renderer->submittedCommandBufferCount - 1; i >= 0; i -= 1) { for (i = renderer->submittedCommandBufferCount - 1; i >= 0; i -= 1) {
commandBuffer = renderer->submittedCommandBuffers[i]; commandBuffer = renderer->submittedCommandBuffers[i];