From 540900b79299669ca41ee70fe10c5736ab73c63e Mon Sep 17 00:00:00 2001 From: Chip Davis Date: Mon, 1 Apr 2019 13:25:29 -0500 Subject: [PATCH] [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. --- src/vulkan/vulkan_presenter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vulkan/vulkan_presenter.cpp b/src/vulkan/vulkan_presenter.cpp index 94546a83a..c760bb1b2 100644 --- a/src/vulkan/vulkan_presenter.cpp +++ b/src/vulkan/vulkan_presenter.cpp @@ -106,8 +106,8 @@ namespace dxvk::vk { if ((status = m_vki->vkGetPhysicalDeviceSurfaceCapabilitiesKHR( m_device.adapter, m_surface, &caps)) != VK_SUCCESS) { - while (status == VK_ERROR_SURFACE_LOST_KHR) { - // Recreate the surface and try again. + for (uint32_t i = 0; i < 5 && status == VK_ERROR_SURFACE_LOST_KHR; i++) { + // Recreate the surface and try again. Give up after 5 tries. if (m_surface) destroySurface(); if ((status = createSurface()) != VK_SUCCESS)