Skip to content

Commit

Permalink
VulkanDevice: Work around older NVIDIA driver present bug
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Nov 15, 2024
1 parent 3cf7a94 commit 41a8912
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/util/vulkan_swap_chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,17 @@ bool VulkanSwapChain::HandleAcquireOrPresentError(VkResult& res, bool is_present
{
VulkanDevice& dev = VulkanDevice::GetInstance();
if (is_present_error)
{
// Older NVIDIA drivers completely lock up if there is no device idle wait prior to waiting of the command
// buffer's fences. I'm guessing it's something due to the failed present, but regardless, it shouldn't hurt
// anything doing this here. But don't remove it for this reason.
vkDeviceWaitIdle(dev.GetVulkanDevice());
dev.WaitForAllFences();
}
else
{
dev.SubmitCommandBuffer(true);
}

Error error;
if (!RecreateSwapChain(dev, &error))
Expand All @@ -690,9 +698,15 @@ bool VulkanSwapChain::HandleAcquireOrPresentError(VkResult& res, bool is_present
{
VulkanDevice& dev = VulkanDevice::GetInstance();
if (is_present_error)
{
// See above.
vkDeviceWaitIdle(dev.GetVulkanDevice());
dev.WaitForAllFences();
}
else
{
dev.SubmitCommandBuffer(true);
}

Error error;
if (!RecreateSurface(dev, &error))
Expand Down

0 comments on commit 41a8912

Please sign in to comment.