From 446d3555fa5928b14e948d6957a579fdceb37633 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Mon, 12 Aug 2019 21:19:08 -0700 Subject: D3D11 backend: enabled multiple swap chain support --- Graphics/GraphicsEngine/include/DeviceContextBase.h | 2 +- Graphics/GraphicsEngine/include/SwapChainBase.h | 2 +- Graphics/GraphicsEngine/interface/GraphicsTypes.h | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.h b/Graphics/GraphicsEngine/include/DeviceContextBase.h index 74226452..5e5b2e4f 100644 --- a/Graphics/GraphicsEngine/include/DeviceContextBase.h +++ b/Graphics/GraphicsEngine/include/DeviceContextBase.h @@ -161,7 +161,7 @@ public: virtual void SetSwapChain( ISwapChain* pSwapChain )override final { m_pSwapChain = pSwapChain; } /// Returns the swap chain - ISwapChain *GetSwapChain() { return m_pSwapChain; } + ISwapChain* GetSwapChain() { return m_pSwapChain; } /// Returns true if currently bound frame buffer is the default frame buffer inline bool IsDefaultFBBound(){ return m_IsDefaultFramebufferBound; } diff --git a/Graphics/GraphicsEngine/include/SwapChainBase.h b/Graphics/GraphicsEngine/include/SwapChainBase.h index 4f15147f..8b9aa86f 100644 --- a/Graphics/GraphicsEngine/include/SwapChainBase.h +++ b/Graphics/GraphicsEngine/include/SwapChainBase.h @@ -83,7 +83,7 @@ protected: { m_SwapChainDesc.Width = NewWidth; m_SwapChainDesc.Height = NewHeight; - LOG_INFO_MESSAGE("Changing display resolution to ", m_SwapChainDesc.Width, "x", m_SwapChainDesc.Height); + LOG_INFO_MESSAGE("Resizing the swap chain to ", m_SwapChainDesc.Width, "x", m_SwapChainDesc.Height); return true; } diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index 63cfe7cf..de16811a 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -1219,6 +1219,11 @@ namespace Diligent /// Default stencil value, which is used as optimized stencil clear value in D3D12 Uint8 DefaultStencilValue = 0; + /// Indicates if this is a primary swap chain. The back buffer and depth-stencil + /// buffer of the primary swap are set by SetRenderTargets(0, nullptr, nullptr) + /// call. There must be only one primary swap chain. + bool IsPrimary = true; + SwapChainDesc()noexcept{} /// Constructor intializes the structure members with default values @@ -1229,7 +1234,8 @@ namespace Diligent Uint32 _SamplesCount = SwapChainDesc{}.SamplesCount, Uint32 _BufferCount = SwapChainDesc{}.BufferCount, Float32 _DefaultDepthValue = SwapChainDesc{}.DefaultDepthValue, - Uint8 _DefaultStencilValue = SwapChainDesc{}.DefaultStencilValue) : + Uint8 _DefaultStencilValue = SwapChainDesc{}.DefaultStencilValue, + bool _IsPrimary = SwapChainDesc{}.IsPrimary) : Width (_Width), Height (_Height), ColorBufferFormat (_ColorBufferFormat), @@ -1237,7 +1243,8 @@ namespace Diligent SamplesCount (_SamplesCount), BufferCount (_BufferCount), DefaultDepthValue (_DefaultDepthValue), - DefaultStencilValue(_DefaultStencilValue) + DefaultStencilValue (_DefaultStencilValue), + IsPrimary (_IsPrimary) {} }; -- cgit v1.2.3