1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 11:52:12 +01:00

[vulkan] Remove fence from presenter

We don't use these anywhere.
This commit is contained in:
Philip Rebohle 2021-06-01 03:51:16 +02:00
parent 0af7229b8e
commit 253884a8c7
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 5 additions and 47 deletions

View File

@ -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

View File

@ -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(

View File

@ -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<uint64_t>::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);
}

View File

@ -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
*