From 71595b9099ad70b474502ca3b16c2da7050cb6a8 Mon Sep 17 00:00:00 2001 From: assiduous Date: Tue, 24 Dec 2019 10:39:56 -0800 Subject: Updated swap chain Present() to unbind back buffers from immediate context --- Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp index 74cedd1c..af8e035b 100644 --- a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp @@ -135,6 +135,11 @@ void SwapChainD3D12Impl::Present(Uint32 SyncInterval) auto& CmdCtx = pImmediateCtxD3D12->GetCmdContext(); auto* pBackBuffer = ValidatedCast(GetCurrentBackBufferRTV()->GetTexture()); + + // A successful Present call for DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL SwapChains unbinds + // backbuffer 0 from all GPU writeable bind points. + pImmediateCtxD3D12->UnbindTextureFromFramebuffer(pBackBuffer, false); + CmdCtx.TransitionResource(pBackBuffer, RESOURCE_STATE_PRESENT); pImmediateCtxD3D12->Flush(); @@ -149,15 +154,8 @@ void SwapChainD3D12Impl::Present(Uint32 SyncInterval) pDeviceD3D12->ReleaseStaleResources(); } -#if 0 -# if PLATFORM_UNIVERSAL_WINDOWS - // A successful Present call for DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL SwapChains unbinds + // A successful Present call for DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL SwapChains unbinds // backbuffer 0 from all GPU writeable bind points. - // We need to rebind all render targets to make sure that - // the back buffer is not unbound - pImmediateCtxD3D12->CommitRenderTargets(); -# endif -#endif } void SwapChainD3D12Impl::UpdateSwapChain(bool CreateNew) -- cgit v1.2.3