mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-07 01:25:33 +02:00
GPU Vulkan: handle VK_ERROR_SURFACE_LOST_KHR in acquire path
On Android, backgrounding and foregrounding an app causes the Vulkan surface to be destroyed. vkAcquireNextImageKHR returns VK_ERROR_SURFACE_LOST_KHR, but the acquire while(true) loop only calls RecreateSwapchain which doesn't recreate the surface, resulting in an infinite retry loop and a black screen. Handle VK_ERROR_SURFACE_LOST_KHR by setting both needsSurfaceRecreate and needsSwapchainRecreate, then returning to let the existing recreation path handle it on the next call. Fixes #15322
This commit is contained in:
committed by
Sam Lantinga
parent
682da4ee98
commit
c98b36ff03
@@ -10214,6 +10214,13 @@ static bool VULKAN_INTERNAL_AcquireSwapchainTexture(
|
||||
break; // we got the next image!
|
||||
}
|
||||
|
||||
// Surface lost — flag for surface + swapchain recreation on next call
|
||||
if (acquireResult == VK_ERROR_SURFACE_LOST_KHR) {
|
||||
windowData->needsSurfaceRecreate = true;
|
||||
windowData->needsSwapchainRecreate = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// If acquisition is invalid, let's try to recreate
|
||||
Uint32 recreateSwapchainResult = VULKAN_INTERNAL_RecreateSwapchain(renderer, windowData);
|
||||
if (!recreateSwapchainResult) {
|
||||
|
||||
Reference in New Issue
Block a user