1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[vulkan] Don't loop endlessly on a lost surface.

If the surface is lost in a way that can't be recovered by recreating
the surface from the window, the previous change would wind up looping
forever. Just retry 5 times before giving up.
This commit is contained in:
Chip Davis 2019-04-01 13:25:29 -05:00 committed by Philip Rebohle
parent e633dbc06f
commit 540900b792

View File

@ -106,8 +106,8 @@ namespace dxvk::vk {
if ((status = m_vki->vkGetPhysicalDeviceSurfaceCapabilitiesKHR( if ((status = m_vki->vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
m_device.adapter, m_surface, &caps)) != VK_SUCCESS) { m_device.adapter, m_surface, &caps)) != VK_SUCCESS) {
while (status == VK_ERROR_SURFACE_LOST_KHR) { for (uint32_t i = 0; i < 5 && status == VK_ERROR_SURFACE_LOST_KHR; i++) {
// Recreate the surface and try again. // Recreate the surface and try again. Give up after 5 tries.
if (m_surface) if (m_surface)
destroySurface(); destroySurface();
if ((status = createSurface()) != VK_SUCCESS) if ((status = createSurface()) != VK_SUCCESS)