VulkanHostDisplay: Handle surface loss better

Just try again next frame.
This commit is contained in:
Connor McLaughlin 2022-04-06 22:26:57 +10:00 committed by refractionpcsx2
parent 1b080f1777
commit 9180adb850
2 changed files with 7 additions and 3 deletions

View File

@ -825,6 +825,7 @@ namespace Vulkan
DestroySwapChainImages();
DestroySwapChain();
DestroySurface();
DestroySemaphores();
// Re-create the surface with the new native handle
m_window_info = new_wi;
@ -849,7 +850,7 @@ namespace Vulkan
}
// Finally re-create the swap chain
if (!CreateSwapChain() || !SetupSwapChainImages())
if (!CreateSwapChain() || !SetupSwapChainImages() || !CreateSemaphores())
return false;
return true;

View File

@ -112,7 +112,11 @@ void VulkanHostDisplay::ResizeRenderWindow(s32 new_window_width, s32 new_window_
g_vulkan_context->WaitForGPUIdle();
if (!m_swap_chain->ResizeSwapChain(new_window_width, new_window_height))
pxFailRel("Failed to resize swap chain");
{
// AcquireNextImage() will fail, and we'll recreate the surface.
Console.Error("Failed to resize swap chain. Next present will fail.");
return;
}
m_window_info = m_swap_chain->GetWindowInfo();
}
@ -341,7 +345,6 @@ bool VulkanHostDisplay::BeginPresent(bool frame_skip)
{
Console.Error("Failed to recreate surface after loss");
g_vulkan_context->ExecuteCommandBuffer(false);
m_swap_chain.reset();
return false;
}