[dxvk] Soften error reporting from the presenter

This commit is contained in:
Philip Rebohle 2025-01-16 10:27:36 +01:00
parent bc8b091036
commit 28f4295765
2 changed files with 19 additions and 2 deletions

View file

@ -86,7 +86,7 @@ namespace dxvk {
VkResult vr = recreateSwapChain(); VkResult vr = recreateSwapChain();
if (vr != VK_SUCCESS) if (vr != VK_SUCCESS)
return vr; return softError(vr);
PresenterSync sync = m_semaphores.at(m_frameIndex); PresenterSync sync = m_semaphores.at(m_frameIndex);
@ -95,7 +95,7 @@ namespace dxvk {
sync.acquire, VK_NULL_HANDLE, &m_imageIndex); sync.acquire, VK_NULL_HANDLE, &m_imageIndex);
if (m_acquireStatus < 0) if (m_acquireStatus < 0)
return m_acquireStatus; return softError(m_acquireStatus);
} }
// Update HDR metadata after a successful acquire. We know // Update HDR metadata after a successful acquire. We know
@ -951,4 +951,18 @@ namespace dxvk {
} }
} }
VkResult Presenter::softError(
VkResult vr) {
// Don't return these as an error state to the caller. The app can't
// do much anyway, so just pretend that we don't have a valid swap
// chain and move on. An alternative would be to handle errors in a
// loop, however this may also not be desireable since it could stall
// the app indefinitely in case the surface is in a weird state.
if (vr == VK_ERROR_SURFACE_LOST_KHR || vr == VK_ERROR_OUT_OF_DATE_KHR)
return VK_NOT_READY;
return vr;
}
} }

View file

@ -304,6 +304,9 @@ namespace dxvk {
void runFrameThread(); void runFrameThread();
static VkResult softError(
VkResult vr);
}; };
} }