diff options
| author | Connor McLaughlin <stenzek@gmail.com> | 2021-04-17 16:09:09 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-17 16:09:09 +1000 |
| commit | edeb6bcdb71753f8e0e22019728ce24fd708657f (patch) | |
| tree | c4e84bf4ac805b9564ec04921ae1caf85908cec9 /Source/Core | |
| parent | 14959a1087b05500c5704b59e7d694d941d4a5cf (diff) | |
| parent | b24e3f2f1aad828b16f3b0b190b45fb4be9014a3 (diff) | |
Merge pull request #9635 from stenzek/amd-exclusive-fullscreen
Vulkan: Work around AMD exclusive fullscreen bug (21.3+)
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/VKRenderer.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/VKRenderer.cpp b/Source/Core/VideoBackends/Vulkan/VKRenderer.cpp index 489ee8b8df..23d0c0d21a 100644 --- a/Source/Core/VideoBackends/Vulkan/VKRenderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/VKRenderer.cpp @@ -288,9 +288,24 @@ void Renderer::BindBackbuffer(const ClearColor& clear_color) m_swap_chain->SetNextFullscreenState(m_swap_chain->GetCurrentFullscreenState()); } - VkResult res = g_command_buffer_mgr->CheckLastPresentFail() ? - g_command_buffer_mgr->GetLastPresentResult() : - m_swap_chain->AcquireNextImage(); + const bool present_fail = g_command_buffer_mgr->CheckLastPresentFail(); + VkResult res = present_fail ? g_command_buffer_mgr->GetLastPresentResult() : + m_swap_chain->AcquireNextImage(); + + if (res == VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT && + !m_swap_chain->GetCurrentFullscreenState()) + { + // AMD's binary driver as of 21.3 seems to return exclusive fullscreen lost even when it was + // never requested, so long as the caller requested it to be application controlled. Handle + // this ignoring the lost result and just continuing as normal if we never acquired it. + res = VK_SUCCESS; + if (present_fail) + { + // We still need to acquire an image. + res = m_swap_chain->AcquireNextImage(); + } + } + if (res != VK_SUCCESS) { // Execute cmdbuffer before resizing, as the last frame could still be presenting. @@ -315,9 +330,9 @@ void Renderer::BindBackbuffer(const ClearColor& clear_color) } res = m_swap_chain->AcquireNextImage(); + if (res != VK_SUCCESS) + PanicAlertFmt("Failed to grab image from swap chain: {:#010X}", res); } - if (res != VK_SUCCESS) - PanicAlertFmt("Failed to grab image from swap chain"); // Transition from undefined (or present src, but it can be substituted) to // color attachment ready for writing. These transitions must occur outside |
