summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-07-25 15:09:57 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-07-25 15:09:57 +0000
commit404459e2cb9a17e94ee7d26c22fbe2485828b496 (patch)
tree7b81d6ed6fa0612a35443b91e7b7948c51d824c5 /Graphics/GraphicsEngineD3D12
parentFew improvements to RefCntAutoPtr & DeviceContextBase::SetPipelineState (diff)
downloadDiligentCore-404459e2cb9a17e94ee7d26c22fbe2485828b496.tar.gz
DiligentCore-404459e2cb9a17e94ee7d26c22fbe2485828b496.zip
Improved performance of DeviceObjectBase::Release()
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h5
-rw-r--r--Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.h7
-rw-r--r--Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h11
-rw-r--r--Graphics/GraphicsEngineD3D12/include/FenceD3D12Impl.h11
-rw-r--r--Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h7
-rw-r--r--Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.h11
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h7
-rw-r--r--Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h8
-rw-r--r--Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.h7
-rw-r--r--Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp5
-rw-r--r--Graphics/GraphicsEngineD3D12/src/FenceD3D12Impl.cpp6
-rw-r--r--Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp11
-rw-r--r--Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp2
14 files changed, 53 insertions, 47 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h
index 9a804c0c..b32ddb74 100644
--- a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h
@@ -32,6 +32,7 @@
#include "BufferViewD3D12Impl.h"
#include "D3D12ResourceBase.h"
#include "DynamicUploadHeap.h"
+#include "RenderDeviceD3D12Impl.h"
namespace Diligent
{
@@ -39,10 +40,10 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::IBufferD3D12 interface
-class BufferD3D12Impl : public BufferBase<IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator>, public D3D12ResourceBase
+class BufferD3D12Impl : public BufferBase<IBufferD3D12, RenderDeviceD3D12Impl, BufferViewD3D12Impl, FixedBlockMemoryAllocator>, public D3D12ResourceBase
{
public:
- using TBufferBase = BufferBase<IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator>;
+ using TBufferBase = BufferBase<IBufferD3D12, RenderDeviceD3D12Impl, BufferViewD3D12Impl, FixedBlockMemoryAllocator>;
BufferD3D12Impl(IReferenceCounters* pRefCounters,
FixedBlockMemoryAllocator& BuffViewObjMemAllocator,
diff --git a/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.h
index 8b074440..a722cdf0 100644
--- a/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.h
@@ -30,19 +30,20 @@
#include "RenderDeviceD3D12.h"
#include "BufferViewBase.h"
#include "DescriptorHeap.h"
+#include "RenderDeviceD3D12Impl.h"
namespace Diligent
{
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::IBufferViewD3D12 interface
-class BufferViewD3D12Impl : public BufferViewBase<IBufferViewD3D12>
+class BufferViewD3D12Impl : public BufferViewBase<IBufferViewD3D12, RenderDeviceD3D12Impl>
{
public:
- using TBufferViewBase = BufferViewBase<IBufferViewD3D12>;
+ using TBufferViewBase = BufferViewBase<IBufferViewD3D12, RenderDeviceD3D12Impl>;
BufferViewD3D12Impl( IReferenceCounters* pRefCounters,
- IRenderDevice* pDevice,
+ RenderDeviceD3D12Impl* pDevice,
const BufferViewDesc& ViewDesc,
class IBuffer* pBuffer,
DescriptorHeapAllocation&& HandleAlloc,
diff --git a/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h
index 767abf3b..2cb36faf 100644
--- a/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/CommandListD3D12Impl.h
@@ -27,19 +27,20 @@
/// Declaration of Diligent::CommandListD3D12Impl class
#include "CommandListBase.h"
+#include "RenderDeviceD3D12Impl.h"
namespace Diligent
{
/// Implementation of the Diligent::ICommandList interface
-class CommandListD3D12Impl : public CommandListBase<ICommandList>
+class CommandListD3D12Impl : public CommandListBase<ICommandList, RenderDeviceD3D12Impl>
{
public:
- using TCommandListBase = CommandListBase<ICommandList>;
+ using TCommandListBase = CommandListBase<ICommandList, RenderDeviceD3D12Impl>;
- CommandListD3D12Impl(IReferenceCounters* pRefCounters,
- IRenderDevice* pDevice,
- class CommandContext* pCmdContext) :
+ CommandListD3D12Impl(IReferenceCounters* pRefCounters,
+ RenderDeviceD3D12Impl* pDevice,
+ class CommandContext* pCmdContext) :
TCommandListBase(pRefCounters, pDevice),
m_pCmdContext(pCmdContext)
{
diff --git a/Graphics/GraphicsEngineD3D12/include/FenceD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/FenceD3D12Impl.h
index 636557a9..4ab564d4 100644
--- a/Graphics/GraphicsEngineD3D12/include/FenceD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/FenceD3D12Impl.h
@@ -29,6 +29,7 @@
#include "FenceD3D12.h"
#include "RenderDeviceD3D12.h"
#include "FenceBase.h"
+#include "RenderDeviceD3D12Impl.h"
namespace Diligent
{
@@ -36,14 +37,14 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::IFenceD3D12 interface
-class FenceD3D12Impl : public FenceBase<IFenceD3D12>
+class FenceD3D12Impl : public FenceBase<IFenceD3D12, RenderDeviceD3D12Impl>
{
public:
- using TFenceBase = FenceBase<IFenceD3D12>;
+ using TFenceBase = FenceBase<IFenceD3D12, RenderDeviceD3D12Impl>;
- FenceD3D12Impl(IReferenceCounters* pRefCounters,
- IRenderDevice* pDevice,
- const FenceDesc& Desc);
+ FenceD3D12Impl(IReferenceCounters* pRefCounters,
+ RenderDeviceD3D12Impl* pDevice,
+ const FenceDesc& Desc);
~FenceD3D12Impl();
virtual Uint64 GetCompletedValue()override final;
diff --git a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h
index d0525325..72d66900 100644
--- a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.h
@@ -32,6 +32,7 @@
#include "RootSignature.h"
#include "ShaderResourceLayoutD3D12.h"
#include "SRBMemoryAllocator.h"
+#include "RenderDeviceD3D12Impl.h"
/// Namespace for the Direct3D11 implementation of the graphics engine
namespace Diligent
@@ -39,12 +40,12 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::IRenderDeviceD3D12 interface
-class PipelineStateD3D12Impl : public PipelineStateBase<IPipelineStateD3D12, IRenderDeviceD3D12>
+class PipelineStateD3D12Impl : public PipelineStateBase<IPipelineStateD3D12, RenderDeviceD3D12Impl>
{
public:
- using TPipelineStateBase = PipelineStateBase<IPipelineStateD3D12, IRenderDeviceD3D12>;
+ using TPipelineStateBase = PipelineStateBase<IPipelineStateD3D12, RenderDeviceD3D12Impl>;
- PipelineStateD3D12Impl( IReferenceCounters *pRefCounters, class RenderDeviceD3D12Impl *pDeviceD3D12, const PipelineStateDesc &PipelineDesc );
+ PipelineStateD3D12Impl( IReferenceCounters *pRefCounters, RenderDeviceD3D12Impl *pDeviceD3D12, const PipelineStateDesc &PipelineDesc );
~PipelineStateD3D12Impl();
virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface );
diff --git a/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.h
index 65813e83..fb9b7681 100644
--- a/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.h
@@ -30,20 +30,21 @@
#include "RenderDeviceD3D12.h"
#include "SamplerBase.h"
#include "DescriptorHeap.h"
+#include "RenderDeviceD3D12Impl.h"
namespace Diligent
{
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::ISamplerD3D12 interface
-class SamplerD3D12Impl : public SamplerBase<ISamplerD3D12, IRenderDeviceD3D12>
+class SamplerD3D12Impl : public SamplerBase<ISamplerD3D12, RenderDeviceD3D12Impl>
{
public:
- using TSamplerBase = SamplerBase<ISamplerD3D12, IRenderDeviceD3D12>;
+ using TSamplerBase = SamplerBase<ISamplerD3D12, RenderDeviceD3D12Impl>;
- SamplerD3D12Impl(IReferenceCounters* pRefCounters,
- class RenderDeviceD3D12Impl* pRenderDeviceD3D12,
- const SamplerDesc& SamplerDesc);
+ SamplerD3D12Impl(IReferenceCounters* pRefCounters,
+ RenderDeviceD3D12Impl* pRenderDeviceD3D12,
+ const SamplerDesc& SamplerDesc);
~SamplerD3D12Impl();
virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface )override;
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h
index 5005f9d6..9fcb75da 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderD3D12Impl.h
@@ -31,6 +31,7 @@
#include "ShaderBase.h"
#include "ShaderD3DBase.h"
#include "ShaderResourceLayoutD3D12.h"
+#include "RenderDeviceD3D12Impl.h"
#ifdef _DEBUG
# define VERIFY_SHADER_BINDINGS
@@ -43,13 +44,13 @@ class ResourceMapping;
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::IShaderD3D12 interface
-class ShaderD3D12Impl : public ShaderBase<IShaderD3D12, IRenderDeviceD3D12>, public ShaderD3DBase
+class ShaderD3D12Impl : public ShaderBase<IShaderD3D12, RenderDeviceD3D12Impl>, public ShaderD3DBase
{
public:
- using TShaderBase = ShaderBase<IShaderD3D12, IRenderDeviceD3D12>;
+ using TShaderBase = ShaderBase<IShaderD3D12, RenderDeviceD3D12Impl>;
ShaderD3D12Impl(IReferenceCounters* pRefCounters,
- class RenderDeviceD3D12Impl* pRenderDeviceD3D12,
+ RenderDeviceD3D12Impl* pRenderDeviceD3D12,
const ShaderCreationAttribs& ShaderCreationAttribs);
~ShaderD3D12Impl();
diff --git a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h
index 46d88f6c..81353c01 100644
--- a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h
@@ -31,7 +31,7 @@
#include "TextureBase.h"
#include "TextureViewD3D12Impl.h"
#include "D3D12ResourceBase.h"
-
+#include "RenderDeviceD3D12Impl.h"
namespace Diligent
{
@@ -39,15 +39,15 @@ namespace Diligent
class FixedBlockMemoryAllocator;
/// Base implementation of the Diligent::ITextureD3D12 interface
-class TextureD3D12Impl : public TextureBase<ITextureD3D12, TextureViewD3D12Impl, FixedBlockMemoryAllocator>, public D3D12ResourceBase
+class TextureD3D12Impl : public TextureBase<ITextureD3D12, RenderDeviceD3D12Impl, TextureViewD3D12Impl, FixedBlockMemoryAllocator>, public D3D12ResourceBase
{
public:
- using TTextureBase = TextureBase<ITextureD3D12, TextureViewD3D12Impl, FixedBlockMemoryAllocator>;
+ using TTextureBase = TextureBase<ITextureD3D12, RenderDeviceD3D12Impl, TextureViewD3D12Impl, FixedBlockMemoryAllocator>;
// Creates a new D3D12 resource
TextureD3D12Impl(IReferenceCounters* pRefCounters,
FixedBlockMemoryAllocator& TexViewObjAllocator,
- class RenderDeviceD3D12Impl* pDeviceD3D12,
+ RenderDeviceD3D12Impl* pDeviceD3D12,
const TextureDesc& TexDesc,
const TextureData& InitData = TextureData());
// Attaches to an existing D3D12 resource
diff --git a/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.h
index 219fedf5..b220dde8 100644
--- a/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.h
+++ b/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.h
@@ -30,19 +30,20 @@
#include "RenderDeviceD3D12.h"
#include "TextureViewBase.h"
#include "DescriptorHeap.h"
+#include "RenderDeviceD3D12Impl.h"
namespace Diligent
{
class FixedBlockMemoryAllocator;
/// Implementation of the Diligent::ITextureViewD3D12 interface
-class TextureViewD3D12Impl : public TextureViewBase<ITextureViewD3D12>
+class TextureViewD3D12Impl : public TextureViewBase<ITextureViewD3D12, RenderDeviceD3D12Impl>
{
public:
- using TTextureViewBase = TextureViewBase<ITextureViewD3D12>;
+ using TTextureViewBase = TextureViewBase<ITextureViewD3D12, RenderDeviceD3D12Impl>;
TextureViewD3D12Impl( IReferenceCounters* pRefCounters,
- IRenderDevice* pDevice,
+ RenderDeviceD3D12Impl* pDevice,
const TextureViewDesc& ViewDesc,
class ITexture* pTexture,
DescriptorHeapAllocation&& HandleAlloc,
diff --git a/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp
index 2f9a0661..e3a4364a 100644
--- a/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp
@@ -28,7 +28,7 @@ namespace Diligent
{
BufferViewD3D12Impl::BufferViewD3D12Impl( IReferenceCounters* pRefCounters,
- IRenderDevice* pDevice,
+ RenderDeviceD3D12Impl* pDevice,
const BufferViewDesc& ViewDesc,
IBuffer* pBuffer,
DescriptorHeapAllocation&& HandleAlloc,
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
index d5210e40..eccdcb1d 100644
--- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
@@ -835,8 +835,9 @@ namespace Diligent
void DeviceContextD3D12Impl::FinishCommandList(ICommandList** ppCommandList)
{
- CommandListD3D12Impl *pCmdListD3D12( NEW_RC_OBJ(m_CmdListAllocator, "CommandListD3D12Impl instance", CommandListD3D12Impl)
- (m_pDevice, m_pCurrCmdCtx) );
+ auto* pDeviceD3D12Impl = m_pDevice.RawPtr<RenderDeviceD3D12Impl>();
+ CommandListD3D12Impl* pCmdListD3D12( NEW_RC_OBJ(m_CmdListAllocator, "CommandListD3D12Impl instance", CommandListD3D12Impl)
+ (pDeviceD3D12Impl, m_pCurrCmdCtx) );
pCmdListD3D12->QueryInterface( IID_CommandList, reinterpret_cast<IObject**>(ppCommandList) );
m_pCurrCmdCtx = nullptr;
Flush(true);
diff --git a/Graphics/GraphicsEngineD3D12/src/FenceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/FenceD3D12Impl.cpp
index 7577c9c4..aac8e7ef 100644
--- a/Graphics/GraphicsEngineD3D12/src/FenceD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/FenceD3D12Impl.cpp
@@ -30,9 +30,9 @@
namespace Diligent
{
-FenceD3D12Impl :: FenceD3D12Impl(IReferenceCounters* pRefCounters,
- IRenderDevice* pDevice,
- const FenceDesc& Desc) :
+FenceD3D12Impl :: FenceD3D12Impl(IReferenceCounters* pRefCounters,
+ RenderDeviceD3D12Impl* pDevice,
+ const FenceDesc& Desc) :
TFenceBase(pRefCounters, pDevice, Desc)
{
auto* pd3d12Device = ValidatedCast<RenderDeviceD3D12Impl>(pDevice)->GetD3D12Device();
diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
index d99d2aad..be1ac008 100644
--- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
@@ -238,8 +238,7 @@ PipelineStateD3D12Impl::~PipelineStateD3D12Impl()
ShaderResLayoutAllocator.Free(m_pShaderResourceLayouts);
// D3D12 object can only be destroyed when it is no longer used by the GPU
- auto* pDeviceD3D12Impl = GetDevice<RenderDeviceD3D12Impl>();
- pDeviceD3D12Impl->SafeReleaseD3D12Object(m_pd3d12PSO);
+ m_pDevice->SafeReleaseD3D12Object(m_pd3d12PSO);
}
IMPLEMENT_QUERY_INTERFACE( PipelineStateD3D12Impl, IID_PipelineStateD3D12, TPipelineStateBase )
@@ -247,8 +246,7 @@ IMPLEMENT_QUERY_INTERFACE( PipelineStateD3D12Impl, IID_PipelineStateD3D12, TPipe
void PipelineStateD3D12Impl::CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding)
{
- auto* pRenderDeviceD3D12 = GetDevice<RenderDeviceD3D12Impl>();
- auto& SRBAllocator = pRenderDeviceD3D12->GetSRBAllocator();
+ auto& SRBAllocator = m_pDevice->GetSRBAllocator();
auto pResBindingD3D12 = NEW_RC_OBJ(SRBAllocator, "ShaderResourceBindingD3D12Impl instance", ShaderResourceBindingD3D12Impl)(this, false);
pResBindingD3D12->QueryInterface(IID_ShaderResourceBinding, reinterpret_cast<IObject**>(ppShaderResourceBinding));
}
@@ -352,7 +350,6 @@ ShaderResourceCacheD3D12* PipelineStateD3D12Impl::CommitAndTransitionShaderResou
pResBindingD3D12Impl->dbgVerifyResourceBindings(this);
#endif
- auto* pDeviceD3D12Impl = GetDevice<RenderDeviceD3D12Impl>();
auto& ResourceCache = pResBindingD3D12Impl->GetResourceCache();
if(CommitResources)
{
@@ -362,9 +359,9 @@ ShaderResourceCacheD3D12* PipelineStateD3D12Impl::CommitAndTransitionShaderResou
Ctx.AsGraphicsContext().SetRootSignature( GetD3D12RootSignature() );
if(TransitionResources)
- (m_RootSig.*m_RootSig.TransitionAndCommitDescriptorHandles)(pDeviceD3D12Impl, ResourceCache, Ctx, m_Desc.IsComputePipeline);
+ (m_RootSig.*m_RootSig.TransitionAndCommitDescriptorHandles)(m_pDevice, ResourceCache, Ctx, m_Desc.IsComputePipeline);
else
- (m_RootSig.*m_RootSig.CommitDescriptorHandles)(pDeviceD3D12Impl, ResourceCache, Ctx, m_Desc.IsComputePipeline);
+ (m_RootSig.*m_RootSig.CommitDescriptorHandles)(m_pDevice, ResourceCache, Ctx, m_Desc.IsComputePipeline);
}
else
{
diff --git a/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp
index 8ba089d4..aa11f98d 100644
--- a/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp
@@ -29,7 +29,7 @@ namespace Diligent
{
TextureViewD3D12Impl::TextureViewD3D12Impl( IReferenceCounters* pRefCounters,
- IRenderDevice* pDevice,
+ RenderDeviceD3D12Impl* pDevice,
const TextureViewDesc& ViewDesc,
ITexture* pTexture,
DescriptorHeapAllocation&& HandleAlloc,