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/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp index 305a0b93..f75cdfb6 100644 --- a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp @@ -123,6 +123,10 @@ void SwapChainD3D11Impl::Present(Uint32 SyncInterval) auto* pImmediateCtxD3D11 = pDeviceContext.RawPtr(); + // A successful Present call for DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL SwapChains unbinds + // backbuffer 0 from all GPU writeable bind points. + pImmediateCtxD3D11->UnbindTextureFromFramebuffer(ValidatedCast(m_pRenderTargetView->GetTexture()), false); + if (m_SwapChainDesc.IsPrimary) { // Clear the state caches to release all outstanding objects @@ -135,15 +139,6 @@ void SwapChainD3D11Impl::Present(Uint32 SyncInterval) } m_pSwapChain->Present(SyncInterval, 0); - - if (m_SwapChainDesc.IsPrimary) - { - // 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 - pImmediateCtxD3D11->CommitRenderTargets(); - } } void SwapChainD3D11Impl::UpdateSwapChain(bool CreateNew) -- cgit v1.2.3