mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
vulkan: Deal with VK_ERROR_OUT_OF_DATE_KHR returns from vkAcquireNextImageKHR.
Fixes #11075.
This commit is contained in:
@@ -9858,6 +9858,7 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finally, try to acquire!
|
// Finally, try to acquire!
|
||||||
|
while (true) {
|
||||||
acquireResult = renderer->vkAcquireNextImageKHR(
|
acquireResult = renderer->vkAcquireNextImageKHR(
|
||||||
renderer->logicalDevice,
|
renderer->logicalDevice,
|
||||||
windowData->swapchain,
|
windowData->swapchain,
|
||||||
@@ -9866,8 +9867,13 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
|
|||||||
VK_NULL_HANDLE,
|
VK_NULL_HANDLE,
|
||||||
&swapchainImageIndex);
|
&swapchainImageIndex);
|
||||||
|
|
||||||
// Acquisition is invalid, let's try to recreate
|
//if (acquireResult == VK_ERROR_OUT_OF_DATE_KHR) { SDL_Log("VULKAN SWAPCHAIN OUT OF DATE"); }
|
||||||
if (acquireResult != VK_SUCCESS && acquireResult != VK_SUBOPTIMAL_KHR) {
|
|
||||||
|
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);
|
Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain(renderer, windowData);
|
||||||
if (!recreateSwapchainResult) {
|
if (!recreateSwapchainResult) {
|
||||||
return false;
|
return false;
|
||||||
@@ -9875,18 +9881,6 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
|
|||||||
// Edge case, texture is filled in with NULL but not an error
|
// Edge case, texture is filled in with NULL but not an error
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
acquireResult = renderer->vkAcquireNextImageKHR(
|
|
||||||
renderer->logicalDevice,
|
|
||||||
windowData->swapchain,
|
|
||||||
SDL_MAX_UINT64,
|
|
||||||
windowData->imageAvailableSemaphore[windowData->frameCounter],
|
|
||||||
VK_NULL_HANDLE,
|
|
||||||
&swapchainImageIndex);
|
|
||||||
|
|
||||||
if (acquireResult != VK_SUCCESS && acquireResult != VK_SUBOPTIMAL_KHR) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
swapchainTextureContainer = &windowData->textureContainers[swapchainImageIndex];
|
swapchainTextureContainer = &windowData->textureContainers[swapchainImageIndex];
|
||||||
|
Reference in New Issue
Block a user