From 785649f3b861d72d876e70885f203ecb3f412293 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 15 Jan 2025 17:26:58 +0100 Subject: [PATCH] [d3d11] Remove explicit swapchain synchronization --- src/d3d11/d3d11_swapchain.cpp | 26 +++----------------------- src/d3d11/d3d11_swapchain.h | 3 --- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/src/d3d11/d3d11_swapchain.cpp b/src/d3d11/d3d11_swapchain.cpp index ba8550f78..4566b1e8f 100644 --- a/src/d3d11/d3d11_swapchain.cpp +++ b/src/d3d11/d3d11_swapchain.cpp @@ -77,8 +77,7 @@ namespace dxvk { if (this_thread::isInModuleDetachment()) return; - m_device->waitForSubmission(&m_presentStatus); - m_device->waitForIdle(); + m_presenter->destroyResources(); DestroyFrameLatencyEvent(); } @@ -259,15 +258,7 @@ namespace dxvk { if (hr != S_OK) return hr; - // If the current present status is NOT_READY, we have a present - // in flight, which means that we can most likely present again. - // This avoids an expensive sync point. - VkResult status = m_presentStatus.result.load(); - - if (status == VK_NOT_READY) - return S_OK; - - status = m_presenter->checkSwapChainStatus(); + VkResult status = m_presenter->checkSwapChainStatus(); return status == VK_SUCCESS ? S_OK : DXGI_STATUS_OCCLUDED; } @@ -376,8 +367,6 @@ namespace dxvk { immediateContext->EndFrame(); immediateContext->Flush(); - SynchronizePresent(); - m_presenter->setSyncInterval(SyncInterval); // Presentation semaphores and WSI swap chain image @@ -396,8 +385,6 @@ namespace dxvk { // Present from CS thread so that we don't // have to synchronize with it first. - m_presentStatus.result = VK_NOT_READY; - DxvkImageViewKey viewInfo = { }; viewInfo.viewType = VK_IMAGE_VIEW_TYPE_2D; viewInfo.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; @@ -409,7 +396,6 @@ namespace dxvk { viewInfo.layerCount = 1u; immediateContext->EmitCs([ - cPresentStatus = &m_presentStatus, cDevice = m_device, cBlitter = m_blitter, cBackBuffer = backBuffer->createView(viewInfo), @@ -439,8 +425,7 @@ namespace dxvk { ctx->synchronizeWsi(cSync); ctx->flushCommandList(nullptr); - cDevice->presentImage(cPresenter, - cFrameId, cPresentStatus); + cDevice->presentImage(cPresenter, cFrameId, nullptr); }); if (m_backBuffers.size() > 1u) @@ -470,11 +455,6 @@ namespace dxvk { } - void D3D11SwapChain::SynchronizePresent() { - m_device->waitForSubmission(&m_presentStatus); - } - - void D3D11SwapChain::CreateFrameLatencyEvent() { m_frameLatencySignal = new sync::CallbackFence(m_frameId); diff --git a/src/d3d11/d3d11_swapchain.h b/src/d3d11/d3d11_swapchain.h index ccd84a382..0de695270 100644 --- a/src/d3d11/d3d11_swapchain.h +++ b/src/d3d11/d3d11_swapchain.h @@ -109,7 +109,6 @@ namespace dxvk { Rc m_blitter; small_vector, 4> m_backBuffers; - DxvkSubmitStatus m_presentStatus; uint64_t m_frameId = DXGI_MAX_SWAP_CHAIN_BUFFERS; uint32_t m_frameLatency = DefaultFrameLatency; @@ -130,8 +129,6 @@ namespace dxvk { void RotateBackBuffers(D3D11ImmediateContext* ctx); - void SynchronizePresent(); - void CreateFrameLatencyEvent(); void CreatePresenter();