From 5cf012cfbc7017b46912b9f59a9f76a2d4b870b3 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Wed, 27 Dec 2017 21:45:08 -0800 Subject: Reworked Common and Platform modules to break interdependenices; Replaced static const->static constexpr where appropriate --- .../GraphicsEngineD3D12/include/BufferD3D12Impl.h | 4 +- .../GraphicsEngineD3D12/include/CommandContext.h | 2 +- .../GraphicsEngineD3D12/include/DescriptorHeap.h | 4 +- .../include/DeviceContextD3D12Impl.h | 2 +- .../GraphicsEngineD3D12/include/RootSignature.h | 8 +- .../include/ShaderResourceCacheD3D12.h | 14 +-- .../include/ShaderResourceLayoutD3D12.h | 42 +++---- .../GraphicsEngineD3D12/interface/BufferD3D12.h | 4 +- .../interface/BufferViewD3D12.h | 2 +- .../interface/CommandQueueD3D12.h | 2 +- .../interface/DeviceContextD3D12.h | 4 +- .../interface/PipelineStateD3D12.h | 2 +- .../interface/RenderDeviceD3D12.h | 4 +- .../GraphicsEngineD3D12/interface/SamplerD3D12.h | 4 +- .../GraphicsEngineD3D12/interface/ShaderD3D12.h | 4 +- .../interface/ShaderResourceBindingD3D12.h | 2 +- .../GraphicsEngineD3D12/interface/SwapChainD3D12.h | 4 +- .../GraphicsEngineD3D12/interface/TextureD3D12.h | 4 +- .../interface/TextureViewD3D12.h | 4 +- .../GraphicsEngineD3D12/src/BufferD3D12Impl.cpp | 40 +++---- .../GraphicsEngineD3D12/src/CommandContext.cpp | 8 +- .../GraphicsEngineD3D12/src/CommandListManager.cpp | 2 +- .../src/D3D12TypeConversions.cpp | 8 +- .../GraphicsEngineD3D12/src/DescriptorHeap.cpp | 6 +- .../src/DeviceContextD3D12Impl.cpp | 18 +-- .../GraphicsEngineD3D12/src/DynamicUploadHeap.cpp | 6 +- .../src/PipelineStateD3D12Impl.cpp | 10 +- .../src/RenderDeviceD3D12Impl.cpp | 4 +- .../src/RenderDeviceFactoryD3D12.cpp | 2 +- Graphics/GraphicsEngineD3D12/src/RootSignature.cpp | 46 ++++---- .../src/ShaderResourceBindingD3D12Impl.cpp | 4 +- .../src/ShaderResourceCacheD3D12.cpp | 2 +- .../src/ShaderResourceLayoutD3D12.cpp | 124 ++++++++++----------- .../GraphicsEngineD3D12/src/TextureD3D12Impl.cpp | 10 +- 34 files changed, 203 insertions(+), 203 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h index 6333f112..2688dfab 100644 --- a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h @@ -71,13 +71,13 @@ public: auto *pd3d12Resource = GetD3D12Resource(); if(pd3d12Resource != nullptr) { - VERIFY(m_Desc.Usage != USAGE_DYNAMIC || (m_Desc.BindFlags | (BIND_SHADER_RESOURCE|BIND_UNORDERED_ACCESS)) != 0, "Expected non-dynamic buffer or a buffer with SRV or UAV bind flags") + VERIFY(m_Desc.Usage != USAGE_DYNAMIC || (m_Desc.BindFlags | (BIND_SHADER_RESOURCE|BIND_UNORDERED_ACCESS)) != 0, "Expected non-dynamic buffer or a buffer with SRV or UAV bind flags"); DataStartByteOffset = 0; return pd3d12Resource; } else { - VERIFY(m_Desc.Usage == USAGE_DYNAMIC, "Dynamic buffer is expected") + VERIFY(m_Desc.Usage == USAGE_DYNAMIC, "Dynamic buffer is expected"); #ifdef _DEBUG DbgVerifyDynamicAllocation(ContextId); diff --git a/Graphics/GraphicsEngineD3D12/include/CommandContext.h b/Graphics/GraphicsEngineD3D12/include/CommandContext.h index cc184872..2b7ebf08 100644 --- a/Graphics/GraphicsEngineD3D12/include/CommandContext.h +++ b/Graphics/GraphicsEngineD3D12/include/CommandContext.h @@ -139,7 +139,7 @@ protected: ID3D12RootSignature* m_pCurGraphicsRootSignature = nullptr; ID3D12RootSignature* m_pCurComputeRootSignature = nullptr; - static const int MaxPendingBarriers = 16; + static constexpr int MaxPendingBarriers = 16; std::vector > m_PendingResourceBarriers; // We must make sure that all referenced objects are alive until barriers are executed // Keeping reference to ID3D12Resource is not sufficient! diff --git a/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.h b/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.h index 9b7c404e..50385bcf 100644 --- a/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.h +++ b/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.h @@ -88,7 +88,7 @@ public: { VERIFY_EXPR(m_pAllocator != nullptr && m_pDescriptorHeap != nullptr); auto DescriptorSize = m_pAllocator->GetDescriptorSize(); - VERIFY(DescriptorSize < std::numeric_limits::max(), "DescriptorSize exceeds allowed limit") + VERIFY(DescriptorSize < std::numeric_limits::max(), "DescriptorSize exceeds allowed limit"); m_DescriptorSize = static_cast( DescriptorSize ); } @@ -139,7 +139,7 @@ public: if(!IsNull() && m_pAllocator) m_pAllocator->Free(std::move(*this)); // Allocation must have been disposed by the allocator - VERIFY(IsNull(), "Non-null descriptor is being destroyed") + VERIFY(IsNull(), "Non-null descriptor is being destroyed"); } // Returns CPU descriptor handle at the specified offset diff --git a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h index dcc2ecf5..8acbe73d 100644 --- a/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/DeviceContextD3D12Impl.h @@ -94,7 +94,7 @@ public: //void ClearShaderStateCache(); ///// Number of different shader types (Vertex, Pixel, Geometry, Domain, Hull, Compute) - //static const int NumShaderTypes = 6; + //static constexpr int NumShaderTypes = 6; void UpdateBufferRegion(class BufferD3D12Impl *pBuffD3D12, struct DynamicAllocation& Allocation, Uint64 DstOffset, Uint64 NumBytes); void UpdateBufferRegion(class BufferD3D12Impl *pBuffD3D12, const void *pData, Uint64 DstOffset, Uint64 NumBytes); diff --git a/Graphics/GraphicsEngineD3D12/include/RootSignature.h b/Graphics/GraphicsEngineD3D12/include/RootSignature.h index b0a9e2ce..eb3c99b3 100644 --- a/Graphics/GraphicsEngineD3D12/include/RootSignature.h +++ b/Graphics/GraphicsEngineD3D12/include/RootSignature.h @@ -84,7 +84,7 @@ public: m_ShaderVarType(RP.m_ShaderVarType), m_RootIndex(RP.m_RootIndex) { - VERIFY(m_RootParam.ParameterType != D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE, "Use another constructor to copy descriptor table") + VERIFY(m_RootParam.ParameterType != D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE, "Use another constructor to copy descriptor table"); } RootParameter(const RootParameter &RP, UINT NumRanges, D3D12_DESCRIPTOR_RANGE *pRanges): @@ -93,8 +93,8 @@ public: m_ShaderVarType(RP.m_ShaderVarType), m_RootIndex(RP.m_RootIndex) { - VERIFY(m_RootParam.ParameterType == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE, "Root parameter is expected to be a descriptor table") - VERIFY(NumRanges >= m_RootParam.DescriptorTable.NumDescriptorRanges, "New table must be larger than source one") + VERIFY(m_RootParam.ParameterType == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE, "Root parameter is expected to be a descriptor table"); + VERIFY(NumRanges >= m_RootParam.DescriptorTable.NumDescriptorRanges, "New table must be larger than source one"); auto &DstTbl = m_RootParam.DescriptorTable; DstTbl.NumDescriptorRanges = NumRanges; DstTbl.pDescriptorRanges = pRanges; @@ -271,7 +271,7 @@ private: RootParameter *m_pRootViews = nullptr; }; - static const Uint8 InvalidRootTableIndex = static_cast(-1); + static constexpr Uint8 InvalidRootTableIndex = static_cast(-1); // The array below contains array index of a CBV/SRV/UAV root table // in m_RootParams (NOT the Root Index!), for every variable type diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.h b/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.h index d82de76f..ab1a7488 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.h +++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.h @@ -117,7 +117,7 @@ public: void Initialize(IMemoryAllocator &MemAllocator, Uint32 NumTables, Uint32 TableSizes[]); - static const Uint32 InvalidDescriptorOffset = static_cast(-1); + static constexpr Uint32 InvalidDescriptorOffset = static_cast(-1); //http://diligentgraphics.com/diligent-engine/architecture/d3d12/shader-resource-cache#Cache-Structure struct Resource @@ -141,8 +141,8 @@ public: const D3D12_DESCRIPTOR_HEAP_TYPE dbgDescriptorHeapType, const SHADER_TYPE dbgRefShaderType) { - VERIFY(m_dbgHeapType == dbgDescriptorHeapType, "Incosistent descriptor heap type" ) - VERIFY(m_dbgShaderType == dbgRefShaderType, "Incosistent shader type" ) + VERIFY(m_dbgHeapType == dbgDescriptorHeapType, "Incosistent descriptor heap type" ); + VERIFY(m_dbgShaderType == dbgRefShaderType, "Incosistent shader type" ); VERIFY(OffsetFromTableStart < m_NumResources, "Root table at index is not large enough to store descriptor at offset ", OffsetFromTableStart ); return m_pResources[OffsetFromTableStart]; @@ -197,18 +197,18 @@ public: { if(Tbl.DbgGetHeapType() == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV) { - VERIFY(Tbl.m_TableStartOffset == NumSrvCbvUavDescriptors, "Descriptor space allocation is not continuous") + VERIFY(Tbl.m_TableStartOffset == NumSrvCbvUavDescriptors, "Descriptor space allocation is not continuous"); NumSrvCbvUavDescriptors = std::max(NumSrvCbvUavDescriptors, Tbl.m_TableStartOffset + Tbl.GetSize()); } else { - VERIFY(Tbl.m_TableStartOffset == NumSamplerDescriptors, "Descriptor space allocation is not continuous") + VERIFY(Tbl.m_TableStartOffset == NumSamplerDescriptors, "Descriptor space allocation is not continuous"); NumSamplerDescriptors = std::max(NumSamplerDescriptors, Tbl.m_TableStartOffset + Tbl.GetSize()); } } } - VERIFY(NumSrvCbvUavDescriptors == CbcSrvUavHeapSpace.GetNumHandles() || NumSrvCbvUavDescriptors == 0 && CbcSrvUavHeapSpace.GetCpuHandle(0).ptr == 0, "Unexpected descriptor heap allocation size" ) - VERIFY(NumSamplerDescriptors == SamplerHeapSpace.GetNumHandles() || NumSamplerDescriptors == 0 && SamplerHeapSpace.GetCpuHandle(0).ptr == 0, "Unexpected descriptor heap allocation size" ) + VERIFY(NumSrvCbvUavDescriptors == CbcSrvUavHeapSpace.GetNumHandles() || NumSrvCbvUavDescriptors == 0 && CbcSrvUavHeapSpace.GetCpuHandle(0).ptr == 0, "Unexpected descriptor heap allocation size" ); + VERIFY(NumSamplerDescriptors == SamplerHeapSpace.GetNumHandles() || NumSamplerDescriptors == 0 && SamplerHeapSpace.GetCpuHandle(0).ptr == 0, "Unexpected descriptor heap allocation size" ); #endif m_CbvSrvUavHeapSpace = std::move(CbcSrvUavHeapSpace); diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.h b/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.h index 038fd041..1300001b 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.h +++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.h @@ -165,17 +165,17 @@ public: SRV_CBV_UAV& operator = (const SRV_CBV_UAV&) = delete; SRV_CBV_UAV& operator = (SRV_CBV_UAV&&) = delete; - static const Uint32 ResTypeBits = 3; - static const Uint32 RootIndBits = 16-ResTypeBits; - static const Uint32 RootIndMask = (1 << RootIndBits)-1; - static const Uint32 ResTypeMask = (1 << ResTypeBits)-1; + static constexpr Uint32 ResTypeBits = 3; + static constexpr Uint32 RootIndBits = 16-ResTypeBits; + static constexpr Uint32 RootIndMask = (1 << RootIndBits)-1; + static constexpr Uint32 ResTypeMask = (1 << ResTypeBits)-1; - static const Uint16 InvalidRootIndex = RootIndMask; - static const Uint16 MaxRootIndex = RootIndMask-1; + static constexpr Uint16 InvalidRootIndex = RootIndMask; + static constexpr Uint16 MaxRootIndex = RootIndMask-1; - static const Uint32 InvalidSamplerId = 0xFFFF; - static const Uint32 MaxSamplerId = InvalidSamplerId-1; - static const Uint32 InvalidOffset = static_cast(-1); + static constexpr Uint32 InvalidSamplerId = 0xFFFF; + static constexpr Uint32 MaxSamplerId = InvalidSamplerId-1; + static constexpr Uint32 InvalidOffset = static_cast(-1); static_assert( static_cast(CachedResourceType::NumTypes) <= ResTypeMask, "3 bits is not enough to store CachedResourceType"); @@ -189,10 +189,10 @@ public: OffsetFromTableStart(rhs.OffsetFromTableStart), ShaderVariableD3DBase(ParentLayout, rhs.Attribs) { - VERIFY(SamId == InvalidSamplerId || SamId <= MaxSamplerId, "Sampler id exceeds max allowed value (", MaxSamplerId, ")" ) + VERIFY(SamId == InvalidSamplerId || SamId <= MaxSamplerId, "Sampler id exceeds max allowed value (", MaxSamplerId, ")" ); VERIFY(rhs.m_ParentResLayout.m_pResources == m_ParentResLayout.m_pResources, "Incosistent resource references"); - VERIFY(IsValidOffset(), "Offset must be valid" ) - VERIFY(IsValidRootIndex(), "Root index must be valid" ) + VERIFY(IsValidOffset(), "Offset must be valid" ); + VERIFY(IsValidRootIndex(), "Root index must be valid" ); } SRV_CBV_UAV(ShaderResourceLayoutD3D12 &ParentLayout, @@ -206,9 +206,9 @@ public: OffsetFromTableStart(_OffsetFromTableStart), ShaderVariableD3DBase(ParentLayout, _Attribs) { - VERIFY(RootIndex == InvalidRootIndex || RootIndex <= MaxRootIndex, "Root index exceeds max allowed value (", MaxRootIndex, ")" ) - VERIFY(IsValidOffset(), "Offset must be valid" ) - VERIFY(SamplerId == InvalidSamplerId || SamplerId <= MaxSamplerId, "Sampler id exceeds max allowed value (", MaxSamplerId, ")" ) + VERIFY(RootIndex == InvalidRootIndex || RootIndex <= MaxRootIndex, "Root index exceeds max allowed value (", MaxRootIndex, ")" ); + VERIFY(IsValidOffset(), "Offset must be valid" ); + VERIFY(SamplerId == InvalidSamplerId || SamplerId <= MaxSamplerId, "Sampler id exceeds max allowed value (", MaxSamplerId, ")" ); } bool IsBound(Uint32 ArrayIndex); @@ -275,8 +275,8 @@ public: const D3DShaderResourceAttribs &Attribs; ShaderResourceLayoutD3D12 &m_ParentResLayout; - static const Uint32 InvalidRootIndex = static_cast(-1); - static const Uint32 InvalidOffset = static_cast(-1); + static constexpr Uint32 InvalidRootIndex = static_cast(-1); + static constexpr Uint32 InvalidOffset = static_cast(-1); const Uint32 RootIndex; const Uint32 OffsetFromTableStart; @@ -288,8 +288,8 @@ public: OffsetFromTableStart(Sam.OffsetFromTableStart) { VERIFY(Sam.m_ParentResLayout.m_pResources == m_ParentResLayout.m_pResources, "Incosistent resource references"); - VERIFY(IsValidRootIndex(), "Root index must be valid" ) - VERIFY(IsValidOffset(), "Offset must be valid" ) + VERIFY(IsValidRootIndex(), "Root index must be valid" ); + VERIFY(IsValidOffset(), "Offset must be valid" ); } Sampler(ShaderResourceLayoutD3D12 &ParentResLayout, const D3DShaderResourceAttribs &_Attribs, Uint32 _RootIndex, Uint32 _OffsetFromTableStart) : @@ -298,8 +298,8 @@ public: Attribs(_Attribs), m_ParentResLayout(ParentResLayout) { - VERIFY(IsValidRootIndex(), "Root index must be valid" ) - VERIFY(IsValidOffset(), "Offset must be valid" ) + VERIFY(IsValidRootIndex(), "Root index must be valid" ); + VERIFY(IsValidOffset(), "Offset must be valid" ); } bool IsValidRootIndex()const{return RootIndex != InvalidRootIndex;} diff --git a/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h b/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h index 1065446a..09a30f0f 100644 --- a/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h @@ -32,11 +32,11 @@ namespace Diligent { // {3E9B15ED-A289-48DC-8214-C6E3E6177378} -static const INTERFACE_ID IID_BufferD3D12 = +static constexpr INTERFACE_ID IID_BufferD3D12 = { 0x3e9b15ed, 0xa289, 0x48dc, { 0x82, 0x14, 0xc6, 0xe3, 0xe6, 0x17, 0x73, 0x78 } }; /// Interface to the buffer object implemented in D3D12 -class IBufferD3D12 : public Diligent::IBuffer +class IBufferD3D12 : public IBuffer { public: diff --git a/Graphics/GraphicsEngineD3D12/interface/BufferViewD3D12.h b/Graphics/GraphicsEngineD3D12/interface/BufferViewD3D12.h index f46c7cae..af87d9ee 100644 --- a/Graphics/GraphicsEngineD3D12/interface/BufferViewD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/BufferViewD3D12.h @@ -32,7 +32,7 @@ namespace Diligent { // {09643F2F-40D4-4076-B086-9E5CDC2CC4FC} -static const Diligent::INTERFACE_ID IID_BufferViewD3D12 = +static constexpr INTERFACE_ID IID_BufferViewD3D12 = { 0x9643f2f, 0x40d4, 0x4076, { 0xb0, 0x86, 0x9e, 0x5c, 0xdc, 0x2c, 0xc4, 0xfc } }; /// Interface to the buffer view object implemented in D3D12 diff --git a/Graphics/GraphicsEngineD3D12/interface/CommandQueueD3D12.h b/Graphics/GraphicsEngineD3D12/interface/CommandQueueD3D12.h index f78ce562..d1084002 100644 --- a/Graphics/GraphicsEngineD3D12/interface/CommandQueueD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/CommandQueueD3D12.h @@ -30,7 +30,7 @@ namespace Diligent { // {D89693CE-F3F4-44B5-B7EF-24115AAD085E} -static const Diligent::INTERFACE_ID IID_CommandQueueD3D12 = +static constexpr INTERFACE_ID IID_CommandQueueD3D12 = { 0xd89693ce, 0xf3f4, 0x44b5, { 0xb7, 0xef, 0x24, 0x11, 0x5a, 0xad, 0x8, 0x5e } }; /// Command queue interface diff --git a/Graphics/GraphicsEngineD3D12/interface/DeviceContextD3D12.h b/Graphics/GraphicsEngineD3D12/interface/DeviceContextD3D12.h index 372329c7..a04db3d2 100644 --- a/Graphics/GraphicsEngineD3D12/interface/DeviceContextD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/DeviceContextD3D12.h @@ -32,11 +32,11 @@ namespace Diligent { // {DDE9E3AB-5109-4026-92B7-F5E7EC83E21E} -static const Diligent::INTERFACE_ID IID_DeviceContextD3D12 = +static constexpr INTERFACE_ID IID_DeviceContextD3D12 = { 0xdde9e3ab, 0x5109, 0x4026, { 0x92, 0xb7, 0xf5, 0xe7, 0xec, 0x83, 0xe2, 0x1e } }; /// Interface to the device context object implemented in D3D12 -class IDeviceContextD3D12 : public Diligent::IDeviceContext +class IDeviceContextD3D12 : public IDeviceContext { public: diff --git a/Graphics/GraphicsEngineD3D12/interface/PipelineStateD3D12.h b/Graphics/GraphicsEngineD3D12/interface/PipelineStateD3D12.h index ae94cce0..b41c379c 100644 --- a/Graphics/GraphicsEngineD3D12/interface/PipelineStateD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/PipelineStateD3D12.h @@ -32,7 +32,7 @@ namespace Diligent { // {33C9BE4B-6F23-4F83-A665-5AC1836DF35A} -static const INTERFACE_ID IID_PipelineStateD3D12 = +static constexpr INTERFACE_ID IID_PipelineStateD3D12 = { 0x33c9be4b, 0x6f23, 0x4f83, { 0xa6, 0x65, 0x5a, 0xc1, 0x83, 0x6d, 0xf3, 0x5a } }; diff --git a/Graphics/GraphicsEngineD3D12/interface/RenderDeviceD3D12.h b/Graphics/GraphicsEngineD3D12/interface/RenderDeviceD3D12.h index d5a72c8c..3a4d8741 100644 --- a/Graphics/GraphicsEngineD3D12/interface/RenderDeviceD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/RenderDeviceD3D12.h @@ -31,11 +31,11 @@ namespace Diligent { // {C7987C98-87FE-4309-AE88-E98F044B00F6} -static const Diligent::INTERFACE_ID IID_RenderDeviceD3D12 = +static constexpr INTERFACE_ID IID_RenderDeviceD3D12 = { 0xc7987c98, 0x87fe, 0x4309, { 0xae, 0x88, 0xe9, 0x8f, 0x4, 0x4b, 0x0, 0xf6 } }; /// Interface to the render device object implemented in D3D12 -class IRenderDeviceD3D12 : public Diligent::IRenderDevice +class IRenderDeviceD3D12 : public IRenderDevice { public: diff --git a/Graphics/GraphicsEngineD3D12/interface/SamplerD3D12.h b/Graphics/GraphicsEngineD3D12/interface/SamplerD3D12.h index 2dec2654..bd677b33 100644 --- a/Graphics/GraphicsEngineD3D12/interface/SamplerD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/SamplerD3D12.h @@ -32,11 +32,11 @@ namespace Diligent { // {31A3BFAF-738E-4D8C-AD18-B021C5D948DD} -static const Diligent::INTERFACE_ID IID_SamplerD3D12 = +static constexpr INTERFACE_ID IID_SamplerD3D12 = { 0x31a3bfaf, 0x738e, 0x4d8c, { 0xad, 0x18, 0xb0, 0x21, 0xc5, 0xd9, 0x48, 0xdd } }; /// Interface to the sampler object implemented in D3D12 -class ISamplerD3D12 : public Diligent::ISampler +class ISamplerD3D12 : public ISampler { public: diff --git a/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h b/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h index c8bca697..bbeb5b37 100644 --- a/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/ShaderD3D12.h @@ -32,11 +32,11 @@ namespace Diligent { // {C059B160-7F31-4029-943D-0996B98EE79A} -static const Diligent::INTERFACE_ID IID_ShaderD3D12 = +static constexpr INTERFACE_ID IID_ShaderD3D12 = { 0xc059b160, 0x7f31, 0x4029, { 0x94, 0x3d, 0x9, 0x96, 0xb9, 0x8e, 0xe7, 0x9a } }; /// Interface to the shader object implemented in D3D12 -class IShaderD3D12 : public Diligent::IShader +class IShaderD3D12 : public IShader { public: diff --git a/Graphics/GraphicsEngineD3D12/interface/ShaderResourceBindingD3D12.h b/Graphics/GraphicsEngineD3D12/interface/ShaderResourceBindingD3D12.h index 27162053..0a562639 100644 --- a/Graphics/GraphicsEngineD3D12/interface/ShaderResourceBindingD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/ShaderResourceBindingD3D12.h @@ -32,7 +32,7 @@ namespace Diligent { // {70DD5C7C-81FA-4D9A-942F-D1B91423FAAC} -static const Diligent::INTERFACE_ID IID_ShaderResourceBindingD3D12 = +static constexpr INTERFACE_ID IID_ShaderResourceBindingD3D12 = { 0x70dd5c7c, 0x81fa, 0x4d9a, { 0x94, 0x2f, 0xd1, 0xb9, 0x14, 0x23, 0xfa, 0xac } }; /// Shader resource binding interface diff --git a/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h b/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h index 3ec24ed0..dec15615 100644 --- a/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/SwapChainD3D12.h @@ -34,11 +34,11 @@ namespace Diligent { // {C9F8384D-A45E-4970-8447-394177E5B0EE} -static const Diligent::INTERFACE_ID IID_SwapChainD3D12 = +static constexpr INTERFACE_ID IID_SwapChainD3D12 = { 0xc9f8384d, 0xa45e, 0x4970, { 0x84, 0x47, 0x39, 0x41, 0x77, 0xe5, 0xb0, 0xee } }; /// Interface to the swap chain object implemented in D3D12 -class ISwapChainD3D12 : public Diligent::ISwapChain +class ISwapChainD3D12 : public ISwapChain { public: diff --git a/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h b/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h index 1c7d3122..0646b115 100644 --- a/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h @@ -32,11 +32,11 @@ namespace Diligent { // {CF5522EF-8116-4D76-ADF1-5CC8FB31FF66} -static const Diligent::INTERFACE_ID IID_TextureD3D12 = +static constexpr INTERFACE_ID IID_TextureD3D12 = { 0xcf5522ef, 0x8116, 0x4d76, { 0xad, 0xf1, 0x5c, 0xc8, 0xfb, 0x31, 0xff, 0x66 } }; /// Interface to the texture object implemented in D3D11 -class ITextureD3D12 : public Diligent::ITexture +class ITextureD3D12 : public ITexture { public: diff --git a/Graphics/GraphicsEngineD3D12/interface/TextureViewD3D12.h b/Graphics/GraphicsEngineD3D12/interface/TextureViewD3D12.h index 8c65142f..30f5b791 100644 --- a/Graphics/GraphicsEngineD3D12/interface/TextureViewD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/TextureViewD3D12.h @@ -32,11 +32,11 @@ namespace Diligent { // {BDFBD325-0699-4720-BC0E-BF84086EC033} -static const Diligent::INTERFACE_ID IID_TextureViewD3D12 = +static constexpr INTERFACE_ID IID_TextureViewD3D12 = { 0xbdfbd325, 0x699, 0x4720, { 0xbc, 0xe, 0xbf, 0x84, 0x8, 0x6e, 0xc0, 0x33 } }; /// Interface to the texture view object implemented in D3D11 -class ITextureViewD3D12 : public Diligent::ITextureView +class ITextureViewD3D12 : public ITextureView { public: diff --git a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp index 1e1ba5a7..a976d22c 100644 --- a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp @@ -129,7 +129,7 @@ BufferD3D12Impl :: BufferD3D12Impl(IReferenceCounters *pRefCounters, auto hr = pd3d12Device->CreateCommittedResource( &HeapProps, D3D12_HEAP_FLAG_NONE, &D3D12BuffDesc, m_UsageState, nullptr, __uuidof(m_pd3d12Resource), reinterpret_cast(static_cast(&m_pd3d12Resource)) ); if(FAILED(hr)) - LOG_ERROR_AND_THROW("Failed to create D3D12 buffer") + LOG_ERROR_AND_THROW("Failed to create D3D12 buffer"); if( *m_Desc.Name != 0) m_pd3d12Resource->SetName(WidenString(m_Desc.Name).c_str()); @@ -149,12 +149,12 @@ BufferD3D12Impl :: BufferD3D12Impl(IReferenceCounters *pRefCounters, &D3D12BuffDesc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, __uuidof(UploadBuffer), reinterpret_cast(static_cast(&UploadBuffer)) ); if(FAILED(hr)) - LOG_ERROR_AND_THROW("Failed to create uload buffer") + LOG_ERROR_AND_THROW("Failed to create uload buffer"); void* DestAddress = nullptr; hr = UploadBuffer->Map(0, nullptr, &DestAddress); if(FAILED(hr)) - LOG_ERROR_AND_THROW("Failed to map uload buffer") + LOG_ERROR_AND_THROW("Failed to map uload buffer"); memcpy(DestAddress, BuffData.pData, BuffData.DataSize); UploadBuffer->Unmap(0, nullptr); @@ -202,22 +202,22 @@ BufferD3D12Impl :: BufferD3D12Impl(IReferenceCounters *pRefCounters, static BufferDesc BufferDescFromD3D12Resource(BufferDesc BuffDesc, ID3D12Resource *pd3d12Buffer) { - VERIFY(BuffDesc.Usage != USAGE_DYNAMIC, "Dynamic buffers cannot be attached to native d3d12 resource") + VERIFY(BuffDesc.Usage != USAGE_DYNAMIC, "Dynamic buffers cannot be attached to native d3d12 resource"); auto D3D12BuffDesc = pd3d12Buffer->GetDesc(); - VERIFY(D3D12BuffDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER, "D3D12 resource is not a buffer") + VERIFY(D3D12BuffDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER, "D3D12 resource is not a buffer"); - VERIFY(BuffDesc.uiSizeInBytes == 0 || BuffDesc.uiSizeInBytes == D3D12BuffDesc.Width, "Buffer size specified by the BufferDesc (", BuffDesc.uiSizeInBytes,") does not match d3d12 resource size (", D3D12BuffDesc.Width, ")" ) + VERIFY(BuffDesc.uiSizeInBytes == 0 || BuffDesc.uiSizeInBytes == D3D12BuffDesc.Width, "Buffer size specified by the BufferDesc (", BuffDesc.uiSizeInBytes,") does not match d3d12 resource size (", D3D12BuffDesc.Width, ")" ); BuffDesc.uiSizeInBytes = static_cast( D3D12BuffDesc.Width ); if (D3D12BuffDesc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) { - VERIFY(BuffDesc.BindFlags == 0 || (BuffDesc.BindFlags & BIND_UNORDERED_ACCESS), "BIND_UNORDERED_ACCESS flag is not specified by the BufferDesc, while d3d12 resource was created with D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS flag") + VERIFY(BuffDesc.BindFlags == 0 || (BuffDesc.BindFlags & BIND_UNORDERED_ACCESS), "BIND_UNORDERED_ACCESS flag is not specified by the BufferDesc, while d3d12 resource was created with D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS flag"); BuffDesc.BindFlags |= BIND_UNORDERED_ACCESS; } if (D3D12BuffDesc.Flags & D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE) { - VERIFY( !(BuffDesc.BindFlags & BIND_SHADER_RESOURCE), "BIND_SHADER_RESOURCE flag is specified by the BufferDesc, while d3d12 resource was created with D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE flag") + VERIFY( !(BuffDesc.BindFlags & BIND_SHADER_RESOURCE), "BIND_SHADER_RESOURCE flag is specified by the BufferDesc, while d3d12 resource was created with D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE flag"); BuffDesc.BindFlags &= ~BIND_SHADER_RESOURCE; } @@ -225,7 +225,7 @@ static BufferDesc BufferDescFromD3D12Resource(BufferDesc BuffDesc, ID3D12Resourc { if(BuffDesc.Mode == BUFFER_MODE_STRUCTURED) { - VERIFY(BuffDesc.ElementByteStride != 0, "Element byte stride cannot be 0 for a structured buffer") + VERIFY(BuffDesc.ElementByteStride != 0, "Element byte stride cannot be 0 for a structured buffer"); } else if(BuffDesc.Mode == BUFFER_MODE_FORMATTED) { @@ -234,7 +234,7 @@ static BufferDesc BufferDescFromD3D12Resource(BufferDesc BuffDesc, ID3D12Resourc } else { - UNEXPECTED("Buffer mode must be structured or formatted") + UNEXPECTED("Buffer mode must be structured or formatted"); } } @@ -301,7 +301,7 @@ void BufferD3D12Impl :: Map(IDeviceContext *pContext, MAP_TYPE MapType, Uint32 M auto *pDeviceD3D12 = ValidatedCast(GetDevice()); pDeviceD3D12->IdleGPU(false); - VERIFY(m_Desc.Usage == USAGE_CPU_ACCESSIBLE, "Buffer must be created as USAGE_CPU_ACCESSIBLE to be mapped for reading") + VERIFY(m_Desc.Usage == USAGE_CPU_ACCESSIBLE, "Buffer must be created as USAGE_CPU_ACCESSIBLE to be mapped for reading"); D3D12_RANGE MapRange; MapRange.Begin = 0; MapRange.End = m_Desc.uiSizeInBytes; @@ -311,7 +311,7 @@ void BufferD3D12Impl :: Map(IDeviceContext *pContext, MAP_TYPE MapType, Uint32 M { if (m_Desc.Usage == USAGE_CPU_ACCESSIBLE) { - VERIFY(m_pd3d12Resource != nullptr, "USAGE_CPU_ACCESSIBLE buffer mapped for writing must intialize D3D12 resource") + VERIFY(m_pd3d12Resource != nullptr, "USAGE_CPU_ACCESSIBLE buffer mapped for writing must intialize D3D12 resource"); if (MapFlags & MAP_FLAG_DISCARD) { @@ -320,7 +320,7 @@ void BufferD3D12Impl :: Map(IDeviceContext *pContext, MAP_TYPE MapType, Uint32 M } else if (m_Desc.Usage == USAGE_DYNAMIC) { - VERIFY(MapFlags & MAP_FLAG_DISCARD, "D3D12 buffer must be mapped for writing with MAP_FLAG_DISCARD flag") + VERIFY(MapFlags & MAP_FLAG_DISCARD, "D3D12 buffer must be mapped for writing with MAP_FLAG_DISCARD flag"); auto *pCtxD3D12 = ValidatedCast(pContext); auto ContextId = pDeviceContextD3D12->GetContextId(); m_DynamicData[ContextId] = pCtxD3D12->AllocateDynamicSpace(m_Desc.uiSizeInBytes); @@ -328,16 +328,16 @@ void BufferD3D12Impl :: Map(IDeviceContext *pContext, MAP_TYPE MapType, Uint32 M } else { - LOG_ERROR("Only USAGE_DYNAMIC and USAGE_CPU_ACCESSIBLE D3D12 buffers can be mapped for writing") + LOG_ERROR("Only USAGE_DYNAMIC and USAGE_CPU_ACCESSIBLE D3D12 buffers can be mapped for writing"); } } else if(MapType == MAP_READ_WRITE) { - LOG_ERROR("MAP_READ_WRITE is not supported on D3D12") + LOG_ERROR("MAP_READ_WRITE is not supported on D3D12"); } else { - LOG_ERROR("Only MAP_WRITE_DISCARD and MAP_READ are currently implemented in D3D12") + LOG_ERROR("Only MAP_WRITE_DISCARD and MAP_READ are currently implemented in D3D12"); } } @@ -366,12 +366,12 @@ void BufferD3D12Impl::Unmap( IDeviceContext *pContext, MAP_TYPE MapType, Uint32 { if (m_Desc.Usage == USAGE_CPU_ACCESSIBLE) { - VERIFY(m_pd3d12Resource != nullptr, "USAGE_CPU_ACCESSIBLE buffer mapped for writing must intialize D3D12 resource") + VERIFY(m_pd3d12Resource != nullptr, "USAGE_CPU_ACCESSIBLE buffer mapped for writing must intialize D3D12 resource"); m_pd3d12Resource->Unmap(0, nullptr); } else if (m_Desc.Usage == USAGE_DYNAMIC) { - VERIFY(MapFlags & MAP_FLAG_DISCARD, "D3D12 buffer must be mapped for writing with MAP_FLAG_DISCARD flag") + VERIFY(MapFlags & MAP_FLAG_DISCARD, "D3D12 buffer must be mapped for writing with MAP_FLAG_DISCARD flag"); // Copy data into the resource if (m_pd3d12Resource) { @@ -422,7 +422,7 @@ void BufferD3D12Impl::CreateViewInternal( const BufferViewDesc &OrigViewDesc, IB catch( const std::runtime_error & ) { const auto *ViewTypeName = GetBufferViewTypeLiteralName(OrigViewDesc.ViewType); - LOG_ERROR("Failed to create view \"", OrigViewDesc.Name ? OrigViewDesc.Name : "", "\" (", ViewTypeName, ") for buffer \"", m_Desc.Name, "\"" ) + LOG_ERROR("Failed to create view \"", OrigViewDesc.Name ? OrigViewDesc.Name : "", "\" (", ViewTypeName, ") for buffer \"", m_Desc.Name, "\"" ); } } @@ -464,7 +464,7 @@ void BufferD3D12Impl::DbgVerifyDynamicAllocation(Uint32 ContextId) VERIFY(m_DynamicData[ContextId].GPUAddress != 0, "Dynamic buffer must be mapped before the first use"); auto CurrentFrame = ValidatedCast(GetDevice())->GetCurrentFrameNumber(); VERIFY(m_DynamicData[ContextId].FrameNum == CurrentFrame, "Dynamic allocation is out-of-date. Dynamic buffer \"", m_Desc.Name, "\" must be mapped in the same frame it is used."); - VERIFY(GetState() == D3D12_RESOURCE_STATE_GENERIC_READ, "Dynamic buffers are expected to always be in D3D12_RESOURCE_STATE_GENERIC_READ state") + VERIFY(GetState() == D3D12_RESOURCE_STATE_GENERIC_READ, "Dynamic buffers are expected to always be in D3D12_RESOURCE_STATE_GENERIC_READ state"); } #endif diff --git a/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp b/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp index 1219abaf..a39a5fed 100644 --- a/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp +++ b/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp @@ -62,7 +62,7 @@ void CommandContext::Reset( CommandListManager& CmdListManager ) // We only call Reset() on previously freed contexts. The command list persists, but we need to // request a new allocator if there is none // The allocator may not be null if the command context was previously disposed without being executed - VERIFY_EXPR(m_pCommandList != nullptr) + VERIFY_EXPR(m_pCommandList != nullptr); if( !m_pCurrentAllocator ) { CmdListManager.RequestAllocator(&m_pCurrentAllocator); @@ -199,8 +199,8 @@ void CommandContext::TransitionResource(IBufferD3D12 *pBuffer, D3D12_RESOURCE_ST // D3D12_RESOURCE_STATE_GENERIC_READ state if(pBuffD3D12->GetDesc().Usage == USAGE_DYNAMIC && (pBuffD3D12->GetDesc().BindFlags & (BIND_SHADER_RESOURCE|BIND_UNORDERED_ACCESS)) == 0) { - VERIFY(pBuffD3D12->GetState() == D3D12_RESOURCE_STATE_GENERIC_READ, "Dynamic buffers that cannot be bound as SRV or UAV are expected to always be in D3D12_RESOURCE_STATE_GENERIC_READ state") - VERIFY( (NewState & D3D12_RESOURCE_STATE_GENERIC_READ) == NewState, "Dynamic buffers can only transition to one of D3D12_RESOURCE_STATE_GENERIC_READ states") + VERIFY(pBuffD3D12->GetState() == D3D12_RESOURCE_STATE_GENERIC_READ, "Dynamic buffers that cannot be bound as SRV or UAV are expected to always be in D3D12_RESOURCE_STATE_GENERIC_READ state"); + VERIFY( (NewState & D3D12_RESOURCE_STATE_GENERIC_READ) == NewState, "Dynamic buffers can only transition to one of D3D12_RESOURCE_STATE_GENERIC_READ states"); } #endif @@ -208,7 +208,7 @@ void CommandContext::TransitionResource(IBufferD3D12 *pBuffer, D3D12_RESOURCE_ST #ifdef _DEBUG if(pBuffD3D12->GetDesc().Usage == USAGE_DYNAMIC && (pBuffD3D12->GetDesc().BindFlags & (BIND_SHADER_RESOURCE|BIND_UNORDERED_ACCESS)) == 0) - VERIFY(pBuffD3D12->GetState() == D3D12_RESOURCE_STATE_GENERIC_READ, "Dynamic buffers without SRV/UAV bind flag are expected to never transition from D3D12_RESOURCE_STATE_GENERIC_READ state") + VERIFY(pBuffD3D12->GetState() == D3D12_RESOURCE_STATE_GENERIC_READ, "Dynamic buffers without SRV/UAV bind flag are expected to never transition from D3D12_RESOURCE_STATE_GENERIC_READ state"); #endif } diff --git a/Graphics/GraphicsEngineD3D12/src/CommandListManager.cpp b/Graphics/GraphicsEngineD3D12/src/CommandListManager.cpp index 2657200a..5ea3eaa3 100644 --- a/Graphics/GraphicsEngineD3D12/src/CommandListManager.cpp +++ b/Graphics/GraphicsEngineD3D12/src/CommandListManager.cpp @@ -88,7 +88,7 @@ void CommandListManager::RequestAllocator(ID3D12CommandAllocator** ppAllocator) { auto *pd3d12Device = m_pDeviceD3D12->GetD3D12Device(); auto hr = pd3d12Device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(*ppAllocator), reinterpret_cast(ppAllocator)); - VERIFY(SUCCEEDED(hr), "Failed to create command allocator") + VERIFY(SUCCEEDED(hr), "Failed to create command allocator"); wchar_t AllocatorName[32]; swprintf(AllocatorName, _countof(AllocatorName), L"Cmd list allocator %ld", Atomics::AtomicIncrement(m_NumAllocators)-1); (*ppAllocator)->SetName(AllocatorName); diff --git a/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp b/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp index f50107f9..32b124c7 100644 --- a/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp +++ b/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp @@ -103,7 +103,7 @@ D3D12_LOGIC_OP LogicOperationToD3D12LogicOp( LOGIC_OPERATION lo ) } else { - UNEXPECTED("Incorrect blend factor (", lo, ")" ) + UNEXPECTED("Incorrect blend factor (", lo, ")" ); return static_cast( 0 ); } } @@ -268,7 +268,7 @@ void BufferViewDesc_to_D3D12_SRV_DESC(const BufferDesc &BuffDesc, const BufferVi BufferViewDesc_to_D3D_SRV_DESC(BuffDesc, SRVDesc, D3D12SRVDesc); D3D12SRVDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; D3D12SRVDesc.Buffer.Flags = D3D12_BUFFER_SRV_FLAG_NONE; - VERIFY_EXPR(BuffDesc.BindFlags & BIND_SHADER_RESOURCE) + VERIFY_EXPR(BuffDesc.BindFlags & BIND_SHADER_RESOURCE); if (BuffDesc.Mode == BUFFER_MODE_STRUCTURED) D3D12SRVDesc.Buffer.StructureByteStride = BuffDesc.ElementByteStride; } @@ -277,7 +277,7 @@ void BufferViewDesc_to_D3D12_UAV_DESC(const BufferDesc &BuffDesc, const BufferVi { BufferViewDesc_to_D3D_UAV_DESC(BuffDesc, UAVDesc, D3D12UAVDesc); D3D12UAVDesc.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_NONE; - VERIFY_EXPR(BuffDesc.BindFlags & BIND_UNORDERED_ACCESS) + VERIFY_EXPR(BuffDesc.BindFlags & BIND_UNORDERED_ACCESS); if (BuffDesc.Mode == BUFFER_MODE_STRUCTURED) D3D12UAVDesc.Buffer.StructureByteStride = BuffDesc.ElementByteStride; } @@ -293,7 +293,7 @@ D3D12_STATIC_BORDER_COLOR BorderColorToD3D12StaticBorderColor(const Float32 Bord StaticBorderColor = D3D12_STATIC_BORDER_COLOR_OPAQUE_WHITE; else { - LOG_ERROR_MESSAGE("Static samplers only allow transparent black (0,0,0,1), opaque black (0,0,0,0) or opaque white (1,1,1,0) as border colors.") + LOG_ERROR_MESSAGE("Static samplers only allow transparent black (0,0,0,1), opaque black (0,0,0,0) or opaque white (1,1,1,0) as border colors."); } return StaticBorderColor; } diff --git a/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp b/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp index bef31f68..70cc57d1 100644 --- a/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp @@ -119,7 +119,7 @@ void DescriptorHeapAllocationManager::Free(DescriptorHeapAllocation&& Allocation std::lock_guard LockGuard(m_AllocationMutex); // Methods of VariableSizeGPUAllocationsManager class are not thread safe! - VERIFY(Allocation.GetAllocationManagerId() == m_ThisManagerId, "Invalid descriptor heap manager Id") + VERIFY(Allocation.GetAllocationManagerId() == m_ThisManagerId, "Invalid descriptor heap manager Id"); auto DescriptorOffset = (Allocation.GetCpuHandle().ptr - m_FirstCPUHandle.ptr) / m_DescriptorSize; @@ -217,7 +217,7 @@ DescriptorHeapAllocation CPUDescriptorHeap::Allocate( uint32_t Count ) // Make sure the heap is large enough to accomodate the requested number of descriptors if(Count > m_HeapDesc.NumDescriptors) { - LOG_WARNING_MESSAGE("Number of requested CPU descriptors handles (", Count, ") exceeds the descriptor heap size (", m_HeapDesc.NumDescriptors,"). Increasing the number of descriptors in the heap") + LOG_WARNING_MESSAGE("Number of requested CPU descriptors handles (", Count, ") exceeds the descriptor heap size (", m_HeapDesc.NumDescriptors,"). Increasing the number of descriptors in the heap"); } m_HeapDesc.NumDescriptors = std::max(m_HeapDesc.NumDescriptors, static_cast(Count)); // Create a new descriptor heap manager. Note that this constructor creates a new D3D12 descriptor @@ -395,7 +395,7 @@ DescriptorHeapAllocation DynamicSuballocationsManager::Allocate(Uint32 Count) auto NewDynamicSubAllocation = m_ParentGPUHeap.AllocateDynamic(SuballocationSize); if (NewDynamicSubAllocation.GetCpuHandle().ptr == 0) { - LOG_ERROR_MESSAGE("Failed to suballocate region for dynamic descriptors") + LOG_ERROR_MESSAGE("Failed to suballocate region for dynamic descriptors"); return DescriptorHeapAllocation(); } m_Suballocations.emplace_back(std::move(NewDynamicSubAllocation)); diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 96437f51..b54de44f 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -81,7 +81,7 @@ namespace Diligent else { if (m_NumCommandsInCurCtx != 0) - LOG_WARNING_MESSAGE("Flusing outstanding commands from the device context being destroyed. This may result in D3D12 synchronization errors") + LOG_WARNING_MESSAGE("Flusing outstanding commands from the device context being destroyed. This may result in D3D12 synchronization errors"); Flush(false); } @@ -366,7 +366,7 @@ namespace Diligent else { if( pPipelineStateD3D12->dbgContainsShaderResources() ) - LOG_ERROR_MESSAGE("Pipeline state \"", pPipelineStateD3D12->GetDesc().Name, "\" contains shader resources, but IDeviceContext::CommitShaderResources() was not called" ) + LOG_ERROR_MESSAGE("Pipeline state \"", pPipelineStateD3D12->GetDesc().Name, "\" contains shader resources, but IDeviceContext::CommitShaderResources() was not called" ); } #endif @@ -387,7 +387,7 @@ namespace Diligent } else { - LOG_ERROR_MESSAGE("Valid pIndirectDrawAttribs must be provided for indirect draw command") + LOG_ERROR_MESSAGE("Valid pIndirectDrawAttribs must be provided for indirect draw command"); } } else @@ -428,7 +428,7 @@ namespace Diligent else { if( pPipelineStateD3D12->dbgContainsShaderResources() ) - LOG_ERROR_MESSAGE("Pipeline state \"", pPipelineStateD3D12->GetDesc().Name, "\" contains shader resources, but IDeviceContext::CommitShaderResources() was not called" ) + LOG_ERROR_MESSAGE("Pipeline state \"", pPipelineStateD3D12->GetDesc().Name, "\" contains shader resources, but IDeviceContext::CommitShaderResources() was not called" ); } #endif @@ -448,7 +448,7 @@ namespace Diligent } else { - LOG_ERROR_MESSAGE("Valid pIndirectDrawAttribs must be provided for indirect dispatch command") + LOG_ERROR_MESSAGE("Valid pIndirectDrawAttribs must be provided for indirect dispatch command"); } } else @@ -558,7 +558,7 @@ namespace Diligent void DeviceContextD3D12Impl::InvalidateState() { if (m_NumCommandsInCurCtx != 0) - LOG_WARNING_MESSAGE("Invalidating context that has outstanding commands in it. Call Flush() to submit commands for execution") + LOG_WARNING_MESSAGE("Invalidating context that has outstanding commands in it. Call Flush() to submit commands for execution"); TDeviceContextBase::InvalidateState(); m_CommittedD3D12IndexBuffer = nullptr; @@ -693,7 +693,7 @@ namespace Diligent void DeviceContextD3D12Impl::UpdateBufferRegion(BufferD3D12Impl *pBuffD3D12, const void *pData, Uint64 DstOffset, Uint64 NumBytes) { - VERIFY(pBuffD3D12->GetDesc().Usage != USAGE_DYNAMIC, "Dynamic buffers must be updated via Map()") + VERIFY(pBuffD3D12->GetDesc().Usage != USAGE_DYNAMIC, "Dynamic buffers must be updated via Map()"); VERIFY_EXPR( static_cast(NumBytes) == NumBytes ); auto TmpSpace = m_pUploadHeap->Allocate(static_cast(NumBytes)); memcpy(TmpSpace.CPUAddress, pData, static_cast(NumBytes)); @@ -702,7 +702,7 @@ namespace Diligent void DeviceContextD3D12Impl::CopyBufferRegion(BufferD3D12Impl *pSrcBuffD3D12, BufferD3D12Impl *pDstBuffD3D12, Uint64 SrcOffset, Uint64 DstOffset, Uint64 NumBytes) { - VERIFY(pDstBuffD3D12->GetDesc().Usage != USAGE_DYNAMIC, "Dynamic buffers cannot be copy destinations") + VERIFY(pDstBuffD3D12->GetDesc().Usage != USAGE_DYNAMIC, "Dynamic buffers cannot be copy destinations"); auto pCmdCtx = RequestCmdContext(); pCmdCtx->TransitionResource(pSrcBuffD3D12, D3D12_RESOURCE_STATE_COPY_SOURCE); @@ -742,7 +742,7 @@ namespace Diligent { auto *pBufferD3D12 = ValidatedCast(pSrcBuffer); const auto& TexDesc = pTextureD3D12->GetDesc(); - VERIFY(pBufferD3D12->GetState() == D3D12_RESOURCE_STATE_GENERIC_READ, "Staging buffer is expected to always be in D3D12_RESOURCE_STATE_GENERIC_READ state") + VERIFY(pBufferD3D12->GetState() == D3D12_RESOURCE_STATE_GENERIC_READ, "Staging buffer is expected to always be in D3D12_RESOURCE_STATE_GENERIC_READ state"); auto *pCmdCtx = RequestCmdContext(); auto *pCmdList = pCmdCtx->GetCommandList(); diff --git a/Graphics/GraphicsEngineD3D12/src/DynamicUploadHeap.cpp b/Graphics/GraphicsEngineD3D12/src/DynamicUploadHeap.cpp index a28d3fc0..a02a1d28 100644 --- a/Graphics/GraphicsEngineD3D12/src/DynamicUploadHeap.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DynamicUploadHeap.cpp @@ -67,7 +67,7 @@ namespace Diligent auto hr = pd3d12Device->CreateCommittedResource(&HeapProps, D3D12_HEAP_FLAG_NONE, &ResourceDesc, DefaultUsage, nullptr, __uuidof(m_pBuffer), reinterpret_cast(static_cast(&m_pBuffer)) ); if(FAILED(hr)) - LOG_ERROR("Failed to create new upload ring buffer") + LOG_ERROR("Failed to create new upload ring buffer"); m_pBuffer->SetName(L"Upload Ring Buffer"); @@ -78,14 +78,14 @@ namespace Diligent m_pBuffer->Map(0, nullptr, &m_CpuVirtualAddress); } - LOG_INFO_MESSAGE("GPU ring buffer created. Size: ", MaxSize, "; GPU virtual address 0x", std::hex, m_GpuVirtualAddress) + LOG_INFO_MESSAGE("GPU ring buffer created. Size: ", MaxSize, "; GPU virtual address 0x", std::hex, m_GpuVirtualAddress); } void GPURingBuffer::Destroy() { if(m_pBuffer) { - LOG_INFO_MESSAGE("Destroying GPU ring buffer. Size: ", m_pBuffer->GetDesc().Width, "; GPU virtual address 0x", std::hex, m_GpuVirtualAddress) + LOG_INFO_MESSAGE("Destroying GPU ring buffer. Size: ", m_pBuffer->GetDesc().Width, "; GPU virtual address 0x", std::hex, m_GpuVirtualAddress); } if (m_CpuVirtualAddress) diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp index daebf3c5..d1ba234c 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp @@ -57,7 +57,7 @@ D3D12_PRIMITIVE_TOPOLOGY_TYPE PrimitiveTopologyType_To_D3D12_PRIMITIVE_TOPOLOGY_ } else { - UNEXPECTED( "Incorrect topology type operation (", TopologyType, ")" ) + UNEXPECTED( "Incorrect topology type operation (", TopologyType, ")" ); return static_cast(0); } } @@ -132,7 +132,7 @@ PipelineStateD3D12Impl :: PipelineStateD3D12Impl(IReferenceCounters *pRefCounter { \ auto ShaderType = GraphicsPipeline.p##VarName->GetDesc().ShaderType; \ if( ShaderType != ExpectedType ) \ - LOG_ERROR_AND_THROW( GetShaderTypeLiteralName(ShaderType), " shader is provided while ", GetShaderTypeLiteralName(ExpectedType), " is expected") \ + LOG_ERROR_AND_THROW( GetShaderTypeLiteralName(ShaderType), " shader is provided while ", GetShaderTypeLiteralName(ExpectedType), " is expected");\ auto *pByteCode = ValidatedCast(GraphicsPipeline.p##VarName)->GetShaderByteCode(); \ d3d12PSODesc.VarName.pShaderBytecode = pByteCode->GetBufferPointer(); \ d3d12PSODesc.VarName.BytecodeLength = pByteCode->GetBufferSize(); \ @@ -268,7 +268,7 @@ void PipelineStateD3D12Impl::CreateShaderResourceBinding(IShaderResourceBinding const ShaderResourceLayoutD3D12& PipelineStateD3D12Impl::GetShaderResLayout(SHADER_TYPE ShaderType)const { auto ShaderInd = GetShaderTypeIndex(ShaderType); - VERIFY_EXPR(m_pShaderResourceLayouts[ShaderInd] != nullptr) + VERIFY_EXPR(m_pShaderResourceLayouts[ShaderInd] != nullptr); return *m_pShaderResourceLayouts[ShaderInd]; } @@ -282,7 +282,7 @@ ShaderResourceCacheD3D12* PipelineStateD3D12Impl::CommitAndTransitionShaderResou (m_RootSig.GetTotalSrvCbvUavSlots(SHADER_VARIABLE_TYPE_MUTABLE) != 0 || m_RootSig.GetTotalSrvCbvUavSlots(SHADER_VARIABLE_TYPE_DYNAMIC) != 0)) { - LOG_ERROR_MESSAGE("Pipeline state \"", m_Desc.Name, "\" contains mutable/dynamic shader variables and requires shader resource binding to commit all resources, but none is provided.") + LOG_ERROR_MESSAGE("Pipeline state \"", m_Desc.Name, "\" contains mutable/dynamic shader variables and requires shader resource binding to commit all resources, but none is provided."); } #endif @@ -325,7 +325,7 @@ ShaderResourceCacheD3D12* PipelineStateD3D12Impl::CommitAndTransitionShaderResou } else { - VERIFY(TransitionResources, "Resources should be transitioned or committed or both") + VERIFY(TransitionResources, "Resources should be transitioned or committed or both"); m_RootSig.TransitionResources(ResourceCache, Ctx); } return &ResourceCache; diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp index 63ab19af..7bb317f5 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp @@ -204,7 +204,7 @@ void RenderDeviceD3D12Impl::FinishFrame(bool ReleaseAllResources) { auto pImmediateCtxD3D12 = ValidatedCast(pImmediateCtx.RawPtr()); if(pImmediateCtxD3D12->GetNumCommandsInCtx() != 0) - LOG_ERROR_MESSAGE("There are outstanding commands in the immediate device context when finishing the frame. This is an error and may cause unpredicted behaviour. Call Flush() to submit all commands for execution before finishing the frame") + LOG_ERROR_MESSAGE("There are outstanding commands in the immediate device context when finishing the frame. This is an error and may cause unpredicted behaviour. Call Flush() to submit all commands for execution before finishing the frame"); } for (auto wpDeferredCtx : m_wpDeferredContexts) @@ -213,7 +213,7 @@ void RenderDeviceD3D12Impl::FinishFrame(bool ReleaseAllResources) { auto pDeferredCtxD3D12 = ValidatedCast(pDeferredCtx.RawPtr()); if(pDeferredCtxD3D12->GetNumCommandsInCtx() != 0) - LOG_ERROR_MESSAGE("There are outstanding commands in the deferred device context when finishing the frame. This is an error and may cause unpredicted behaviour. Close all deferred contexts and execute them before finishing the frame") + LOG_ERROR_MESSAGE("There are outstanding commands in the deferred device context when finishing the frame. This is an error and may cause unpredicted behaviour. Close all deferred contexts and execute them before finishing the frame"); } } } diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp index 70d482ae..ba279e4f 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp @@ -167,7 +167,7 @@ void EngineFactoryD3D12Impl::CreateDeviceAndContextsD3D12( const EngineD3D12Attr hr = D3D12CreateDevice(hardwareAdapter, D3D_FEATURE_LEVEL_11_0, __uuidof(d3d12Device), reinterpret_cast(static_cast(&d3d12Device)) ); if( FAILED(hr)) { - LOG_WARNING_MESSAGE("Failed to create hardware device. Attempting to create WARP device") + LOG_WARNING_MESSAGE("Failed to create hardware device. Attempting to create WARP device"); CComPtr warpAdapter; hr = factory->EnumWarpAdapter( __uuidof(warpAdapter), reinterpret_cast(static_cast(&warpAdapter)) ); diff --git a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp index 707ccd75..4d8bb04d 100644 --- a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp @@ -232,7 +232,7 @@ void RootSignature::InitStaticSampler(SHADER_TYPE ShaderType, const String &Text if (!SamplerFound) { - LOG_ERROR("Failed to find static sampler for variable \"", TextureName, '\"') + LOG_ERROR("Failed to find static sampler for variable \"", TextureName, '\"'); } } @@ -327,12 +327,12 @@ void RootSignature::dbgVerifyRootParameters()const { VERIFY( range.RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SRV || range.RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_CBV || - range.RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_UAV, "Resource type is expected to be SRV, CBV or UAV") + range.RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_UAV, "Resource type is expected to be SRV, CBV or UAV"); dbgTotalSrvCbvUavSlots += range.NumDescriptors; } else { - VERIFY(range.RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, "Resource type is expected to be sampler") + VERIFY(range.RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, "Resource type is expected to be sampler"); dbgTotalSamplerSlots += range.NumDescriptors; } @@ -353,11 +353,11 @@ void RootSignature::dbgVerifyRootParameters()const VERIFY(dbgTotalSrvCbvUavSlots == m_TotalSrvCbvUavSlots[SHADER_VARIABLE_TYPE_STATIC] + m_TotalSrvCbvUavSlots[SHADER_VARIABLE_TYPE_MUTABLE] + - m_TotalSrvCbvUavSlots[SHADER_VARIABLE_TYPE_DYNAMIC], "Unexpected number of SRV CBV UAV resource slots") + m_TotalSrvCbvUavSlots[SHADER_VARIABLE_TYPE_DYNAMIC], "Unexpected number of SRV CBV UAV resource slots"); VERIFY(dbgTotalSamplerSlots == m_TotalSamplerSlots[SHADER_VARIABLE_TYPE_STATIC] + m_TotalSamplerSlots[SHADER_VARIABLE_TYPE_MUTABLE] + - m_TotalSamplerSlots[SHADER_VARIABLE_TYPE_DYNAMIC], "Unexpected number of sampler slots") + m_TotalSamplerSlots[SHADER_VARIABLE_TYPE_DYNAMIC], "Unexpected number of sampler slots"); } #endif @@ -409,14 +409,14 @@ void RootSignature::Finalize(ID3D12Device *pd3d12Device) { auto &RootTable = m_RootParams.GetRootTable(rt); const D3D12_ROOT_PARAMETER &SrcParam = RootTable; - VERIFY( SrcParam.ParameterType == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE && SrcParam.DescriptorTable.NumDescriptorRanges > 0, "Non-empty descriptor table is expected" ) + VERIFY( SrcParam.ParameterType == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE && SrcParam.DescriptorTable.NumDescriptorRanges > 0, "Non-empty descriptor table is expected" ); D3D12Parameters[RootTable.GetRootIndex()] = SrcParam; } for(Uint32 rv = 0; rv < m_RootParams.GetNumRootViews(); ++rv) { auto &RootView = m_RootParams.GetRootView(rv); const D3D12_ROOT_PARAMETER &SrcParam = RootView; - VERIFY( SrcParam.ParameterType == D3D12_ROOT_PARAMETER_TYPE_CBV, "Root CBV is expected" ) + VERIFY( SrcParam.ParameterType == D3D12_ROOT_PARAMETER_TYPE_CBV, "Root CBV is expected" ); D3D12Parameters[RootView.GetRootIndex()] = SrcParam; } @@ -472,7 +472,7 @@ void RootSignature::Finalize(ID3D12Device *pd3d12Device) CComPtr error; HRESULT hr = D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error); hr = pd3d12Device->CreateRootSignature(0, signature->GetBufferPointer(), signature->GetBufferSize(), __uuidof(m_pd3d12RootSignature), reinterpret_cast( static_cast(&m_pd3d12RootSignature))); - CHECK_D3D_RESULT_THROW(hr, "Failed to create root signature") + CHECK_D3D_RESULT_THROW(hr, "Failed to create root signature"); bool bHasDynamicResources = m_TotalSrvCbvUavSlots[SHADER_VARIABLE_TYPE_DYNAMIC]!=0 || m_TotalSamplerSlots[SHADER_VARIABLE_TYPE_DYNAMIC]!=0; if(bHasDynamicResources) @@ -541,7 +541,7 @@ void RootSignature::InitResourceCache(RenderDeviceD3D12Impl *pDeviceD3D12Impl, S #ifdef _DEBUG dbgShaderType = ShaderTypeFromShaderVisibility(D3D12RootParam.ShaderVisibility); #endif - VERIFY_EXPR( D3D12RootParam.ParameterType == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE ) + VERIFY_EXPR( D3D12RootParam.ParameterType == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE ); auto TableSize = RootParam.GetDescriptorTableSize(); VERIFY(TableSize > 0, "Unexpected empty descriptor table"); @@ -568,7 +568,7 @@ void RootSignature::InitResourceCache(RenderDeviceD3D12Impl *pDeviceD3D12Impl, S } else { - VERIFY_EXPR(RootTableCache.m_TableStartOffset == ShaderResourceCacheD3D12::InvalidDescriptorOffset) + VERIFY_EXPR(RootTableCache.m_TableStartOffset == ShaderResourceCacheD3D12::InvalidDescriptorOffset); } } @@ -579,7 +579,7 @@ void RootSignature::InitResourceCache(RenderDeviceD3D12Impl *pDeviceD3D12Impl, S const auto& D3D12RootParam = static_cast(RootParam); auto &RootTableCache = ResourceCache.GetRootTable(RootParam.GetRootIndex()); // Root views are not assigned valid table start offset - VERIFY_EXPR(RootTableCache.m_TableStartOffset == ShaderResourceCacheD3D12::InvalidDescriptorOffset) + VERIFY_EXPR(RootTableCache.m_TableStartOffset == ShaderResourceCacheD3D12::InvalidDescriptorOffset); SHADER_TYPE dbgShaderType = ShaderTypeFromShaderVisibility(D3D12RootParam.ShaderVisibility); VERIFY_EXPR(D3D12RootParam.ParameterType == D3D12_ROOT_PARAMETER_TYPE_CBV); @@ -658,8 +658,8 @@ void TransitionResource(CommandContext &Ctx, default: // Resource not bound - VERIFY(Res.Type == CachedResourceType::Unknown, "Unexpected resource type") - VERIFY(Res.pObject == nullptr && Res.CPUDescriptorHandle.ptr == 0, "Bound resource is unexpected") + VERIFY(Res.Type == CachedResourceType::Unknown, "Unexpected resource type"); + VERIFY(Res.pObject == nullptr && Res.CPUDescriptorHandle.ptr == 0, "Bound resource is unexpected"); } } @@ -731,8 +731,8 @@ void DbgVerifyResourceState(ShaderResourceCacheD3D12::Resource &Res, default: // Resource not bound - VERIFY(Res.Type == CachedResourceType::Unknown, "Unexpected resource type") - VERIFY(Res.pObject == nullptr && Res.CPUDescriptorHandle.ptr == 0, "Bound resource is unexpected") + VERIFY(Res.Type == CachedResourceType::Unknown, "Unexpected resource type"); + VERIFY(Res.pObject == nullptr && Res.CPUDescriptorHandle.ptr == 0, "Bound resource is unexpected"); } } #endif @@ -811,9 +811,9 @@ void RootSignature::CommitDescriptorHandlesInternal_SMD(RenderDeviceD3D12Impl *p Heaps.pSrvCbvUavHeap = DynamicCbvSrvUavDescriptors.GetDescriptorHeap(); if(NumDynamicCbvSrvUavDescriptors) - VERIFY(DynamicCbvSrvUavDescriptors.GetDescriptorHeap() == Heaps.pSrvCbvUavHeap, "Inconsistent CbvSrvUav descriptor heaps" ) + VERIFY(DynamicCbvSrvUavDescriptors.GetDescriptorHeap() == Heaps.pSrvCbvUavHeap, "Inconsistent CbvSrvUav descriptor heaps" ); if(NumDynamicSamplerDescriptors) - VERIFY(DynamicSamplerDescriptors.GetDescriptorHeap() == Heaps.pSamplerHeap, "Inconsistent Sampler descriptor heaps" ) + VERIFY(DynamicSamplerDescriptors.GetDescriptorHeap() == Heaps.pSamplerHeap, "Inconsistent Sampler descriptor heaps" ); if(Heaps) Ctx.SetDescriptorHeaps(Heaps); @@ -840,7 +840,7 @@ void RootSignature::CommitDescriptorHandlesInternal_SMD(RenderDeviceD3D12Impl *p RootTableGPUDescriptorHandle = IsResourceTable ? ResourceCache.GetShaderVisibleTableGPUDescriptorHandle(RootInd) : ResourceCache.GetShaderVisibleTableGPUDescriptorHandle(RootInd); - VERIFY(RootTableGPUDescriptorHandle.ptr != 0, "Unexpected null GPU descriptor handle") + VERIFY(RootTableGPUDescriptorHandle.ptr != 0, "Unexpected null GPU descriptor handle"); } if(IsCompute) @@ -867,9 +867,9 @@ void RootSignature::CommitDescriptorHandlesInternal_SMD(RenderDeviceD3D12Impl *p if (IsResourceTable) { if( Res.CPUDescriptorHandle.ptr == 0 ) - LOG_ERROR_MESSAGE("No valid CbvSrvUav descriptor handle found for root parameter ", RootInd, ", descriptor slot ", OffsetFromTableStart) + LOG_ERROR_MESSAGE("No valid CbvSrvUav descriptor handle found for root parameter ", RootInd, ", descriptor slot ", OffsetFromTableStart); - VERIFY( DynamicCbvSrvUavTblOffset < NumDynamicCbvSrvUavDescriptors, "Not enough space in the descriptor heap allocation") + VERIFY( DynamicCbvSrvUavTblOffset < NumDynamicCbvSrvUavDescriptors, "Not enough space in the descriptor heap allocation"); pd3d12Device->CopyDescriptorsSimple(1, DynamicCbvSrvUavDescriptors.GetCpuHandle(DynamicCbvSrvUavTblOffset), Res.CPUDescriptorHandle, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); ++DynamicCbvSrvUavTblOffset; @@ -877,9 +877,9 @@ void RootSignature::CommitDescriptorHandlesInternal_SMD(RenderDeviceD3D12Impl *p else { if( Res.CPUDescriptorHandle.ptr == 0 ) - LOG_ERROR_MESSAGE("No valid sampler descriptor handle found for root parameter ", RootInd, ", descriptor slot ", OffsetFromTableStart) + LOG_ERROR_MESSAGE("No valid sampler descriptor handle found for root parameter ", RootInd, ", descriptor slot ", OffsetFromTableStart); - VERIFY( DynamicSamplerTblOffset < NumDynamicSamplerDescriptors, "Not enough space in the descriptor heap allocation") + VERIFY( DynamicSamplerTblOffset < NumDynamicSamplerDescriptors, "Not enough space in the descriptor heap allocation"); pd3d12Device->CopyDescriptorsSimple(1, DynamicSamplerDescriptors.GetCpuHandle(DynamicSamplerTblOffset), Res.CPUDescriptorHandle, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER); ++DynamicSamplerTblOffset; @@ -914,7 +914,7 @@ void RootSignature::CommitDescriptorHandlesInternal_SM(RenderDeviceD3D12Impl *pR D3D12_GPU_DESCRIPTOR_HANDLE RootTableGPUDescriptorHandle = IsResourceTable ? ResourceCache.GetShaderVisibleTableGPUDescriptorHandle(RootInd) : ResourceCache.GetShaderVisibleTableGPUDescriptorHandle(RootInd); - VERIFY(RootTableGPUDescriptorHandle.ptr != 0, "Unexpected null GPU descriptor handle") + VERIFY(RootTableGPUDescriptorHandle.ptr != 0, "Unexpected null GPU descriptor handle"); if(IsCompute) Ctx.GetCommandList()->SetComputeRootDescriptorTable(RootInd, RootTableGPUDescriptorHandle); diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp index f4715f34..91f9660b 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp @@ -118,8 +118,8 @@ void ShaderResourceBindingD3D12Impl::dbgVerifyResourceBindings(const PipelineSta void ShaderResourceBindingD3D12Impl::InitializeStaticResources(const PipelineStateD3D12Impl *pPSO) { - VERIFY(!StaticResourcesInitialized(), "Static resources have already been initialized") - VERIFY(pPSO == GetPipelineState(), "Invalid pipeline state provided") + VERIFY(!StaticResourcesInitialized(), "Static resources have already been initialized"); + VERIFY(pPSO == GetPipelineState(), "Invalid pipeline state provided"); auto NumShaders = pPSO->GetNumShaders(); auto ppShaders = pPSO->GetShaders(); diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp index 0ac5ac16..cc628725 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp @@ -42,7 +42,7 @@ namespace Diligent // m_pResources, m_NumResources // - VERIFY(m_pAllocator == nullptr && m_pMemory == nullptr, "Cache already initialized") + VERIFY(m_pAllocator == nullptr && m_pMemory == nullptr, "Cache already initialized"); m_pAllocator = &MemAllocator; m_NumTables = NumTables; Uint32 TotalResources = 0; diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp index 092111f7..cfbdf774 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp @@ -78,13 +78,13 @@ D3D12_DESCRIPTOR_RANGE_TYPE GetDescriptorRangeType(CachedResourceType ResType) Initialized = true; } auto Ind = static_cast(ResType); - VERIFY(Ind >= 0 && Ind < (size_t)CachedResourceType::NumTypes, "Unexpected resource type") + VERIFY(Ind >= 0 && Ind < (size_t)CachedResourceType::NumTypes, "Unexpected resource type"); return RangeTypes[Ind]; } void ShaderResourceLayoutD3D12::AllocateMemory(IMemoryAllocator &Allocator) { - VERIFY( &m_ResourceBuffer.get_deleter().m_Allocator == &Allocator, "Inconsistent memory allocators" ) + VERIFY( &m_ResourceBuffer.get_deleter().m_Allocator == &Allocator, "Inconsistent memory allocators" ); Uint32 TotalSrvCbvUav = GetTotalSrvCbvUavCount(); Uint32 TotalSamplers = GetTotalSamplerCount(); size_t MemSize = TotalSrvCbvUav * sizeof(SRV_CBV_UAV) + TotalSamplers * sizeof(Sampler); @@ -143,10 +143,10 @@ ShaderResourceLayoutD3D12::ShaderResourceLayoutD3D12(IObject &Owner, if (SrcRes.IsValidSampler()) { const auto &SrcSamplerAttribs = SrcLayout.GetSampler(VarType, SrcRes.GetSamplerId()); - VERIFY(!SrcSamplerAttribs.Attribs.IsStaticSampler(), "Only non-static samplers can be assigned space in shader cache") + VERIFY(!SrcSamplerAttribs.Attribs.IsStaticSampler(), "Only non-static samplers can be assigned space in shader cache"); VERIFY(SrcSamplerAttribs.Attribs.GetVariableType() == SrcRes.Attribs.GetVariableType(), "Inconsistent texture and sampler variable types" ); - VERIFY(SrcSamplerAttribs.IsValidRootIndex(), "Root index must be valid") - VERIFY(SrcSamplerAttribs.IsValidOffset(), "Offset must be valid") + VERIFY(SrcSamplerAttribs.IsValidRootIndex(), "Root index must be valid"); + VERIFY(SrcSamplerAttribs.IsValidOffset(), "Offset must be valid"); VERIFY_EXPR(SrcSamplerAttribs.Attribs.BindCount == SrcRes.Attribs.BindCount || SrcSamplerAttribs.Attribs.BindCount == 1); SamplerId = CurrSampler[VarType]; @@ -155,8 +155,8 @@ ShaderResourceLayoutD3D12::ShaderResourceLayoutD3D12(IObject &Owner, ::new (&GetSampler(VarType, CurrSampler[VarType]++)) Sampler( *this, SrcSamplerAttribs ); } - VERIFY(SrcRes.IsValidRootIndex(), "Root index must be valid") - VERIFY(SrcRes.IsValidOffset(), "Offset must be valid") + VERIFY(SrcRes.IsValidRootIndex(), "Root index must be valid"); + VERIFY(SrcRes.IsValidOffset(), "Offset must be valid"); ::new (&GetSrvCbvUav(VarType, CurrCbvSrvUav[VarType]++)) SRV_CBV_UAV( *this, SrcRes, SamplerId ); } } @@ -265,8 +265,8 @@ void ShaderResourceLayoutD3D12::Initialize(ID3D12Device *pd3d12Device, // Resources in the static resource cache are indexed by the bind point StaticResCacheTblSizes[RootIndex] = std::max(StaticResCacheTblSizes[RootIndex], Offset + Attribs.BindCount); } - VERIFY(RootIndex != SRV_CBV_UAV::InvalidRootIndex, "Root index must be valid") - VERIFY(Offset != SRV_CBV_UAV::InvalidOffset, "Offset must be valid") + VERIFY(RootIndex != SRV_CBV_UAV::InvalidRootIndex, "Root index must be valid"); + VERIFY(Offset != SRV_CBV_UAV::InvalidOffset, "Offset must be valid"); // Static samplers are never copied, and SamplerId == InvalidSamplerId ::new (&GetSrvCbvUav(Attribs.GetVariableType(), CurrCbvSrvUav[Attribs.GetVariableType()]++)) SRV_CBV_UAV( *this, Attribs, ResType, RootIndex, Offset, SamplerId); @@ -285,7 +285,7 @@ void ShaderResourceLayoutD3D12::Initialize(ID3D12Device *pd3d12Device, [&](const D3DShaderResourceAttribs& TexSRV) { auto VarType = TexSRV.GetVariableType(); - VERIFY_EXPR(IsAllowedType(VarType, AllowedTypeBits) ) + VERIFY_EXPR(IsAllowedType(VarType, AllowedTypeBits) ); Uint32 SamplerId = SRV_CBV_UAV::InvalidSamplerId; if(TexSRV.IsValidSampler()) @@ -325,8 +325,8 @@ void ShaderResourceLayoutD3D12::Initialize(ID3D12Device *pd3d12Device, // Resources in the static resource cache are indexed by the bind point StaticResCacheTblSizes[SamplerRootIndex] = std::max(StaticResCacheTblSizes[SamplerRootIndex], SamplerOffset + SrcSamplerAttribs.BindCount); } - VERIFY(SamplerRootIndex != Sampler::InvalidRootIndex, "Sampler root index must be valid") - VERIFY(SamplerOffset != Sampler::InvalidOffset, "Sampler offset must be valid") + VERIFY(SamplerRootIndex != Sampler::InvalidRootIndex, "Sampler root index must be valid"); + VERIFY(SamplerOffset != Sampler::InvalidOffset, "Sampler offset must be valid"); SamplerId = CurrSampler[VarType]; VERIFY(SamplerId <= SRV_CBV_UAV::MaxSamplerId, "Sampler index excceeds allowed limit"); @@ -418,7 +418,7 @@ void ShaderResourceLayoutD3D12::SRV_CBV_UAV::CacheCB(IDeviceObject *pBuffer, Sha if(DstRes.pObject != pBuffD3D12) { auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.GetVariableType()); - LOG_ERROR_MESSAGE( "Non-null constant buffer is already bound to ", VarTypeStr, " shader variable \"", Attribs.GetPrintName(ArrayInd), "\" in shader \"", m_ParentResLayout.GetShaderName(), "\". Attempring to bind another constant buffer is an error and will be ignored. Use another shader resource binding instance or mark shader variable as dynamic." ) + LOG_ERROR_MESSAGE( "Non-null constant buffer is already bound to ", VarTypeStr, " shader variable \"", Attribs.GetPrintName(ArrayInd), "\" in shader \"", m_ParentResLayout.GetShaderName(), "\". Attempring to bind another constant buffer is an error and will be ignored. Use another shader resource binding instance or mark shader variable as dynamic." ); } // Do not update resource if one is already bound unless it is dynamic. This may be @@ -428,7 +428,7 @@ void ShaderResourceLayoutD3D12::SRV_CBV_UAV::CacheCB(IDeviceObject *pBuffer, Sha DstRes.Type = GetResType(); DstRes.CPUDescriptorHandle = pBuffD3D12->GetCBVHandle(); - VERIFY(DstRes.CPUDescriptorHandle.ptr != 0 || pBuffD3D12->GetDesc().Usage == USAGE_DYNAMIC, "No relevant CBV CPU descriptor handle") + VERIFY(DstRes.CPUDescriptorHandle.ptr != 0 || pBuffD3D12->GetDesc().Usage == USAGE_DYNAMIC, "No relevant CBV CPU descriptor handle"); if(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0 ) { @@ -517,7 +517,7 @@ void ShaderResourceLayoutD3D12::SRV_CBV_UAV::CacheResourceView(IDeviceObject *pV DstRes.Type = GetResType(); DstRes.CPUDescriptorHandle = pViewD3D12->GetCPUDescriptorHandle(); - VERIFY(DstRes.CPUDescriptorHandle.ptr != 0, "No relevant D3D12 view") + VERIFY(DstRes.CPUDescriptorHandle.ptr != 0, "No relevant D3D12 view"); if(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0) { @@ -551,18 +551,18 @@ void ShaderResourceLayoutD3D12::Sampler::CacheSampler(ITextureViewD3D12 *pTexVie { if (pResourceCache->DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::StaticShaderResources) { - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Static shader resources of a shader should not be assigned shader visible descriptor space") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Static shader resources of a shader should not be assigned shader visible descriptor space"); } else if (pResourceCache->DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::SRBResources) { if(Attribs.GetVariableType() == SHADER_VARIABLE_TYPE_DYNAMIC) - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Dynamic resources of a shader resource binding should be assigned shader visible descriptor space at every draw call") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Dynamic resources of a shader resource binding should be assigned shader visible descriptor space at every draw call"); else - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0 || pTexViewD3D12 == nullptr, "Non-dynamics resources of a shader resource binding must be assigned shader visible descriptor space") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0 || pTexViewD3D12 == nullptr, "Non-dynamics resources of a shader resource binding must be assigned shader visible descriptor space"); } else { - UNEXPECTED("Unknown content type") + UNEXPECTED("Unknown content type"); } } #endif @@ -577,7 +577,7 @@ void ShaderResourceLayoutD3D12::Sampler::CacheSampler(ITextureViewD3D12 *pTexVie if(DstSam.pObject != pSampler) { auto VarTypeStr = GetShaderVariableTypeLiteralName(Attribs.GetVariableType()); - LOG_ERROR_MESSAGE( "Non-null sampler is already bound to ", VarTypeStr, " shader variable \"", Attribs.GetPrintName(ArrayIndex), "\" in shader \"", m_ParentResLayout.GetShaderName(), "\". Attempting to bind another sampler is an error and will be ignored. Use another shader resource binding instance or mark shader variable as dynamic." ) + LOG_ERROR_MESSAGE( "Non-null sampler is already bound to ", VarTypeStr, " shader variable \"", Attribs.GetPrintName(ArrayIndex), "\" in shader \"", m_ParentResLayout.GetShaderName(), "\". Attempting to bind another sampler is an error and will be ignored. Use another shader resource binding instance or mark shader variable as dynamic." ); } // Do not update resource if one is already bound unless it is dynamic. This may be @@ -589,7 +589,7 @@ void ShaderResourceLayoutD3D12::Sampler::CacheSampler(ITextureViewD3D12 *pTexVie auto *pSamplerD3D12 = ValidatedCast(pSampler); DstSam.CPUDescriptorHandle = pSamplerD3D12->GetCPUDescriptorHandle(); - VERIFY(DstSam.CPUDescriptorHandle.ptr != 0, "No relevant D3D12 sampler descriptor handle") + VERIFY(DstSam.CPUDescriptorHandle.ptr != 0, "No relevant D3D12 sampler descriptor handle"); if(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0) { @@ -617,10 +617,10 @@ void ShaderResourceLayoutD3D12::Sampler::CacheSampler(ITextureViewD3D12 *pTexVie ShaderResourceLayoutD3D12::Sampler &ShaderResourceLayoutD3D12::GetAssignedSampler(const SRV_CBV_UAV &TexSrv) { - VERIFY(TexSrv.GetResType() == CachedResourceType::TexSRV, "Unexpected resource type: texture SRV is expected") - VERIFY(TexSrv.IsValidSampler(), "Texture SRV has no associated sampler") + VERIFY(TexSrv.GetResType() == CachedResourceType::TexSRV, "Unexpected resource type: texture SRV is expected"); + VERIFY(TexSrv.IsValidSampler(), "Texture SRV has no associated sampler"); auto &SamInfo = GetSampler(TexSrv.Attribs.GetVariableType(), TexSrv.GetSamplerId()); - VERIFY(SamInfo.Attribs.GetVariableType() == TexSrv.Attribs.GetVariableType(), "Inconsistent texture and sampler variable types") + VERIFY(SamInfo.Attribs.GetVariableType() == TexSrv.Attribs.GetVariableType(), "Inconsistent texture and sampler variable types"); VERIFY(SamInfo.Attribs.Name == TexSrv.Attribs.Name + D3DSamplerSuffix, "Sampler name \"", SamInfo.Attribs.Name, "\" does not match texture name \"", TexSrv.Attribs.Name, '\"'); return SamInfo; } @@ -640,25 +640,25 @@ void ShaderResourceLayoutD3D12::SRV_CBV_UAV::BindResource(IDeviceObject *pObj, U { if (pResourceCache->DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::StaticShaderResources) { - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Static shader resources of a shader should not be assigned shader visible descriptor space") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Static shader resources of a shader should not be assigned shader visible descriptor space"); } else if (pResourceCache->DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::SRBResources) { if (GetResType() == CachedResourceType::CBV) { - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Constant buffers are bound as root views and should not be assigned shader visible descriptor space") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Constant buffers are bound as root views and should not be assigned shader visible descriptor space"); } else { if(Attribs.GetVariableType() == SHADER_VARIABLE_TYPE_DYNAMIC) - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Dynamic resources of a shader resource binding should be assigned shader visible descriptor space at every draw call") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Dynamic resources of a shader resource binding should be assigned shader visible descriptor space at every draw call"); else - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0, "Non-dynamics resources of a shader resource binding must be assigned shader visible descriptor space") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0, "Non-dynamics resources of a shader resource binding must be assigned shader visible descriptor space"); } } else { - UNEXPECTED("Unknown content type") + UNEXPECTED("Unknown content type"); } } #endif @@ -677,7 +677,7 @@ void ShaderResourceLayoutD3D12::SRV_CBV_UAV::BindResource(IDeviceObject *pObj, U if(IsValidSampler()) { auto &Sam = m_ParentResLayout.GetAssignedSampler(*this); - VERIFY( !Sam.Attribs.IsStaticSampler(), "Static samplers should never be assigned space in the cache" ) + VERIFY( !Sam.Attribs.IsStaticSampler(), "Static samplers should never be assigned space in the cache" ); VERIFY_EXPR(Attribs.BindCount == Sam.Attribs.BindCount || Sam.Attribs.BindCount == 1); auto SamplerArrInd = Sam.Attribs.BindCount > 1 ? ArrayIndex : 0; auto ShdrVisibleSamplerHeapCPUDescriptorHandle = pResourceCache->GetShaderVisibleTableCPUDescriptorHandle(Sam.RootIndex, Sam.OffsetFromTableStart + SamplerArrInd); @@ -698,7 +698,7 @@ void ShaderResourceLayoutD3D12::SRV_CBV_UAV::BindResource(IDeviceObject *pObj, U CacheResourceView( pObj, DstRes, ArrayIndex, ShdrVisibleHeapCPUDescriptorHandle, BUFFER_VIEW_UNORDERED_ACCESS, [](IBufferViewD3D12*){}); break; - default: UNEXPECTED("Unknown resource type ", static_cast(GetResType())) + default: UNEXPECTED("Unknown resource type ", static_cast(GetResType())); } } else @@ -734,7 +734,7 @@ bool ShaderResourceLayoutD3D12::SRV_CBV_UAV::IsBound(Uint32 ArrayIndex) auto &CachedRes = RootTable.GetResource(OffsetFromTableStart + ArrayIndex, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, m_ParentResLayout.m_pResources->GetShaderType()); if( CachedRes.pObject != nullptr ) { - VERIFY(CachedRes.CPUDescriptorHandle.ptr != 0 || ValidatedCast(CachedRes.pObject.RawPtr())->GetDesc().Usage == USAGE_DYNAMIC, "No relevant descriptor handle") + VERIFY(CachedRes.CPUDescriptorHandle.ptr != 0 || ValidatedCast(CachedRes.pObject.RawPtr())->GetDesc().Usage == USAGE_DYNAMIC, "No relevant descriptor handle"); return true; } } @@ -779,7 +779,7 @@ void ShaderResourceLayoutD3D12::BindResources( IResourceMapping* pResourceMappin else { if( (Flags & BIND_SHADER_RESOURCES_ALL_RESOLVED) && !Res.IsBound(ArrInd) ) - LOG_ERROR_MESSAGE( "Cannot bind resource to shader variable \"", Res.Attribs.GetPrintName(ArrInd), "\": resource view not found in the resource mapping" ) + LOG_ERROR_MESSAGE( "Cannot bind resource to shader variable \"", Res.Attribs.GetPrintName(ArrInd), "\": resource view not found in the resource mapping" ); } } } @@ -841,7 +841,7 @@ void ShaderResourceLayoutD3D12::CopyStaticResourceDesriptorHandles(const ShaderR { // Get resource attributes const auto &res = GetSrvCbvUav(SHADER_VARIABLE_TYPE_STATIC, r); - VERIFY(SrcLayout.m_pResources->GetShaderType() == m_pResources->GetShaderType(), "Incosistent shader types") + VERIFY(SrcLayout.m_pResources->GetShaderType() == m_pResources->GetShaderType(), "Incosistent shader types"); auto RangeType = GetDescriptorRangeType(res.GetResType()); for(Uint32 ArrInd = 0; ArrInd < res.Attribs.BindCount; ++ArrInd) { @@ -884,9 +884,9 @@ void ShaderResourceLayoutD3D12::CopyStaticResourceDesriptorHandles(const ShaderR { auto &SamInfo = GetAssignedSampler(res); - VERIFY(!SamInfo.Attribs.IsStaticSampler(), "Static samplers should never be assigned space in the cache") + VERIFY(!SamInfo.Attribs.IsStaticSampler(), "Static samplers should never be assigned space in the cache"); - VERIFY(SamInfo.Attribs.IsValidBindPoint(), "Sampler bind point must be valid") + VERIFY(SamInfo.Attribs.IsValidBindPoint(), "Sampler bind point must be valid"); VERIFY_EXPR(SamInfo.Attribs.BindCount == res.Attribs.BindCount || SamInfo.Attribs.BindCount == 1); for(Uint32 ArrInd = 0; ArrInd < SamInfo.Attribs.BindCount; ++ArrInd) @@ -929,27 +929,27 @@ void ShaderResourceLayoutD3D12::CopyStaticResourceDesriptorHandles(const ShaderR #ifdef VERIFY_SHADER_BINDINGS void ShaderResourceLayoutD3D12::dbgVerifyBindings()const { - VERIFY(m_pResourceCache, "Resource cache is null") + VERIFY(m_pResourceCache, "Resource cache is null"); for(SHADER_VARIABLE_TYPE VarType = SHADER_VARIABLE_TYPE_STATIC; VarType < SHADER_VARIABLE_TYPE_NUM_TYPES; VarType = static_cast(VarType+1)) { for(Uint32 r=0; r < m_NumCbvSrvUav[VarType]; ++r) { const auto &res = GetSrvCbvUav(VarType, r); - VERIFY(res.Attribs.GetVariableType() == VarType, "Unexpected variable type") + VERIFY(res.Attribs.GetVariableType() == VarType, "Unexpected variable type"); for(Uint32 ArrInd = 0; ArrInd < res.Attribs.BindCount; ++ArrInd) { const auto &CachedRes = m_pResourceCache->GetRootTable(res.GetRootIndex()).GetResource(res.OffsetFromTableStart + ArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, m_pResources->GetShaderType()); if(CachedRes.pObject) - VERIFY(CachedRes.Type == res.GetResType(), "Inconsistent cached resource types") + VERIFY(CachedRes.Type == res.GetResType(), "Inconsistent cached resource types"); else - VERIFY(CachedRes.Type == CachedResourceType::Unknown, "Unexpected cached resource types") + VERIFY(CachedRes.Type == CachedResourceType::Unknown, "Unexpected cached resource types"); if( !CachedRes.pObject || // Dynamic buffers do not have CPU descriptor handle as they do not keep D3D12 buffer, and space is allocated from the GPU ring buffer CachedRes.CPUDescriptorHandle.ptr == 0 && !(CachedRes.Type==CachedResourceType::CBV && ValidatedCast(CachedRes.pObject.RawPtr())->GetDesc().Usage == USAGE_DYNAMIC) ) - LOG_ERROR_MESSAGE( "No resource is bound to ", GetShaderVariableTypeLiteralName(res.Attribs.GetVariableType()), " variable \"", res.Attribs.GetPrintName(ArrInd), "\" in shader \"", GetShaderName(), "\"" ) + LOG_ERROR_MESSAGE( "No resource is bound to ", GetShaderVariableTypeLiteralName(res.Attribs.GetVariableType()), " variable \"", res.Attribs.GetPrintName(ArrInd), "\" in shader \"", GetShaderName(), "\"" ); if (res.Attribs.BindCount > 1 && res.IsValidSampler()) { @@ -962,7 +962,7 @@ void ShaderResourceLayoutD3D12::dbgVerifyBindings()const { auto *pSampler = const_cast(pTexView)->GetSampler(); if (pSampler != nullptr && CachedSampler.pObject != pSampler) - LOG_ERROR_MESSAGE( "All elements of texture array \"", res.Attribs.Name, "\" in shader \"", GetShaderName(), "\" share the same sampler. However, the sampler set in view for element ", ArrInd, " does not match bound sampler. This may cause incorrect behavior on GL platform." ) + LOG_ERROR_MESSAGE( "All elements of texture array \"", res.Attribs.Name, "\" in shader \"", GetShaderName(), "\" share the same sampler. However, the sampler set in view for element ", ArrInd, " does not match bound sampler. This may cause incorrect behavior on GL platform." ); } } } @@ -972,25 +972,25 @@ void ShaderResourceLayoutD3D12::dbgVerifyBindings()const auto ShdrVisibleHeapCPUDescriptorHandle = m_pResourceCache->GetShaderVisibleTableCPUDescriptorHandle(res.GetRootIndex(), res.OffsetFromTableStart + ArrInd); if (m_pResourceCache->DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::StaticShaderResources) { - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Static shader resources of a shader should not be assigned shader visible descriptor space") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Static shader resources of a shader should not be assigned shader visible descriptor space"); } else if (m_pResourceCache->DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::SRBResources) { if (res.GetResType() == CachedResourceType::CBV) { - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Constant buffers are bound as root views and should not be assigned shader visible descriptor space") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Constant buffers are bound as root views and should not be assigned shader visible descriptor space"); } else { if(res.Attribs.GetVariableType() == SHADER_VARIABLE_TYPE_DYNAMIC) - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Dynamic resources of a shader resource binding should be assigned shader visible descriptor space at every draw call") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Dynamic resources of a shader resource binding should be assigned shader visible descriptor space at every draw call"); else - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0, "Non-dynamics resources of a shader resource binding must be assigned shader visible descriptor space") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0, "Non-dynamics resources of a shader resource binding must be assigned shader visible descriptor space"); } } else { - UNEXPECTED("Unknown content type") + UNEXPECTED("Unknown content type"); } } #endif @@ -1000,36 +1000,36 @@ void ShaderResourceLayoutD3D12::dbgVerifyBindings()const { VERIFY(res.GetResType() == CachedResourceType::TexSRV, "Sampler can only be assigned to a texture SRV" ); const auto &SamInfo = const_cast(this)->GetAssignedSampler(res); - VERIFY( !SamInfo.Attribs.IsStaticSampler(), "Static samplers should never be assigned space in the cache" ) - VERIFY(SamInfo.Attribs.IsValidBindPoint(), "Sampler bind point must be valid") + VERIFY( !SamInfo.Attribs.IsStaticSampler(), "Static samplers should never be assigned space in the cache" ); + VERIFY(SamInfo.Attribs.IsValidBindPoint(), "Sampler bind point must be valid"); for(Uint32 ArrInd = 0; ArrInd < SamInfo.Attribs.BindCount; ++ArrInd) { const auto &CachedSampler = m_pResourceCache->GetRootTable(SamInfo.RootIndex).GetResource(SamInfo.OffsetFromTableStart + ArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, m_pResources->GetShaderType()); if( CachedSampler.pObject ) - VERIFY(CachedSampler.Type == CachedResourceType::Sampler, "Incorrect cached sampler type") + VERIFY(CachedSampler.Type == CachedResourceType::Sampler, "Incorrect cached sampler type"); else - VERIFY(CachedSampler.Type == CachedResourceType::Unknown, "Unexpected cached sampler type") + VERIFY(CachedSampler.Type == CachedResourceType::Unknown, "Unexpected cached sampler type"); if( !CachedSampler.pObject || CachedSampler.CPUDescriptorHandle.ptr == 0 ) - LOG_ERROR_MESSAGE("No sampler is assigned to texture variable \"", res.Attribs.GetPrintName(ArrInd), "\" in shader \"", GetShaderName(), "\"") + LOG_ERROR_MESSAGE("No sampler is assigned to texture variable \"", res.Attribs.GetPrintName(ArrInd), "\" in shader \"", GetShaderName(), "\""); #ifdef _DEBUG { auto ShdrVisibleHeapCPUDescriptorHandle = m_pResourceCache->GetShaderVisibleTableCPUDescriptorHandle(SamInfo.RootIndex, SamInfo.OffsetFromTableStart + ArrInd); if (m_pResourceCache->DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::StaticShaderResources) { - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Static shader resources of a shader should not be assigned shader visible descriptor space") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Static shader resources of a shader should not be assigned shader visible descriptor space"); } else if (m_pResourceCache->DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::SRBResources) { if(SamInfo.Attribs.GetVariableType() == SHADER_VARIABLE_TYPE_DYNAMIC) - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Dynamic resources of a shader resource binding should be assigned shader visible descriptor space at every draw call") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr == 0, "Dynamic resources of a shader resource binding should be assigned shader visible descriptor space at every draw call"); else - VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0, "Non-dynamics resources of a shader resource binding must be assigned shader visible descriptor space") + VERIFY(ShdrVisibleHeapCPUDescriptorHandle.ptr != 0, "Non-dynamics resources of a shader resource binding must be assigned shader visible descriptor space"); } else { - UNEXPECTED("Unknown content type") + UNEXPECTED("Unknown content type"); } } #endif @@ -1040,17 +1040,17 @@ void ShaderResourceLayoutD3D12::dbgVerifyBindings()const for(Uint32 s=0; s < m_NumSamplers[VarType]; ++s) { const auto &sam = GetSampler(VarType, s); - VERIFY(sam.Attribs.GetVariableType() == VarType, "Unexpected sampler variable type") + VERIFY(sam.Attribs.GetVariableType() == VarType, "Unexpected sampler variable type"); for(Uint32 ArrInd = 0; ArrInd < sam.Attribs.BindCount; ++ArrInd) { const auto &CachedSampler = m_pResourceCache->GetRootTable(sam.RootIndex).GetResource(sam.OffsetFromTableStart + ArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, m_pResources->GetShaderType()); if( CachedSampler.pObject ) - VERIFY(CachedSampler.Type == CachedResourceType::Sampler, "Incorrect cached sampler type") + VERIFY(CachedSampler.Type == CachedResourceType::Sampler, "Incorrect cached sampler type"); else - VERIFY(CachedSampler.Type == CachedResourceType::Unknown, "Unexpected cached sampler type") + VERIFY(CachedSampler.Type == CachedResourceType::Unknown, "Unexpected cached sampler type"); if( !CachedSampler.pObject || CachedSampler.CPUDescriptorHandle.ptr == 0 ) - LOG_ERROR_MESSAGE( "No sampler is bound to sampler variable \"", sam.Attribs.GetPrintName(ArrInd), "\" in shader \"", GetShaderName(), "\"" ) + LOG_ERROR_MESSAGE( "No sampler is bound to sampler variable \"", sam.Attribs.GetPrintName(ArrInd), "\" in shader \"", GetShaderName(), "\"" ); } } } @@ -1079,11 +1079,11 @@ const Char* ShaderResourceLayoutD3D12::GetShaderName()const if(ShaderDesc.ShaderType == m_pResources->GetShaderType()) return ShaderDesc.Name; } - UNEXPECTED("Shader not found") + UNEXPECTED("Shader not found"); } else { - UNEXPECTED("Owner is expected to be a shader or a shader resource binding") + UNEXPECTED("Owner is expected to be a shader or a shader resource binding"); } } return ""; diff --git a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp index f105a218..7310b68e 100644 --- a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp @@ -147,7 +147,7 @@ TextureD3D12Impl :: TextureD3D12Impl(IReferenceCounters *pRefCounters, auto hr = pd3d12Device->CreateCommittedResource( &HeapProps, D3D12_HEAP_FLAG_NONE, &Desc, m_UsageState, pClearValue, __uuidof(m_pd3d12Resource), reinterpret_cast(static_cast(&m_pd3d12Resource)) ); if(FAILED(hr)) - LOG_ERROR_AND_THROW("Failed to create D3D12 texture") + LOG_ERROR_AND_THROW("Failed to create D3D12 texture"); if( *m_Desc.Name != 0) m_pd3d12Resource->SetName(WidenString(m_Desc.Name).c_str()); @@ -156,7 +156,7 @@ TextureD3D12Impl :: TextureD3D12Impl(IReferenceCounters *pRefCounters, { Uint32 ExpectedNumSubresources = static_cast(Desc.MipLevels * (Desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D ? 1 : Desc.DepthOrArraySize) ); if( InitData.NumSubresources != ExpectedNumSubresources ) - LOG_ERROR_AND_THROW("Incorrect number of subresources in init data. ", ExpectedNumSubresources, " expected, while ", InitData.NumSubresources, " provided") + LOG_ERROR_AND_THROW("Incorrect number of subresources in init data. ", ExpectedNumSubresources, " expected, while ", InitData.NumSubresources, " provided"); UINT64 uploadBufferSize = GetRequiredIntermediateSize(m_pd3d12Resource, 0, InitData.NumSubresources); @@ -185,7 +185,7 @@ TextureD3D12Impl :: TextureD3D12Impl(IReferenceCounters *pRefCounters, &BufferDesc, D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, __uuidof(UploadBuffer), reinterpret_cast(static_cast(&UploadBuffer))); if(FAILED(hr)) - LOG_ERROR_AND_THROW("Failed to create committed resource in an upload heap") + LOG_ERROR_AND_THROW("Failed to create committed resource in an upload heap"); auto *pInitContext = pRenderDeviceD3D12->AllocateCommandContext(); // copy data to the intermediate upload heap and then schedule a copy from the upload heap to the default texture @@ -233,7 +233,7 @@ TextureD3D12Impl :: TextureD3D12Impl(IReferenceCounters *pRefCounters, { if (m_Desc.Type != RESOURCE_DIM_TEX_2D && m_Desc.Type != RESOURCE_DIM_TEX_2D_ARRAY) { - LOG_ERROR_AND_THROW("Mipmap generation is only supported for 2D textures and texture arrays") + LOG_ERROR_AND_THROW("Mipmap generation is only supported for 2D textures and texture arrays"); } m_MipUAVs = pRenderDeviceD3D12->AllocateDescriptor(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, m_Desc.MipLevels); @@ -390,7 +390,7 @@ void TextureD3D12Impl::CreateViewInternal( const struct TextureViewDesc &ViewDes catch( const std::runtime_error & ) { const auto *ViewTypeName = GetTexViewTypeLiteralName(ViewDesc.ViewType); - LOG_ERROR("Failed to create view \"", ViewDesc.Name ? ViewDesc.Name : "", "\" (", ViewTypeName, ") for texture \"", m_Desc.Name ? m_Desc.Name : "", "\"" ) + LOG_ERROR("Failed to create view \"", ViewDesc.Name ? ViewDesc.Name : "", "\" (", ViewTypeName, ") for texture \"", m_Desc.Name ? m_Desc.Name : "", "\"" ); } } -- cgit v1.2.3