Skip to content

Commit e699f3d

Browse files
Beyleyslouken
authored andcommitted
GPU: Hold submit lock before waiting for device idle
1 parent f2df279 commit e699f3d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/gpu/vulkan/SDL_gpu_vulkan.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10495,11 +10495,18 @@ static bool VULKAN_Wait(
1049510495
VkResult result;
1049610496
Sint32 i;
1049710497

10498-
result = renderer->vkDeviceWaitIdle(renderer->logicalDevice);
10498+
SDL_LockMutex(renderer->submitLock);
1049910499

10500-
CHECK_VULKAN_ERROR_AND_RETURN(result, vkDeviceWaitIdle, false);
10500+
result = renderer->vkDeviceWaitIdle(renderer->logicalDevice);
1050110501

10502-
SDL_LockMutex(renderer->submitLock);
10502+
if (result != VK_SUCCESS) {
10503+
if (renderer->debugMode) {
10504+
SDL_LogError(SDL_LOG_CATEGORY_GPU, "%s %s", "vkDeviceWaitIdle", VkErrorMessages(result));
10505+
}
10506+
SDL_SetError("%s %s", "vkDeviceWaitIdle", VkErrorMessages(result));
10507+
SDL_UnlockMutex(renderer->submitLock);
10508+
return false;
10509+
}
1050310510

1050410511
for (i = renderer->submittedCommandBufferCount - 1; i >= 0; i -= 1) {
1050510512
commandBuffer = renderer->submittedCommandBuffers[i];

0 commit comments

Comments
 (0)