summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-21 02:37:20 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-21 02:37:20 +0000
commit2adf687a9c63eee5f7d6578ba7a8ce412e4cd5e2 (patch)
tree14c9bc780d6e69e654e380df70a596783d5b0899 /Graphics/GraphicsEngineD3D12
parentShaderResourceLayoutD3D12: added more validation to CopyStaticResourceDesript... (diff)
downloadDiligentCore-2adf687a9c63eee5f7d6578ba7a8ce412e4cd5e2.tar.gz
DiligentCore-2adf687a9c63eee5f7d6578ba7a8ce412e4cd5e2.zip
D3D12 backend: a bunch of cosmetic updates + made dynamic buffer allocation data 64-byte aligned
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp19
-rw-r--r--Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/CommandContext.hpp21
-rw-r--r--Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderBindingTableD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/TopLevelASD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp12
-rw-r--r--Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp10
-rw-r--r--Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/CommandContext.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/CommandQueueD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp6
-rw-r--r--Graphics/GraphicsEngineD3D12/src/GenerateMips.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp3
-rw-r--r--Graphics/GraphicsEngineD3D12/src/SamplerD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderBindingTableD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp3
-rw-r--r--Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp8
28 files changed, 57 insertions, 67 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp
index ad3027a8..da9fd65e 100644
--- a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp
@@ -63,7 +63,7 @@ public:
ID3D12Resource* pd3d12Buffer);
~BufferD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_BufferD3D12, TBufferBase)
#ifdef DILIGENT_DEVELOPMENT
void DvpVerifyDynamicAllocation(class DeviceContextD3D12Impl* pCtx) const;
@@ -120,10 +120,21 @@ private:
DescriptorHeapAllocation m_CBVDescriptorAllocation;
+ // Align the struct size to the cache line size to avoid false sharing
+ struct alignas(64) CtxDynamicData : D3D12DynamicAllocation
+ {
+ CtxDynamicData& operator=(const D3D12DynamicAllocation& Allocation)
+ {
+ *static_cast<D3D12DynamicAllocation*>(this) = Allocation;
+ return *this;
+ }
+ Uint8 Padding[64 - sizeof(D3D12DynamicAllocation)];
+ };
+ static_assert(sizeof(CtxDynamicData) == 64, "Unexpected sizeof(CtxDynamicData)");
+
friend class DeviceContextD3D12Impl;
- // Array of dynamic allocations for every device context
- // sizeof(D3D12DynamicAllocation) == 40 (x64)
- std::vector<D3D12DynamicAllocation, STDAllocatorRawMem<D3D12DynamicAllocation>> m_DynamicData;
+ // Array of dynamic allocations for every device context.
+ std::vector<CtxDynamicData, STDAllocatorRawMem<D3D12DynamicAllocation>> m_DynamicData;
};
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.hpp
index f7c41fa0..a9cd2616 100644
--- a/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/BufferViewD3D12Impl.hpp
@@ -54,7 +54,7 @@ public:
DescriptorHeapAllocation&& HandleAlloc,
bool bIsDefaultView);
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_BufferViewD3D12, TBufferViewBase)
/// Implementation of IBufferViewD3D12::GetCPUDescriptorHandle().
virtual D3D12_CPU_DESCRIPTOR_HANDLE DILIGENT_CALL_TYPE GetCPUDescriptorHandle() override final
diff --git a/Graphics/GraphicsEngineD3D12/include/CommandContext.hpp b/Graphics/GraphicsEngineD3D12/include/CommandContext.hpp
index 1d1f0082..ee9b887c 100644
--- a/Graphics/GraphicsEngineD3D12/include/CommandContext.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/CommandContext.hpp
@@ -45,13 +45,13 @@ namespace Diligent
struct DWParam
{
// clang-format off
- DWParam( FLOAT f ) : Float{f} {}
- DWParam( UINT u ) : Uint {u} {}
- DWParam( INT i ) : Int {i} {}
+ DWParam(FLOAT f) : Float{f} {}
+ DWParam(UINT u) : Uint {u} {}
+ DWParam(INT i) : Int {i} {}
- void operator= ( FLOAT f ) { Float = f; }
- void operator= ( UINT u ) { Uint = u; }
- void operator= ( INT i ) { Int = i; }
+ void operator= (FLOAT f) { Float = f; }
+ void operator= (UINT u) { Uint = u; }
+ void operator= (INT i) { Int = i; }
// clang-format on
union
@@ -143,9 +143,12 @@ public:
struct ShaderDescriptorHeaps
{
- ID3D12DescriptorHeap* pSrvCbvUavHeap;
- ID3D12DescriptorHeap* pSamplerHeap;
- ShaderDescriptorHeaps(ID3D12DescriptorHeap* _pSrvCbvUavHeap = nullptr, ID3D12DescriptorHeap* _pSamplerHeap = nullptr) :
+ ID3D12DescriptorHeap* pSrvCbvUavHeap = nullptr;
+ ID3D12DescriptorHeap* pSamplerHeap = nullptr;
+
+ ShaderDescriptorHeaps() noexcept {}
+
+ ShaderDescriptorHeaps(ID3D12DescriptorHeap* _pSrvCbvUavHeap, ID3D12DescriptorHeap* _pSamplerHeap) noexcept :
pSrvCbvUavHeap{_pSrvCbvUavHeap},
pSamplerHeap{_pSamplerHeap}
{}
diff --git a/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.hpp
index 2026c2b0..55cf6bd5 100644
--- a/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/CommandQueueD3D12Impl.hpp
@@ -46,7 +46,7 @@ public:
CommandQueueD3D12Impl(IReferenceCounters* pRefCounters, ID3D12CommandQueue* pd3d12NativeCmdQueue, ID3D12Fence* pd3d12Fence);
~CommandQueueD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_CommandQueueD3D12, TBase)
// Implementation of ICommandQueueD3D12::GetNextFenceValue().
virtual Uint64 DILIGENT_CALL_TYPE GetNextFenceValue() const override final { return m_NextFenceValue; }
diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp
index 23c78abb..6e4fa67d 100644
--- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.hpp
@@ -76,7 +76,7 @@ public:
Uint32 CommandQueueId);
~DeviceContextD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_DeviceContextD3D12, TDeviceContextBase)
/// Implementation of IDeviceContext::SetPipelineState() in Direct3D12 backend.
virtual void DILIGENT_CALL_TYPE SetPipelineState(IPipelineState* pPipelineState) override final;
diff --git a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp
index 5859fbe7..dd6e103d 100644
--- a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp
@@ -78,7 +78,7 @@ public:
ICommandQueueD3D12** ppCmdQueues) noexcept(false);
~RenderDeviceD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_RenderDeviceD3D12, TRenderDeviceBase)
/// Implementation of IRenderDevice::CreateGraphicsPipelineState() in Direct3D12 backend.
virtual void DILIGENT_CALL_TYPE CreateGraphicsPipelineState(const GraphicsPipelineStateCreateInfo& PSOCreateInfo, IPipelineState** ppPipelineState) override final;
diff --git a/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.hpp
index b581b474..e9e9b797 100644
--- a/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/SamplerD3D12Impl.hpp
@@ -52,7 +52,7 @@ public:
const SamplerDesc& SamplerDesc);
~SamplerD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_SamplerD3D12, TSamplerBase)
/// Implementation of ISamplerD3D12::GetCPUDescriptorHandle().
virtual D3D12_CPU_DESCRIPTOR_HANDLE DILIGENT_CALL_TYPE GetCPUDescriptorHandle() override { return m_Descriptor.GetCpuHandle(); }
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderBindingTableD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderBindingTableD3D12Impl.hpp
index ca1442c5..f52df84c 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderBindingTableD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderBindingTableD3D12Impl.hpp
@@ -53,7 +53,7 @@ public:
bool bIsDeviceInternal = false);
~ShaderBindingTableD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_ShaderBindingTableD3D12, TShaderBindingTableBase)
};
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp
index f1eb5c85..fe6bd148 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp
@@ -54,7 +54,7 @@ public:
bool IsPSOInternal);
~ShaderResourceBindingD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_ShaderResourceBindingD3D12, TBase)
virtual void DILIGENT_CALL_TYPE BindResources(Uint32 ShaderFlags, IResourceMapping* pResMapping, Uint32 Flags) override;
diff --git a/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.hpp
index 7a0c78db..eb603640 100644
--- a/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/SwapChainD3D12Impl.hpp
@@ -51,7 +51,7 @@ public:
const NativeWindow& Window);
~SwapChainD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_SwapChainD3D12, TSwapChainBase)
/// Implementation of ISwapChain::Present() in Direct3D12 backend.
virtual void DILIGENT_CALL_TYPE Present(Uint32 SyncInterval) override final;
diff --git a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp
index 5ba2283e..16ebbb35 100644
--- a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp
@@ -65,7 +65,7 @@ public:
ID3D12Resource* pTexture);
~TextureD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_TextureD3D12, TTextureBase)
/// Implementation of ITextureD3D12::GetD3D12Texture().
virtual ID3D12Resource* DILIGENT_CALL_TYPE GetD3D12Texture() override final { return GetD3D12Resource(); }
diff --git a/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.hpp
index 697e0132..2f8a9b41 100644
--- a/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/TextureViewD3D12Impl.hpp
@@ -57,7 +57,7 @@ public:
bool bIsDefaultView);
~TextureViewD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_TextureViewD3D12, TTextureViewBase)
/// Implementation of ITextureViewD3D12::GetCPUDescriptorHandle().
virtual D3D12_CPU_DESCRIPTOR_HANDLE DILIGENT_CALL_TYPE GetCPUDescriptorHandle() override final
diff --git a/Graphics/GraphicsEngineD3D12/include/TopLevelASD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/TopLevelASD3D12Impl.hpp
index 522fd426..ab699e0e 100644
--- a/Graphics/GraphicsEngineD3D12/include/TopLevelASD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/TopLevelASD3D12Impl.hpp
@@ -56,7 +56,7 @@ public:
ID3D12Resource* pd3d12TLAS);
~TopLevelASD3D12Impl();
- IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_TopLevelASD3D12, TTopLevelASBase);
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_TopLevelASD3D12, TTopLevelASBase)
/// Implementation of ITopLevelASD3D12D3D12::GetD3D12TLAS().
virtual ID3D12Resource* DILIGENT_CALL_TYPE GetD3D12TLAS() override final { return GetD3D12Resource(); }
diff --git a/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp
index 6d59f331..39c52e68 100644
--- a/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp
@@ -77,7 +77,8 @@ BottomLevelASD3D12Impl::BottomLevelASD3D12Impl(IReferenceCounters* pRefCoun
MaxPrimitiveCount += src.MaxPrimitiveCount;
}
- VERIFY_EXPR(MaxPrimitiveCount <= pDeviceD3D12->GetProperties().MaxPrimitivesPerBLAS);
+ DEV_CHECK_ERR(MaxPrimitiveCount <= pDeviceD3D12->GetProperties().MaxPrimitivesPerBLAS,
+ "Max primitive count (", MaxPrimitiveCount, ") exceeds device limit");
}
else if (m_Desc.pBoxes != nullptr)
{
@@ -96,14 +97,16 @@ BottomLevelASD3D12Impl::BottomLevelASD3D12Impl(IReferenceCounters* pRefCoun
MaxBoxCount += src.MaxBoxCount;
}
- VERIFY_EXPR(MaxBoxCount <= pDeviceD3D12->GetProperties().MaxPrimitivesPerBLAS);
+ DEV_CHECK_ERR(MaxBoxCount <= pDeviceD3D12->GetProperties().MaxPrimitivesPerBLAS,
+ "Max box count (", MaxBoxCount, ") exceeds device limit");
}
else
{
UNEXPECTED("Either pTriangles or pBoxes must not be null");
}
- VERIFY_EXPR(d3d12Geometries.size() <= pDeviceD3D12->GetProperties().MaxGeometriesPerBLAS);
+ DEV_CHECK_ERR(d3d12Geometries.size() <= pDeviceD3D12->GetProperties().MaxGeometriesPerBLAS,
+ "The number of geometries (", d3d12Geometries.size(), ") exceeds device limit");
d3d12BottomLevelInputs.Type = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL;
d3d12BottomLevelInputs.Flags = BuildASFlagsToD3D12ASBuildFlags(m_Desc.Flags);
@@ -170,8 +173,7 @@ BottomLevelASD3D12Impl::BottomLevelASD3D12Impl(IReferenceCounters* pRef
BottomLevelASD3D12Impl::~BottomLevelASD3D12Impl()
{
// D3D12 object can only be destroyed when it is no longer used by the GPU
- auto* pDeviceD3D12Impl = ValidatedCast<RenderDeviceD3D12Impl>(GetDevice());
- pDeviceD3D12Impl->SafeReleaseDeviceObject(std::move(m_pd3d12Resource), m_Desc.CommandQueueMask);
+ GetDevice()->SafeReleaseDeviceObject(std::move(m_pd3d12Resource), m_Desc.CommandQueueMask);
}
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp
index e17b645b..d4f048a0 100644
--- a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp
@@ -56,7 +56,7 @@ BufferD3D12Impl::BufferD3D12Impl(IReferenceCounters* pRefCounters,
m_DynamicData
(
BuffDesc.Usage == USAGE_DYNAMIC ? (1 + pRenderDeviceD3D12->GetNumDeferredContexts()) : 0,
- D3D12DynamicAllocation{},
+ CtxDynamicData{},
STD_ALLOCATOR_RAW_MEM(D3D12DynamicAllocation, GetRawAllocator(), "Allocator for vector<DynamicAllocation>")
)
// clang-format on
@@ -284,7 +284,7 @@ BufferD3D12Impl::BufferD3D12Impl(IReferenceCounters* pRefCounters,
m_DynamicData
(
BuffDesc.Usage == USAGE_DYNAMIC ? (1 + pRenderDeviceD3D12->GetNumDeferredContexts()) : 0,
- D3D12DynamicAllocation{},
+ CtxDynamicData{},
STD_ALLOCATOR_RAW_MEM(D3D12DynamicAllocation, GetRawAllocator(), "Allocator for vector<DynamicAllocation>")
)
// clang-format on
@@ -301,13 +301,9 @@ BufferD3D12Impl::BufferD3D12Impl(IReferenceCounters* pRefCounters,
BufferD3D12Impl::~BufferD3D12Impl()
{
// D3D12 object can only be destroyed when it is no longer used by the GPU
- auto* pDeviceD3D12Impl = ValidatedCast<RenderDeviceD3D12Impl>(GetDevice());
- pDeviceD3D12Impl->SafeReleaseDeviceObject(std::move(m_pd3d12Resource), m_Desc.CommandQueueMask);
+ GetDevice()->SafeReleaseDeviceObject(std::move(m_pd3d12Resource), m_Desc.CommandQueueMask);
}
-IMPLEMENT_QUERY_INTERFACE(BufferD3D12Impl, IID_BufferD3D12, TBufferBase)
-
-
void BufferD3D12Impl::CreateViewInternal(const BufferViewDesc& OrigViewDesc, IBufferView** ppView, bool bIsDefaultView)
{
VERIFY(ppView != nullptr, "Null pointer provided");
diff --git a/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp
index 731d4da2..37928028 100644
--- a/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/BufferViewD3D12Impl.cpp
@@ -51,6 +51,4 @@ BufferViewD3D12Impl::BufferViewD3D12Impl(IReferenceCounters* pRefCounters
{
}
-IMPLEMENT_QUERY_INTERFACE(BufferViewD3D12Impl, IID_BufferViewD3D12, TBufferViewBase)
-
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp b/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp
index fdb93efb..fe64d834 100644
--- a/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp
@@ -74,7 +74,7 @@ void CommandContext::Reset(CommandListManager& CmdListManager)
m_pCurGraphicsRootSignature = nullptr;
m_pCurComputeRootSignature = nullptr;
m_PendingResourceBarriers.clear();
- m_BoundDescriptorHeaps = ShaderDescriptorHeaps();
+ m_BoundDescriptorHeaps = ShaderDescriptorHeaps{};
m_DynamicGPUDescriptorAllocators = nullptr;
diff --git a/Graphics/GraphicsEngineD3D12/src/CommandQueueD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/CommandQueueD3D12Impl.cpp
index 63d19ce4..90407702 100644
--- a/Graphics/GraphicsEngineD3D12/src/CommandQueueD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/CommandQueueD3D12Impl.cpp
@@ -51,8 +51,6 @@ CommandQueueD3D12Impl::~CommandQueueD3D12Impl()
CloseHandle(m_WaitForGPUEventHandle);
}
-IMPLEMENT_QUERY_INTERFACE(CommandQueueD3D12Impl, IID_CommandQueueD3D12, TBase)
-
Uint64 CommandQueueD3D12Impl::Submit(ID3D12GraphicsCommandList* commandList)
{
std::lock_guard<std::mutex> Lock{m_QueueMtx};
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
index bf77807a..17a796b7 100644
--- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
@@ -178,8 +178,6 @@ DeviceContextD3D12Impl::~DeviceContextD3D12Impl()
}
}
-IMPLEMENT_QUERY_INTERFACE(DeviceContextD3D12Impl, IID_DeviceContextD3D12, TDeviceContextBase)
-
void DeviceContextD3D12Impl::SetPipelineState(IPipelineState* pPipelineState)
{
auto* pPipelineStateD3D12 = ValidatedCast<PipelineStateD3D12Impl>(pPipelineState);
@@ -2303,7 +2301,7 @@ void DeviceContextD3D12Impl::BuildBLAS(const BuildBLASAttribs& Attribs)
if (GeoIdx == INVALID_INDEX || Idx == INVALID_INDEX)
{
- UNEXPECTED("Failed to find geometry by name");
+ UNEXPECTED("Failed to find geometry '", SrcTris.GeometryName, '\'');
continue;
}
@@ -2375,7 +2373,7 @@ void DeviceContextD3D12Impl::BuildBLAS(const BuildBLASAttribs& Attribs)
if (GeoIdx == INVALID_INDEX || Idx == INVALID_INDEX)
{
- UNEXPECTED("Failed to find geometry by name");
+ UNEXPECTED("Failed to find geometry '", SrcBoxes.GeometryName, '\'');
continue;
}
diff --git a/Graphics/GraphicsEngineD3D12/src/GenerateMips.cpp b/Graphics/GraphicsEngineD3D12/src/GenerateMips.cpp
index 0da4470b..280cd455 100644
--- a/Graphics/GraphicsEngineD3D12/src/GenerateMips.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/GenerateMips.cpp
@@ -185,7 +185,7 @@ void GenerateMipsHelper::GenerateMips(ID3D12Device* pd3d12Device, TextureViewD3D
D3D12_DESCRIPTOR_HEAP_TYPE HeapType = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
auto DescriptorAlloc = Ctx.AllocateDynamicGPUVisibleDescriptor(HeapType, 5);
- CommandContext::ShaderDescriptorHeaps Heaps{DescriptorAlloc.GetDescriptorHeap()};
+ CommandContext::ShaderDescriptorHeaps Heaps{DescriptorAlloc.GetDescriptorHeap(), nullptr};
ComputeCtx.SetDescriptorHeaps(Heaps);
Ctx.GetCommandList()->SetComputeRootDescriptorTable(1, DescriptorAlloc.GetGpuHandle(0));
Ctx.GetCommandList()->SetComputeRootDescriptorTable(2, DescriptorAlloc.GetGpuHandle(1));
diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
index 56588dee..24b4222b 100644
--- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
@@ -564,9 +564,6 @@ void RenderDeviceD3D12Impl::TestTextureFormat(TEXTURE_FORMAT TexFormat)
}
}
-
-IMPLEMENT_QUERY_INTERFACE(RenderDeviceD3D12Impl, IID_RenderDeviceD3D12, TRenderDeviceBase)
-
template <typename PSOCreateInfoType>
void RenderDeviceD3D12Impl::CreatePipelineState(const PSOCreateInfoType& PSOCreateInfo, IPipelineState** ppPipelineState)
{
diff --git a/Graphics/GraphicsEngineD3D12/src/SamplerD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SamplerD3D12Impl.cpp
index 1002dc37..328e8857 100644
--- a/Graphics/GraphicsEngineD3D12/src/SamplerD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/SamplerD3D12Impl.cpp
@@ -63,6 +63,4 @@ SamplerD3D12Impl::~SamplerD3D12Impl()
{
}
-IMPLEMENT_QUERY_INTERFACE(SamplerD3D12Impl, IID_SamplerD3D12, TSamplerBase)
-
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderBindingTableD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderBindingTableD3D12Impl.cpp
index 0e15bd4f..8fb1515e 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderBindingTableD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderBindingTableD3D12Impl.cpp
@@ -50,6 +50,4 @@ ShaderBindingTableD3D12Impl::~ShaderBindingTableD3D12Impl()
{
}
-IMPLEMENT_QUERY_INTERFACE(ShaderBindingTableD3D12Impl, IID_ShaderBindingTableD3D12, TShaderBindingTableBase)
-
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp
index c7c3ede6..269a8572 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp
@@ -118,8 +118,6 @@ void ShaderResourceBindingD3D12Impl::Destruct()
}
}
-IMPLEMENT_QUERY_INTERFACE(ShaderResourceBindingD3D12Impl, IID_ShaderResourceBindingD3D12, TBase)
-
void ShaderResourceBindingD3D12Impl::BindResources(Uint32 ShaderFlags, IResourceMapping* pResMapping, Uint32 Flags)
{
const auto PipelineType = m_pPSO->GetDesc().PipelineType;
diff --git a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
index bcffe7d5..f69e5ce7 100644
--- a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
@@ -119,9 +119,6 @@ void SwapChainD3D12Impl::InitBuffersAndViews()
}
}
-IMPLEMENT_QUERY_INTERFACE(SwapChainD3D12Impl, IID_SwapChainD3D12, TSwapChainBase)
-
-
void SwapChainD3D12Impl::Present(Uint32 SyncInterval)
{
#if PLATFORM_UNIVERSAL_WINDOWS
diff --git a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp
index 1c15b351..358f3b4d 100644
--- a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp
@@ -407,7 +407,6 @@ TextureD3D12Impl::TextureD3D12Impl(IReferenceCounters* pRefCounters,
m_pd3d12Resource = pTexture;
SetState(InitialState);
}
-IMPLEMENT_QUERY_INTERFACE(TextureD3D12Impl, IID_TextureD3D12, TTextureBase)
void TextureD3D12Impl::CreateViewInternal(const struct TextureViewDesc& ViewDesc, ITextureView** ppView, bool bIsDefaultView)
{
@@ -512,8 +511,7 @@ void TextureD3D12Impl::CreateViewInternal(const struct TextureViewDesc& ViewDesc
TextureD3D12Impl::~TextureD3D12Impl()
{
// D3D12 object can only be destroyed when it is no longer used by the GPU
- auto* pDeviceD3D12Impl = ValidatedCast<RenderDeviceD3D12Impl>(GetDevice());
- pDeviceD3D12Impl->SafeReleaseDeviceObject(std::move(m_pd3d12Resource), m_Desc.CommandQueueMask);
+ GetDevice()->SafeReleaseDeviceObject(std::move(m_pd3d12Resource), m_Desc.CommandQueueMask);
if (m_StagingFootprints != nullptr)
{
FREE(GetRawAllocator(), m_StagingFootprints);
diff --git a/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp
index d1287c57..f8f7f6cf 100644
--- a/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp
@@ -72,6 +72,4 @@ TextureViewD3D12Impl::~TextureViewD3D12Impl()
}
}
-IMPLEMENT_QUERY_INTERFACE(TextureViewD3D12Impl, IID_TextureViewD3D12, TTextureViewBase)
-
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp
index 8202c418..cce9d2f6 100644
--- a/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp
@@ -58,7 +58,8 @@ TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounters,
d3d12TopLevelInputs.DescsLayout = D3D12_ELEMENTS_LAYOUT_ARRAY;
d3d12TopLevelInputs.NumDescs = m_Desc.MaxInstanceCount;
- VERIFY_EXPR(m_Desc.MaxInstanceCount <= pDeviceD3D12->GetProperties().MaxInstancesPerTLAS);
+ DEV_CHECK_ERR(m_Desc.MaxInstanceCount <= pDeviceD3D12->GetProperties().MaxInstancesPerTLAS,
+ "Max instance count (", m_Desc.MaxInstanceCount, ") exceeds device limit.");
pd3d12Device->GetRaytracingAccelerationStructurePrebuildInfo(&d3d12TopLevelInputs, &d3d12TopLevelPrebuildInfo);
if (d3d12TopLevelPrebuildInfo.ResultDataMaxSizeInBytes == 0)
@@ -109,7 +110,7 @@ TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounters,
d3d12SRVDesc.RaytracingAccelerationStructure.Location = GetGPUAddress();
pd3d12Device->CreateShaderResourceView(nullptr, &d3d12SRVDesc, m_DescriptorHandle.GetCpuHandle());
- DEV_CHECK_ERR(GetGPUAddress() % D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT == 0, "GPU virtual address is expect to be at least 256-byte aligned");
+ DEV_CHECK_ERR(GetGPUAddress() % D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT == 0, "GPU virtual address is expected to be at least 256-byte aligned");
SetState(RESOURCE_STATE_BUILD_AS_READ);
}
@@ -128,8 +129,7 @@ TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounte
TopLevelASD3D12Impl::~TopLevelASD3D12Impl()
{
// D3D12 object can only be destroyed when it is no longer used by the GPU
- auto* pDeviceD3D12Impl = ValidatedCast<RenderDeviceD3D12Impl>(GetDevice());
- pDeviceD3D12Impl->SafeReleaseDeviceObject(std::move(m_pd3d12Resource), m_Desc.CommandQueueMask);
+ GetDevice()->SafeReleaseDeviceObject(std::move(m_pd3d12Resource), m_Desc.CommandQueueMask);
}
} // namespace Diligent