From 10eb53eedada9b6a313115a1869a5e4d2dbf40ba Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 7 Mar 2025 17:29:44 +0100 Subject: [PATCH] [d3d9] Remove double presents with SyncInterval > 1 --- src/d3d9/d3d9_swapchain.cpp | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/d3d9/d3d9_swapchain.cpp b/src/d3d9/d3d9_swapchain.cpp index 8f97079be..e22665400 100644 --- a/src/d3d9/d3d9_swapchain.cpp +++ b/src/d3d9/d3d9_swapchain.cpp @@ -826,18 +826,13 @@ namespace dxvk { Rc swapImage = m_backBuffers[0]->GetCommonTexture()->GetImage(); Rc swapImageView = m_backBuffers[0]->GetImageView(false); - for (uint32_t i = 0; i < SyncInterval || i < 1; i++) { - // Presentation semaphores and WSI swap chain image - PresenterSync sync = { }; - Rc backBuffer; + // Presentation semaphores and WSI swap chain image + PresenterSync sync = { }; + Rc backBuffer; - status = m_wctx->presenter->acquireNextImage(sync, backBuffer); - - if (status < 0 || status == VK_NOT_READY) { - status = i ? VK_SUCCESS : status; - break; - } + status = m_wctx->presenter->acquireNextImage(sync, backBuffer); + if (status >= 0 && status != VK_NOT_READY) { VkRect2D srcRect = { { int32_t(m_srcRect.left), int32_t(m_srcRect.top) }, { uint32_t(m_srcRect.right - m_srcRect.left), uint32_t(m_srcRect.bottom - m_srcRect.top) } }; @@ -847,8 +842,7 @@ namespace dxvk { { uint32_t(m_dstRect.right - m_dstRect.left), uint32_t(m_dstRect.bottom - m_dstRect.top) } }; // Bump frame ID - if (!i) - m_wctx->frameId += 1; + m_wctx->frameId += 1; // Present from CS thread so that we don't // have to synchronize with it first. @@ -871,7 +865,6 @@ namespace dxvk { cSrcRect = srcRect, cDstView = backBuffer->createView(viewInfo), cDstRect = dstRect, - cRepeat = i, cSync = sync, cFrameId = m_wctx->frameId, cLatency = m_latencyTracker @@ -894,9 +887,7 @@ namespace dxvk { ctx->synchronizeWsi(cSync); ctx->flushCommandList(nullptr, nullptr); - uint64_t frameId = cRepeat ? 0 : cFrameId; - - cDevice->presentImage(cPresenter, cLatency, frameId, nullptr); + cDevice->presentImage(cPresenter, cLatency, cFrameId, nullptr); }); m_parent->FlushCsChunk();