mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-05 19:08:12 +00:00
vulkan: Deal with VK_ERROR_OUT_OF_DATE_KHR returns from vkAcquireNextImageKHR.
Fixes #11075.
This commit is contained in:
@@ -9858,24 +9858,7 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
|
||||
}
|
||||
|
||||
// Finally, try to acquire!
|
||||
acquireResult = renderer->vkAcquireNextImageKHR(
|
||||
renderer->logicalDevice,
|
||||
windowData->swapchain,
|
||||
SDL_MAX_UINT64,
|
||||
windowData->imageAvailableSemaphore[windowData->frameCounter],
|
||||
VK_NULL_HANDLE,
|
||||
&swapchainImageIndex);
|
||||
|
||||
// Acquisition is invalid, let's try to recreate
|
||||
if (acquireResult != VK_SUCCESS && acquireResult != VK_SUBOPTIMAL_KHR) {
|
||||
Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain(renderer, windowData);
|
||||
if (!recreateSwapchainResult) {
|
||||
return false;
|
||||
} else if (recreateSwapchainResult == VULKAN_INTERNAL_TRY_AGAIN) {
|
||||
// Edge case, texture is filled in with NULL but not an error
|
||||
return true;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
acquireResult = renderer->vkAcquireNextImageKHR(
|
||||
renderer->logicalDevice,
|
||||
windowData->swapchain,
|
||||
@@ -9884,8 +9867,19 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
|
||||
VK_NULL_HANDLE,
|
||||
&swapchainImageIndex);
|
||||
|
||||
if (acquireResult != VK_SUCCESS && acquireResult != VK_SUBOPTIMAL_KHR) {
|
||||
//if (acquireResult == VK_ERROR_OUT_OF_DATE_KHR) { SDL_Log("VULKAN SWAPCHAIN OUT OF DATE"); }
|
||||
|
||||
if (acquireResult == VK_SUCCESS || acquireResult == VK_SUBOPTIMAL_KHR) {
|
||||
break; // we got the next image!
|
||||
}
|
||||
|
||||
// If acquisition is invalid, let's try to recreate
|
||||
Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain(renderer, windowData);
|
||||
if (!recreateSwapchainResult) {
|
||||
return false;
|
||||
} else if (recreateSwapchainResult == VULKAN_INTERNAL_TRY_AGAIN) {
|
||||
// Edge case, texture is filled in with NULL but not an error
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user