mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Vulkan: Fix deadlock in some resize scenarios
Only have experienced this on a few occasions when using the anv driver.
This commit is contained in:
parent
2ef884893a
commit
1cfb0a1185
@ -661,8 +661,15 @@ void Renderer::DrawScreen(const EFBRectangle& source_rect, u32 xfb_addr,
|
||||
VkResult res = m_swap_chain->AcquireNextImage(m_image_available_semaphore);
|
||||
if (res == VK_SUBOPTIMAL_KHR || res == VK_ERROR_OUT_OF_DATE_KHR)
|
||||
{
|
||||
// Window has been resized. Update the swap chain and try again.
|
||||
// There's an issue here. We can't resize the swap chain while the GPU is still busy with it,
|
||||
// but calling WaitForGPUIdle would create a deadlock as PrepareToSubmitCommandBuffer has been
|
||||
// called by SwapImpl. WaitForGPUIdle waits on the semaphore, which PrepareToSubmitCommandBuffer
|
||||
// has already done, so it blocks indefinitely. To work around this, we submit the current
|
||||
// command buffer, resize the swap chain (which calls WaitForGPUIdle), and then finally call
|
||||
// PrepareToSubmitCommandBuffer to return to the state that the caller expects.
|
||||
g_command_buffer_mgr->SubmitCommandBuffer(false);
|
||||
ResizeSwapChain();
|
||||
g_command_buffer_mgr->PrepareToSubmitCommandBuffer();
|
||||
res = m_swap_chain->AcquireNextImage(m_image_available_semaphore);
|
||||
}
|
||||
if (res != VK_SUCCESS)
|
||||
|
Loading…
Reference in New Issue
Block a user