Skip to content

Commit

Permalink
Only try once to recreate surfaces on surface loss.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdavis5e authored and doitsujin committed Apr 2, 2019
1 parent 540900b commit 910e1a1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/vulkan/vulkan_presenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,14 @@ namespace dxvk::vk {

if ((status = m_vki->vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
m_device.adapter, m_surface, &caps)) != VK_SUCCESS) {
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 (status == VK_ERROR_SURFACE_LOST_KHR) {
// Recreate the surface and try again.
if (m_surface)
destroySurface();
if ((status = createSurface()) != VK_SUCCESS)
continue;
if ((status = m_vki->vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
m_device.adapter, m_surface, &caps)) != VK_SUCCESS)
continue;
return status;
status = m_vki->vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
m_device.adapter, m_surface, &caps);
}
if (status != VK_SUCCESS)
return status;
Expand Down

0 comments on commit 910e1a1

Please sign in to comment.