diff --git a/src/d3d11/d3d11_swapchain.cpp b/src/d3d11/d3d11_swapchain.cpp index d80f7deca..e32c31332 100644 --- a/src/d3d11/d3d11_swapchain.cpp +++ b/src/d3d11/d3d11_swapchain.cpp @@ -227,7 +227,7 @@ namespace dxvk { uint32_t imageIndex = 0; VkResult status = m_presenter->acquireNextImage( - sync.acquire, imageIndex); + sync.acquire, VK_NULL_HANDLE, imageIndex); while (status != VK_SUCCESS && status != VK_SUBOPTIMAL_KHR) { RecreateSwapChain(m_vsync); @@ -236,7 +236,7 @@ namespace dxvk { sync = m_presenter->getSyncSemaphores(); status = m_presenter->acquireNextImage( - sync.acquire, imageIndex); + sync.acquire, VK_NULL_HANDLE, imageIndex); } // Use an appropriate texture filter depending on whether diff --git a/src/vulkan/vulkan_presenter.cpp b/src/vulkan/vulkan_presenter.cpp index e5b37f8b1..f4cfa5222 100644 --- a/src/vulkan/vulkan_presenter.cpp +++ b/src/vulkan/vulkan_presenter.cpp @@ -42,11 +42,18 @@ namespace dxvk::vk { VkResult Presenter::acquireNextImage( VkSemaphore signal, + VkFence fence, uint32_t& index) { - VkResult status = m_vkd->vkAcquireNextImageKHR( + VkResult status; + + if (fence && ((status = m_vkd->vkResetFences( + m_vkd->device(), 1, &fence)) != VK_SUCCESS)) + return status; + + status = m_vkd->vkAcquireNextImageKHR( m_vkd->device(), m_swapchain, std::numeric_limits::max(), - signal, VK_NULL_HANDLE, &m_imageIndex); + signal, fence, &m_imageIndex); if (status != VK_SUCCESS && status != VK_SUBOPTIMAL_KHR) diff --git a/src/vulkan/vulkan_presenter.h b/src/vulkan/vulkan_presenter.h index 19a706591..07138079b 100644 --- a/src/vulkan/vulkan_presenter.h +++ b/src/vulkan/vulkan_presenter.h @@ -123,11 +123,13 @@ namespace dxvk::vk { * must be recreated and a new image must * be acquired before proceeding. * \param [in] signal Semaphore to signal + * \param [in] fence Fence to signal (optional) * \param [out] index Acquired image index * \returns Status of the operation */ VkResult acquireNextImage( VkSemaphore signal, + VkFence fence, uint32_t& index); /**