diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-07-25 04:31:09 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-07-25 04:31:09 +0000 |
| commit | c746f802d7b23d9c5ee0f52a7e5428a32bf3f316 (patch) | |
| tree | 344b4a987341150fda9fd7f8642b902e9f96df71 /Graphics/GraphicsEngineD3D12 | |
| parent | Fixed performance issue with resetting unchanged vertex buffers (diff) | |
| download | DiligentCore-c746f802d7b23d9c5ee0f52a7e5428a32bf3f316.tar.gz DiligentCore-c746f802d7b23d9c5ee0f52a7e5428a32bf3f316.zip | |
Updated DeviceContextBase to use final types for pipeline state, buffers and texture views
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
14 files changed, 25 insertions, 21 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h index 51ac7489..9a804c0c 100644 --- a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h @@ -42,7 +42,8 @@ class FixedBlockMemoryAllocator; class BufferD3D12Impl : public BufferBase<IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator>, public D3D12ResourceBase { public: - typedef BufferBase<IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator> TBufferBase; + using TBufferBase = BufferBase<IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator>; + BufferD3D12Impl(IReferenceCounters* pRefCounters, FixedBlockMemoryAllocator& BuffViewObjMemAllocator, class RenderDeviceD3D12Impl* pDeviceD3D12, diff --git a/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.h index 7a8336d6..8b074440 100644 --- a/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.h @@ -39,7 +39,7 @@ class FixedBlockMemoryAllocator; class BufferViewD3D12Impl : public BufferViewBase<IBufferViewD3D12> { public: - typedef BufferViewBase<IBufferViewD3D12> TBufferViewBase; + using TBufferViewBase = BufferViewBase<IBufferViewD3D12>; BufferViewD3D12Impl( IReferenceCounters* pRefCounters, IRenderDevice* pDevice, diff --git a/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h index bf97df8c..767abf3b 100644 --- a/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h @@ -35,7 +35,8 @@ namespace Diligent class CommandListD3D12Impl : public CommandListBase<ICommandList> { public: - typedef CommandListBase<ICommandList> TCommandListBase; + using TCommandListBase = CommandListBase<ICommandList>; + CommandListD3D12Impl(IReferenceCounters* pRefCounters, IRenderDevice* pDevice, class CommandContext* pCmdContext) : diff --git a/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.h index 0db94e2b..d30fa2b4 100644 --- a/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.h @@ -36,7 +36,7 @@ namespace Diligent class CommandQueueD3D12Impl : public ObjectBase<ICommandQueueD3D12> { public: - typedef ObjectBase<ICommandQueueD3D12> TBase; + using TBase = ObjectBase<ICommandQueueD3D12>; CommandQueueD3D12Impl(IReferenceCounters *pRefCounters, ID3D12CommandQueue *pd3d12NativeCmdQueue, ID3D12Fence *pd3d12Fence); ~CommandQueueD3D12Impl(); diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h index 785c6f32..2dfdfacf 100644 --- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h @@ -29,7 +29,9 @@ #include "DeviceContextD3D12.h" #include "DeviceContextBase.h" #include "GenerateMips.h" - +#include "BufferD3D12Impl.h" +#include "TextureViewD3D12Impl.h" +#include "PipelineStateD3D12Impl.h" #ifdef _DEBUG # define VERIFY_CONTEXT_BINDINGS #endif @@ -38,10 +40,10 @@ namespace Diligent { /// Implementation of the Diligent::IDeviceContext interface -class DeviceContextD3D12Impl : public DeviceContextBase<IDeviceContextD3D12> +class DeviceContextD3D12Impl : public DeviceContextBase<IDeviceContextD3D12, BufferD3D12Impl, TextureViewD3D12Impl, PipelineStateD3D12Impl> { public: - typedef DeviceContextBase<IDeviceContextD3D12> TDeviceContextBase; + using TDeviceContextBase = DeviceContextBase<IDeviceContextD3D12, BufferD3D12Impl, TextureViewD3D12Impl, PipelineStateD3D12Impl>; DeviceContextD3D12Impl(IReferenceCounters* pRefCounters, class RenderDeviceD3D12Impl* pDevice, diff --git a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h index f4aed5d4..d0525325 100644 --- a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h @@ -42,7 +42,7 @@ class FixedBlockMemoryAllocator; class PipelineStateD3D12Impl : public PipelineStateBase<IPipelineStateD3D12, IRenderDeviceD3D12> { public: - typedef PipelineStateBase<IPipelineStateD3D12, IRenderDeviceD3D12> TPipelineStateBase; + using TPipelineStateBase = PipelineStateBase<IPipelineStateD3D12, IRenderDeviceD3D12>; PipelineStateD3D12Impl( IReferenceCounters *pRefCounters, class RenderDeviceD3D12Impl *pDeviceD3D12, const PipelineStateDesc &PipelineDesc ); ~PipelineStateD3D12Impl(); diff --git a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h index 34b8f864..e0e947f9 100644 --- a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.h @@ -44,7 +44,7 @@ namespace Diligent class RenderDeviceD3D12Impl : public RenderDeviceD3DBase<IRenderDeviceD3D12> { public: - typedef RenderDeviceD3DBase<IRenderDeviceD3D12> TRenderDeviceBase; + using TRenderDeviceBase = RenderDeviceD3DBase<IRenderDeviceD3D12>; RenderDeviceD3D12Impl( IReferenceCounters* pRefCounters, IMemoryAllocator& RawMemAllocator, diff --git a/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.h index 0c34888c..65813e83 100644 --- a/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.h @@ -39,7 +39,7 @@ class FixedBlockMemoryAllocator; class SamplerD3D12Impl : public SamplerBase<ISamplerD3D12, IRenderDeviceD3D12> { public: - typedef SamplerBase<ISamplerD3D12, IRenderDeviceD3D12> TSamplerBase; + using TSamplerBase = SamplerBase<ISamplerD3D12, IRenderDeviceD3D12>; SamplerD3D12Impl(IReferenceCounters* pRefCounters, class RenderDeviceD3D12Impl* pRenderDeviceD3D12, diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h index fc61928b..5005f9d6 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h @@ -46,7 +46,7 @@ class FixedBlockMemoryAllocator; class ShaderD3D12Impl : public ShaderBase<IShaderD3D12, IRenderDeviceD3D12>, public ShaderD3DBase { public: - typedef ShaderBase<IShaderD3D12, IRenderDeviceD3D12> TShaderBase; + using TShaderBase = ShaderBase<IShaderD3D12, IRenderDeviceD3D12>; ShaderD3D12Impl(IReferenceCounters* pRefCounters, class RenderDeviceD3D12Impl* pRenderDeviceD3D12, diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.h index a87b4b91..b9b39487 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.h @@ -41,7 +41,8 @@ class FixedBlockMemoryAllocator; class ShaderResourceBindingD3D12Impl : public ShaderResourceBindingBase<IShaderResourceBindingD3D12> { public: - typedef ShaderResourceBindingBase<IShaderResourceBindingD3D12> TBase; + using TBase = ShaderResourceBindingBase<IShaderResourceBindingD3D12>; + ShaderResourceBindingD3D12Impl(IReferenceCounters* pRefCounters, class PipelineStateD3D12Impl* pPSO, bool IsPSOInternal); diff --git a/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.h index 9cca636e..30153804 100644 --- a/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.h @@ -40,6 +40,7 @@ class SwapChainD3D12Impl : public SwapChainD3DBase<ISwapChainD3D12, IDXGISwapCha { public: using TSwapChainBase = SwapChainD3DBase<ISwapChainD3D12, IDXGISwapChain3>; + SwapChainD3D12Impl(IReferenceCounters* pRefCounters, const SwapChainDesc& SwapChainDesc, const FullScreenModeDesc& FSDesc, diff --git a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h index 86cc6f0e..46d88f6c 100644 --- a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h @@ -42,7 +42,7 @@ class FixedBlockMemoryAllocator; class TextureD3D12Impl : public TextureBase<ITextureD3D12, TextureViewD3D12Impl, FixedBlockMemoryAllocator>, public D3D12ResourceBase { public: - typedef TextureBase<ITextureD3D12, TextureViewD3D12Impl, FixedBlockMemoryAllocator> TTextureBase; + using TTextureBase = TextureBase<ITextureD3D12, TextureViewD3D12Impl, FixedBlockMemoryAllocator>; // Creates a new D3D12 resource TextureD3D12Impl(IReferenceCounters* pRefCounters, diff --git a/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.h index 072446d9..219fedf5 100644 --- a/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.h @@ -39,7 +39,7 @@ class FixedBlockMemoryAllocator; class TextureViewD3D12Impl : public TextureViewBase<ITextureViewD3D12> { public: - typedef TextureViewBase<ITextureViewD3D12> TTextureViewBase; + using TTextureViewBase = TextureViewBase<ITextureViewD3D12>; TextureViewD3D12Impl( IReferenceCounters* pRefCounters, IRenderDevice* pDevice, diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 4484d615..f490ff9a 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -170,13 +170,11 @@ namespace Diligent void DeviceContextD3D12Impl::CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, Uint32 Flags) { - if (!DeviceContextBase::CommitShaderResources<PipelineStateD3D12Impl>(pShaderResourceBinding, Flags, 0 /*Dummy*/)) + if (!DeviceContextBase::CommitShaderResources(pShaderResourceBinding, Flags, 0 /*Dummy*/)) return; auto *pCtx = RequestCmdContext(); - auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr<PipelineStateD3D12Impl>(); - - m_pCommittedResourceCache = pPipelineStateD3D12->CommitAndTransitionShaderResources(pShaderResourceBinding, *pCtx, true, (Flags & COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES)!=0); + m_pCommittedResourceCache = m_pPipelineState->CommitAndTransitionShaderResources(pShaderResourceBinding, *pCtx, true, (Flags & COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES)!=0); } void DeviceContextD3D12Impl::SetStencilRef(Uint32 StencilRef) @@ -261,7 +259,7 @@ namespace Diligent void DeviceContextD3D12Impl::CommitD3D12VertexBuffers(GraphicsContext& GraphCtx) { - auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr<PipelineStateD3D12Impl>(); + auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr(); // Do not initialize array with zeroes for performance reasons D3D12_VERTEX_BUFFER_VIEW VBViews[MaxBufferSlots];// = {} @@ -336,7 +334,7 @@ namespace Diligent CommitD3D12IndexBuffer(DrawAttribs.IndexType); } - auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr<PipelineStateD3D12Impl>(); + auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr(); if(m_bCommittedD3D12VBsUpToDate) TransitionD3D12VertexBuffers(GraphCtx); @@ -398,7 +396,7 @@ namespace Diligent } #endif - auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr<PipelineStateD3D12Impl>(); + auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr(); auto &ComputeCtx = RequestCmdContext()->AsComputeContext(); ComputeCtx.SetRootSignature( pPipelineStateD3D12->GetD3D12RootSignature() ); |
