From 64888e8097027b9becb6ab4def09b510d291cf64 Mon Sep 17 00:00:00 2001 From: assiduous Date: Tue, 19 May 2020 23:13:41 -0700 Subject: Improved latency handling in D3D11 and D3D12 (API 240061, fixed https://github.com/DiligentGraphics/DiligentEngine/issues/81) --- Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp index 301f8a1b..bcffe7d5 100644 --- a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp @@ -148,6 +148,11 @@ void SwapChainD3D12Impl::Present(Uint32 SyncInterval) pImmediateCtxD3D12->Flush(); + // In contrast to MSDN sample, we wait for the frame as late as possible - right + // before presenting. + // https://docs.microsoft.com/en-us/windows/uwp/gaming/reduce-latency-with-dxgi-1-3-swap-chains#step-4-wait-before-rendering-each-frame + WaitForFrame(); + auto hr = m_pSwapChain->Present(SyncInterval, 0); VERIFY(SUCCEEDED(hr), "Present failed"); -- cgit v1.2.3