diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-12-04 04:52:34 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-12-04 04:52:34 +0000 |
| commit | fefe45978623a7f8dd7e0496fe4877e64d875e2c (patch) | |
| tree | e7ad50bdffe89a0f471bdec365d9f27698e393d7 /Graphics/GraphicsEngineD3D12 | |
| parent | Removed DRAW_FLAG_TRANSITION_VERTEX_BUFFERS, DRAW_FLAG_TRANSITION_INDEX_BUFFE... (diff) | |
| download | DiligentCore-fefe45978623a7f8dd7e0496fe4877e64d875e2c.tar.gz DiligentCore-fefe45978623a7f8dd7e0496fe4877e64d875e2c.zip | |
Replaced SET_RENDER_TARGETS_FLAGS with RESOURCE_STATE_TRANSITION_MODE.
Removed CLEAR_DEPTH_STENCIL_TRANSITION_STATE_FLAG and CLEAR_DEPTH_STENCIL_VERIFY_STATE_FLAG
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
5 files changed, 27 insertions, 34 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/CommandContext.h b/Graphics/GraphicsEngineD3D12/include/CommandContext.h index c3f33491..49fd72bd 100644 --- a/Graphics/GraphicsEngineD3D12/include/CommandContext.h +++ b/Graphics/GraphicsEngineD3D12/include/CommandContext.h @@ -203,8 +203,6 @@ public: } } - void SetRenderTargets( UINT NumRTVs, ITextureViewD3D12** ppRTVs, ITextureViewD3D12* pDSV, SET_RENDER_TARGETS_FLAGS Flags ); - void SetViewports( UINT NumVPs, const D3D12_VIEWPORT* pVPs ) { m_pCommandList->RSSetViewports(NumVPs, pVPs); diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h index e5e160be..7861ffe9 100644 --- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h @@ -88,16 +88,20 @@ public: virtual void SetScissorRects( Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight )override final; - virtual void SetRenderTargets( Uint32 NumRenderTargets, - ITextureView* ppRenderTargets[], - ITextureView* pDepthStencil, - SET_RENDER_TARGETS_FLAGS Flags )override final; + virtual void SetRenderTargets( Uint32 NumRenderTargets, + ITextureView* ppRenderTargets[], + ITextureView* pDepthStencil, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )override final; virtual void Draw( DrawAttribs& DrawAttribs )override final; virtual void DispatchCompute( const DispatchComputeAttribs& DispatchAttrs )override final; - virtual void ClearDepthStencil( ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil)override final; + virtual void ClearDepthStencil(ITextureView* pView, + CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, + float fDepth, + Uint8 Stencil, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)override final; virtual void ClearRenderTarget( ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )override final; @@ -215,7 +219,7 @@ public: private: void CommitD3D12IndexBuffer(VALUE_TYPE IndexType); void CommitD3D12VertexBuffers(class GraphicsContext& GraphCtx); - void CommitRenderTargets(SET_RENDER_TARGETS_FLAGS Flags); + void CommitRenderTargets(RESOURCE_STATE_TRANSITION_MODE StateTransitionMode); void CommitViewports(); void CommitScissorRects(class GraphicsContext &GraphCtx, bool ScissorEnable); void Flush(bool RequestNewCmdCtx); diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index afa16772..9fdaf3bb 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -211,7 +211,7 @@ namespace Diligent { GraphicsCtx.SetStencilRef(m_StencilRef); GraphicsCtx.SetBlendFactor(m_BlendFactors); - CommitRenderTargets(SET_RENDER_TARGETS_FLAG_VERIFY_STATES); + CommitRenderTargets(RESOURCE_STATE_TRANSITION_MODE_VERIFY); CommitViewports(); } @@ -482,7 +482,11 @@ namespace Diligent ++m_State.NumCommands; } - void DeviceContextD3D12Impl::ClearDepthStencil( ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil ) + void DeviceContextD3D12Impl::ClearDepthStencil(ITextureView* pView, + CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, + float fDepth, + Uint8 Stencil, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) { ITextureViewD3D12* pViewD3D12 = nullptr; if( pView != nullptr ) @@ -508,13 +512,7 @@ namespace Diligent auto* pTextureD3D12 = ValidatedCast<TextureD3D12Impl>( pViewD3D12->GetTexture() ); auto& CmdCtx = GetCmdContext(); - auto TransitionMode = - (ClearFlags & CLEAR_DEPTH_STENCIL_TRANSITION_STATE_FLAG) ? - RESOURCE_STATE_TRANSITION_MODE_TRANSITION : - ((ClearFlags & CLEAR_DEPTH_STENCIL_VERIFY_STATE_FLAG) ? - RESOURCE_STATE_TRANSITION_MODE_VERIFY : - RESOURCE_STATE_TRANSITION_MODE_NONE); - TransitionOrVerifyTextureState(CmdCtx, *pTextureD3D12, TransitionMode, RESOURCE_STATE_DEPTH_WRITE, "Clearing depth-stencil buffer (DeviceContextD3D12Impl::ClearDepthStencil)"); + TransitionOrVerifyTextureState(CmdCtx, *pTextureD3D12, StateTransitionMode, RESOURCE_STATE_DEPTH_WRITE, "Clearing depth-stencil buffer (DeviceContextD3D12Impl::ClearDepthStencil)"); D3D12_CLEAR_FLAGS d3d12ClearFlags = (D3D12_CLEAR_FLAGS)0; if( ClearFlags & CLEAR_DEPTH_FLAG ) d3d12ClearFlags |= D3D12_CLEAR_FLAG_DEPTH; @@ -777,7 +775,7 @@ namespace Diligent } } - void DeviceContextD3D12Impl::CommitRenderTargets(SET_RENDER_TARGETS_FLAGS Flags) + void DeviceContextD3D12Impl::CommitRenderTargets(RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) { const Uint32 MaxD3D12RTs = D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; Uint32 NumRenderTargets = m_NumBoundRenderTargets; @@ -816,12 +814,7 @@ namespace Diligent if( auto* pRTV = ppRTVs[i] ) { auto* pTexture = ValidatedCast<TextureD3D12Impl>( pRTV->GetTexture() ); - auto RTTransitionMode = (Flags & SET_RENDER_TARGETS_FLAG_TRANSITION_COLOR) ? - RESOURCE_STATE_TRANSITION_MODE_TRANSITION : - ((Flags & SET_RENDER_TARGETS_FLAG_VERIFY_STATES) ? - RESOURCE_STATE_TRANSITION_MODE_VERIFY : - RESOURCE_STATE_TRANSITION_MODE_NONE); - TransitionOrVerifyTextureState(CmdCtx, *pTexture, RTTransitionMode, RESOURCE_STATE_RENDER_TARGET, "Setting render targets (DeviceContextD3D12Impl::CommitRenderTargets)"); + TransitionOrVerifyTextureState(CmdCtx, *pTexture, StateTransitionMode, RESOURCE_STATE_RENDER_TARGET, "Setting render targets (DeviceContextD3D12Impl::CommitRenderTargets)"); RTVHandles[i] = pRTV->GetCPUDescriptorHandle(); VERIFY_EXPR(RTVHandles[i].ptr != 0); } @@ -837,12 +830,7 @@ namespace Diligent //} //else { - auto DepthTransitionMode = (Flags & SET_RENDER_TARGETS_FLAG_TRANSITION_DEPTH) ? - RESOURCE_STATE_TRANSITION_MODE_TRANSITION : - ((Flags & SET_RENDER_TARGETS_FLAG_VERIFY_STATES) ? - RESOURCE_STATE_TRANSITION_MODE_VERIFY : - RESOURCE_STATE_TRANSITION_MODE_NONE); - TransitionOrVerifyTextureState(CmdCtx, *pTexture, DepthTransitionMode, RESOURCE_STATE_DEPTH_WRITE, "Setting depth-stencil buffer (DeviceContextD3D12Impl::CommitRenderTargets)"); + TransitionOrVerifyTextureState(CmdCtx, *pTexture, StateTransitionMode, RESOURCE_STATE_DEPTH_WRITE, "Setting depth-stencil buffer (DeviceContextD3D12Impl::CommitRenderTargets)"); DSVHandle = pDSV->GetCPUDescriptorHandle(); VERIFY_EXPR(DSVHandle.ptr != 0); } @@ -853,11 +841,14 @@ namespace Diligent CmdCtx.AsGraphicsContext().GetCommandList()->OMSetRenderTargets( NumRenderTargets, RTVHandles, FALSE, DSVHandle.ptr != 0 ? &DSVHandle : nullptr ); } - void DeviceContextD3D12Impl::SetRenderTargets( Uint32 NumRenderTargets, ITextureView *ppRenderTargets[], ITextureView *pDepthStencil, SET_RENDER_TARGETS_FLAGS Flags ) + void DeviceContextD3D12Impl::SetRenderTargets( Uint32 NumRenderTargets, + ITextureView* ppRenderTargets[], + ITextureView* pDepthStencil, + RESOURCE_STATE_TRANSITION_MODE StateTransitionMode ) { if( TDeviceContextBase::SetRenderTargets( NumRenderTargets, ppRenderTargets, pDepthStencil ) ) { - CommitRenderTargets(Flags); + CommitRenderTargets(StateTransitionMode); // Set the viewport to match the render target size SetViewports(1, nullptr, 0, 0); diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp index 88681445..31dea0fc 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp @@ -381,7 +381,7 @@ void EngineFactoryD3D12Impl::CreateSwapChainD3D12( IRenderDevice* pDe pDeviceContextD3D12->SetSwapChain(pSwapChainD3D12); // Bind default render target - pDeviceContextD3D12->SetRenderTargets( 0, nullptr, nullptr, SET_RENDER_TARGETS_FLAG_TRANSITION_ALL ); + pDeviceContextD3D12->SetRenderTargets( 0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION ); // Set default viewport pDeviceContextD3D12->SetViewports( 1, nullptr, 0, 0 ); diff --git a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp index 18ef3043..357755db 100644 --- a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp @@ -199,7 +199,7 @@ void SwapChainD3D12Impl::UpdateSwapChain(bool CreateNew) if (bIsDefaultFBBound) { // Set default render target and viewport - pDeviceContext->SetRenderTargets(0, nullptr, nullptr, SET_RENDER_TARGETS_FLAG_TRANSITION_ALL); + pDeviceContext->SetRenderTargets(0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION); pDeviceContext->SetViewports(1, nullptr, 0, 0); } } |
