mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-08 09:57:16 +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
(cherry picked from commit c98b36ff03)
This commit is contained in:
committed by
Sam Lantinga
parent
d07bd49a7d
commit
3939fb03bf
@@ -10165,6 +10165,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