summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-03-31 23:20:15 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-03-31 23:20:15 +0000
commitc6a08259e93f63fbbac8517f8ecf7dc5536e29e3 (patch)
tree5d03fbdcb27100366cd70ae5525bb20479b81c34 /Graphics/GraphicsEngineD3D11
parentFixed build error on iOS (diff)
downloadDiligentCore-c6a08259e93f63fbbac8517f8ecf7dc5536e29e3.tar.gz
DiligentCore-c6a08259e93f63fbbac8517f8ecf7dc5536e29e3.zip
Some minor updates to d3d swap chain
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rw-r--r--Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp
index 7b0f99b5..ca5faf08 100644
--- a/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/SwapChainD3D11Impl.cpp
@@ -157,6 +157,15 @@ void SwapChainD3D11Impl::UpdateSwapChain(bool CreateNew)
if(CreateNew)
{
m_pSwapChain.Release();
+
+ // Only one flip presentation model swap chain can be associated with an HWND.
+ // We must make sure that the swap chain is actually released by D3D11 before creating a new one.
+ // To force the destruction, we need to ensure no views are bound to pipeline state, and then call Flush
+ // on the immediate context. Dstruction must be forced before calling IDXGIFactory2::CreateSwapChainForHwnd(), or
+ // IDXGIFactory2::CreateSwapChainForCoreWindow() again to create a new swap chain.
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/ff476425(v=vs.85).aspx#Defer_Issues_with_Flip
+ pImmediateCtxD3D11->Flush();
+
auto *pd3d11Device = ValidatedCast<RenderDeviceD3D11Impl>(m_pRenderDevice.RawPtr())->GetD3D11Device();
CreateDXGISwapChain(pd3d11Device);
}