@@ -9858,24 +9858,7 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
9858
9858
}
9859
9859
9860
9860
// Finally, try to acquire!
9861
- acquireResult = renderer -> vkAcquireNextImageKHR (
9862
- renderer -> logicalDevice ,
9863
- windowData -> swapchain ,
9864
- SDL_MAX_UINT64 ,
9865
- windowData -> imageAvailableSemaphore [windowData -> frameCounter ],
9866
- VK_NULL_HANDLE ,
9867
- & swapchainImageIndex );
9868
-
9869
- // Acquisition is invalid, let's try to recreate
9870
- if (acquireResult != VK_SUCCESS && acquireResult != VK_SUBOPTIMAL_KHR ) {
9871
- Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain (renderer , windowData );
9872
- if (!recreateSwapchainResult ) {
9873
- return false;
9874
- } else if (recreateSwapchainResult == VULKAN_INTERNAL_TRY_AGAIN ) {
9875
- // Edge case, texture is filled in with NULL but not an error
9876
- return true;
9877
- }
9878
-
9861
+ while (true) {
9879
9862
acquireResult = renderer -> vkAcquireNextImageKHR (
9880
9863
renderer -> logicalDevice ,
9881
9864
windowData -> swapchain ,
@@ -9884,8 +9867,19 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
9884
9867
VK_NULL_HANDLE ,
9885
9868
& swapchainImageIndex );
9886
9869
9887
- if (acquireResult != VK_SUCCESS && acquireResult != VK_SUBOPTIMAL_KHR ) {
9870
+ //if (acquireResult == VK_ERROR_OUT_OF_DATE_KHR) { SDL_Log("VULKAN SWAPCHAIN OUT OF DATE"); }
9871
+
9872
+ if (acquireResult == VK_SUCCESS || acquireResult == VK_SUBOPTIMAL_KHR ) {
9873
+ break ; // we got the next image!
9874
+ }
9875
+
9876
+ // If acquisition is invalid, let's try to recreate
9877
+ Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain (renderer , windowData );
9878
+ if (!recreateSwapchainResult ) {
9888
9879
return false;
9880
+ } else if (recreateSwapchainResult == VULKAN_INTERNAL_TRY_AGAIN ) {
9881
+ // Edge case, texture is filled in with NULL but not an error
9882
+ return true;
9889
9883
}
9890
9884
}
9891
9885
0 commit comments