From 253884a8c73e8c0460f7861e22ab3acd0ad05f55 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 1 Jun 2021 03:51:16 +0200 Subject: [PATCH] [vulkan] Remove fence from presenter We don't use these anywhere. --- src/d3d11/d3d11_swapchain.cpp | 6 ++---- src/d3d9/d3d9_swapchain.cpp | 6 ++---- src/vulkan/vulkan_presenter.cpp | 26 +------------------------- src/vulkan/vulkan_presenter.h | 14 -------------- 4 files changed, 5 insertions(+), 47 deletions(-) diff --git a/src/d3d11/d3d11_swapchain.cpp b/src/d3d11/d3d11_swapchain.cpp index a04b50377..3539ccb9b 100644 --- a/src/d3d11/d3d11_swapchain.cpp +++ b/src/d3d11/d3d11_swapchain.cpp @@ -258,8 +258,7 @@ namespace dxvk { uint32_t imageIndex = 0; - VkResult status = m_presenter->acquireNextImage( - sync.acquire, VK_NULL_HANDLE, imageIndex); + VkResult status = m_presenter->acquireNextImage(sync.acquire, imageIndex); while (status != VK_SUCCESS && status != VK_SUBOPTIMAL_KHR) { RecreateSwapChain(m_vsync); @@ -270,8 +269,7 @@ namespace dxvk { info = m_presenter->info(); sync = m_presenter->getSyncSemaphores(); - status = m_presenter->acquireNextImage( - sync.acquire, VK_NULL_HANDLE, imageIndex); + status = m_presenter->acquireNextImage(sync.acquire, imageIndex); } // Resolve back buffer if it is multisampled. We diff --git a/src/d3d9/d3d9_swapchain.cpp b/src/d3d9/d3d9_swapchain.cpp index ea9d5d19d..a405c6e4f 100644 --- a/src/d3d9/d3d9_swapchain.cpp +++ b/src/d3d9/d3d9_swapchain.cpp @@ -791,8 +791,7 @@ namespace dxvk { uint32_t imageIndex = 0; - VkResult status = m_presenter->acquireNextImage( - sync.acquire, VK_NULL_HANDLE, imageIndex); + VkResult status = m_presenter->acquireNextImage(sync.acquire, imageIndex); while (status != VK_SUCCESS && status != VK_SUBOPTIMAL_KHR) { RecreateSwapChain(m_vsync); @@ -800,8 +799,7 @@ namespace dxvk { info = m_presenter->info(); sync = m_presenter->getSyncSemaphores(); - status = m_presenter->acquireNextImage( - sync.acquire, VK_NULL_HANDLE, imageIndex); + status = m_presenter->acquireNextImage(sync.acquire, imageIndex); } m_context->beginRecording( diff --git a/src/vulkan/vulkan_presenter.cpp b/src/vulkan/vulkan_presenter.cpp index a0d7371aa..ed1463790 100644 --- a/src/vulkan/vulkan_presenter.cpp +++ b/src/vulkan/vulkan_presenter.cpp @@ -50,18 +50,13 @@ namespace dxvk::vk { VkResult Presenter::acquireNextImage( VkSemaphore signal, - VkFence fence, uint32_t& index) { 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, fence, &m_imageIndex); + signal, VK_NULL_HANDLE, &m_imageIndex); if (status != VK_SUCCESS && status != VK_SUBOPTIMAL_KHR) @@ -75,15 +70,6 @@ namespace dxvk::vk { } - VkResult Presenter::waitForFence(VkFence fence) { - // Ignore timeouts, we don't want to block the - // app indefinitely if something goes wrong - return m_vkd->vkWaitForFences( - m_vkd->device(), 1, &fence, VK_FALSE, - 1'000'000'000ull); - } - - VkResult Presenter::presentImage(VkSemaphore wait) { VkPresentInfoKHR info; info.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; @@ -222,15 +208,6 @@ namespace dxvk::vk { m_semaphores.resize(m_info.imageCount); for (uint32_t i = 0; i < m_semaphores.size(); i++) { - VkFenceCreateInfo fenceInfo; - fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; - fenceInfo.pNext = nullptr; - fenceInfo.flags = 0; - - if ((status = m_vkd->vkCreateFence(m_vkd->device(), - &fenceInfo, nullptr, &m_semaphores[i].fence)) != VK_SUCCESS) - return status; - VkSemaphoreCreateInfo semInfo; semInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; semInfo.pNext = nullptr; @@ -480,7 +457,6 @@ namespace dxvk::vk { m_vkd->vkDestroyImageView(m_vkd->device(), img.view, nullptr); for (const auto& sem : m_semaphores) { - m_vkd->vkDestroyFence(m_vkd->device(), sem.fence, nullptr); m_vkd->vkDestroySemaphore(m_vkd->device(), sem.acquire, nullptr); m_vkd->vkDestroySemaphore(m_vkd->device(), sem.present, nullptr); } diff --git a/src/vulkan/vulkan_presenter.h b/src/vulkan/vulkan_presenter.h index 09695c961..fcaa1d3cc 100644 --- a/src/vulkan/vulkan_presenter.h +++ b/src/vulkan/vulkan_presenter.h @@ -76,7 +76,6 @@ namespace dxvk::vk { * image acquisition. */ struct PresenterSync { - VkFence fence; VkSemaphore acquire; VkSemaphore present; }; @@ -134,26 +133,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); - /** - * \brief Waits for fence to get signaled - * - * Helper method that can be used in conjunction - * with the fence passed to \ref acquireNextImage. - * \param [in] fence Fence to wait on - * \returns Status of the operation - */ - VkResult waitForFence( - VkFence fence); - /** * \brief Presents current image *