summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-07-02 00:08:59 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-07-02 00:08:59 +0000
commit354898decf45d32a09d9b4a15319413a5d199f2a (patch)
tree61e46f6cb4fc324338903c79292c9c995e3f67ef /Graphics/GraphicsEngineD3D12
parentReworked how render targets are bound in Vulkan: added RenderPass cache (diff)
downloadDiligentCore-354898decf45d32a09d9b4a15319413a5d199f2a.tar.gz
DiligentCore-354898decf45d32a09d9b4a15319413a5d199f2a.zip
Reworked binding default frame buffer to keep references to current RTV and DSV instead of nulls.
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.h9
-rw-r--r--Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h12
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp8
-rw-r--r--Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp7
4 files changed, 12 insertions, 24 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.h
index c186ff28..9cca636e 100644
--- a/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.h
@@ -54,7 +54,14 @@ public:
virtual void Resize( Uint32 NewWidth, Uint32 NewHeight )override final;
virtual IDXGISwapChain* GetDXGISwapChain()override final{ return m_pSwapChain; }
- virtual ITextureViewD3D12* GetCurrentBackBufferRTV()override final;
+
+ virtual ITextureViewD3D12* GetCurrentBackBufferRTV()override final
+ {
+ auto CurrentBackBufferIndex = m_pSwapChain->GetCurrentBackBufferIndex();
+ VERIFY_EXPR(CurrentBackBufferIndex >= 0 && CurrentBackBufferIndex < m_SwapChainDesc.BufferCount);
+ return m_pBackBufferRTV[CurrentBackBufferIndex];
+ }
+
virtual ITextureViewD3D12* GetDepthBufferDSV()override final{return m_pDepthBufferDSV;}
private:
diff --git a/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h b/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h
index b6a64831..91c221fb 100644
--- a/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h
+++ b/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h
@@ -48,18 +48,6 @@ public:
/// The method does *NOT* call AddRef() on the returned interface,
/// so Release() must not be called.
virtual IDXGISwapChain* GetDXGISwapChain() = 0;
-
- /// Returns a pointer to the render target view of the current back buffer in the swap chain
-
- /// The method does *NOT* call AddRef() on the returned interface,
- /// so Release() must not be called.
- virtual ITextureViewD3D12* GetCurrentBackBufferRTV() = 0;
-
- /// Returns a pointer to the depth-stencil view of the depth buffer
-
- /// The method does *NOT* call AddRef() on the returned interface,
- /// so Release() must not be called.
- virtual ITextureViewD3D12* GetDepthBufferDSV() = 0;
};
}
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
index a5385da7..d11dd975 100644
--- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
@@ -453,7 +453,7 @@ namespace Diligent
{
if (m_pSwapChain)
{
- pDSVD3D12 = m_pSwapChain.RawPtr<ISwapChainD3D12>()->GetDepthBufferDSV();
+ pDSVD3D12 = ValidatedCast<ITextureViewD3D12>(m_pSwapChain.RawPtr<ISwapChainD3D12>()->GetDepthBufferDSV());
}
else
{
@@ -485,7 +485,7 @@ namespace Diligent
{
if (m_pSwapChain)
{
- pd3d12RTV = m_pSwapChain.RawPtr<ISwapChainD3D12>()->GetCurrentBackBufferRTV();
+ pd3d12RTV = ValidatedCast<ITextureViewD3D12>(m_pSwapChain.RawPtr<ISwapChainD3D12>()->GetCurrentBackBufferRTV());
}
else
{
@@ -678,8 +678,8 @@ namespace Diligent
{
NumRenderTargets = 1;
auto *pSwapChainD3D12 = m_pSwapChain.RawPtr<ISwapChainD3D12>();
- ppRTVs[0] = pSwapChainD3D12->GetCurrentBackBufferRTV();
- pDSV = pSwapChainD3D12->GetDepthBufferDSV();
+ ppRTVs[0] = ValidatedCast<ITextureViewD3D12>(pSwapChainD3D12->GetCurrentBackBufferRTV());
+ pDSV = ValidatedCast<ITextureViewD3D12>(pSwapChainD3D12->GetDepthBufferDSV());
}
else
{
diff --git a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
index 3df583d7..f9b782f0 100644
--- a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
@@ -210,11 +210,4 @@ void SwapChainD3D12Impl::Resize( Uint32 NewWidth, Uint32 NewHeight )
}
}
-ITextureViewD3D12 *SwapChainD3D12Impl::GetCurrentBackBufferRTV()
-{
- auto CurrentBackBufferIndex = m_pSwapChain->GetCurrentBackBufferIndex();
- VERIFY_EXPR(CurrentBackBufferIndex >= 0 && CurrentBackBufferIndex < m_SwapChainDesc.BufferCount);
- return m_pBackBufferRTV[CurrentBackBufferIndex];
-}
-
}