summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-19 04:11:07 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-19 04:11:07 +0000
commit2777e133867530e717f189eb4206e332165f8321 (patch)
tree965459f1d4689ecbdc84c9c5d2e27131b7fa8030 /Graphics/GraphicsEngineD3D12
parentUpdated API to 240080 + fixed SBTBase (diff)
downloadDiligentCore-2777e133867530e717f189eb4206e332165f8321.tar.gz
DiligentCore-2777e133867530e717f189eb4206e332165f8321.zip
Some updates in D3D12 backend (DXIL patching, PSO initialization)
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/BottomLevelASD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp15
-rw-r--r--Graphics/GraphicsEngineD3D12/include/RootSignature.hpp3
-rw-r--r--Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp150
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RootSignature.cpp21
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp2
6 files changed, 98 insertions, 95 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/BottomLevelASD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/BottomLevelASD3D12Impl.hpp
index 12118e18..5406e590 100644
--- a/Graphics/GraphicsEngineD3D12/include/BottomLevelASD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/BottomLevelASD3D12Impl.hpp
@@ -55,7 +55,7 @@ public:
ID3D12Resource* pd3d12BLAS);
~BottomLevelASD3D12Impl();
- IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_BottomLevelASD3D12, TBottomLevelASBase);
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_BottomLevelASD3D12, TBottomLevelASBase)
/// Implementation of IBottomLevelASD3D12::GetD3D12BLAS().
virtual ID3D12Resource* DILIGENT_CALL_TYPE GetD3D12BLAS() override final { return GetD3D12Resource(); }
diff --git a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp
index 021a38b0..52ab2db3 100644
--- a/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/PipelineStateD3D12Impl.hpp
@@ -56,7 +56,7 @@ public:
PipelineStateD3D12Impl(IReferenceCounters* pRefCounters, RenderDeviceD3D12Impl* pDeviceD3D12, const RayTracingPipelineStateCreateInfo& CreateInfo);
~PipelineStateD3D12Impl();
- virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final;
+ IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_PipelineStateD3D12, TPipelineStateBase)
/// Implementation of IPipelineState::BindStaticResources() in Direct3D12 backend.
virtual void DILIGENT_CALL_TYPE BindStaticResources(Uint32 ShaderFlags, IResourceMapping* pResourceMapping, Uint32 Flags) override final;
@@ -138,9 +138,16 @@ private:
};
using TShaderStages = std::vector<ShaderStageInfo>;
- template <typename PSOCreateInfoType, typename InitPSODescType>
- void InitInternalObjects(const PSOCreateInfoType& CreateInfo, RootSignatureBuilder& RootSigBuilder, TShaderStages& ShaderStages, LocalRootSignature* pLocalRoot, InitPSODescType InitPSODesc);
- void InitResourceLayouts(const PipelineStateCreateInfo& CreateInfo, RootSignatureBuilder& RootSigBuilder, TShaderStages& ShaderStages, LocalRootSignature* pLocalRoot);
+ template <typename PSOCreateInfoType>
+ void InitInternalObjects(const PSOCreateInfoType& CreateInfo,
+ RootSignatureBuilder& RootSigBuilder,
+ TShaderStages& ShaderStages,
+ LocalRootSignature* pLocalRoot = nullptr);
+
+ void InitResourceLayouts(const PipelineStateCreateInfo& CreateInfo,
+ RootSignatureBuilder& RootSigBuilder,
+ TShaderStages& ShaderStages,
+ LocalRootSignature* pLocalRoot);
void Destruct();
diff --git a/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp b/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp
index 44b83433..2d5a968a 100644
--- a/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp
@@ -508,7 +508,6 @@ public:
return m_RootSig.GetHash();
}
- // Note: sizeof(m_ImmutableSamplers) == 56 (MS compiler, release x64)
struct ImmutableSamplerAttribs
{
ImmutableSamplerDesc SamplerDesc;
@@ -536,7 +535,7 @@ private:
RootSignature& m_RootSig;
- std::array<Uint16, D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER + 1> m_NumResources = {};
+ std::array<Uint32, D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER + 1> m_NumResources = {};
std::vector<ImmutableSamplerAttribs, STDAllocatorRawMem<ImmutableSamplerAttribs>> m_ImmutableSamplers;
};
diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
index bb2cb5c4..ea6b3a5c 100644
--- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp
@@ -56,7 +56,7 @@ struct alignas(void*) PSS_SubObject
const D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type{SubObjType};
InnerStructType Obj{};
- PSS_SubObject() {}
+ PSS_SubObject() noexcept {}
PSS_SubObject& operator=(const InnerStructType& obj)
{
@@ -117,11 +117,10 @@ void BuildRTPipelineDescription(const RayTracingPipelineStateCreateInfo& CreateI
const auto ShaderIndexToStr = [&TempPool](Uint32 Index) -> LPCWSTR {
const Uint32 Len = sizeof(Index) * 2;
- auto* Dst = TempPool.Allocate<WCHAR>(Len + 1);
+ auto* const Dst = TempPool.Allocate<WCHAR>(Len + 1);
for (Uint32 i = 0; i < Len; ++i)
{
- Uint32 c = Index & 0xF;
- Dst[i] = static_cast<WCHAR>(c < 10 ? '0' + c : 'A' + c - 10);
+ Dst[Len - 1 - i] = L"0123456789ABCDEF"[Index & 0x0F];
Index >>= 4;
}
Dst[Len] = 0;
@@ -129,44 +128,43 @@ void BuildRTPipelineDescription(const RayTracingPipelineStateCreateInfo& CreateI
};
const auto AddDxilLib = [&](IShader* pShader, const char* Name) -> LPCWSTR {
- if (pShader != nullptr)
+ if (pShader == nullptr)
+ return nullptr;
+
+ auto Result = UniqueShaders.emplace(pShader, nullptr);
+ if (Result.second)
{
- auto Result = UniqueShaders.emplace(pShader, nullptr);
- if (Result.second)
- {
- auto& LibDesc = *TempPool.Construct<D3D12_DXIL_LIBRARY_DESC>();
- auto& ExportDesc = *TempPool.Construct<D3D12_EXPORT_DESC>();
- auto* pShaderD3D12 = ValidatedCast<ShaderD3D12Impl>(pShader);
- Uint32 ShaderIdx = GetShaderTypePipelineIndex(pShaderD3D12->GetDesc().ShaderType, PIPELINE_TYPE_RAY_TRACING);
- auto& BindingMap = BindingMapPerStage[ShaderIdx];
-
- CComPtr<IDxcBlob> pBlob;
- if (!compiler->RemapResourceBinding(BindingMap, reinterpret_cast<IDxcBlob*>(pShaderD3D12->GetShaderByteCode()), &pBlob))
- LOG_ERROR_AND_THROW("Failed to remap resource bindings");
-
- LibDesc.DXILLibrary.BytecodeLength = pBlob->GetBufferSize();
- LibDesc.DXILLibrary.pShaderBytecode = pBlob->GetBufferPointer();
- LibDesc.NumExports = 1;
- LibDesc.pExports = &ExportDesc;
-
- ExportDesc.Flags = D3D12_EXPORT_FLAG_NONE;
- ExportDesc.ExportToRename = TempPool.CopyWString(pShaderD3D12->GetEntryPoint());
-
- if (Name != nullptr)
- ExportDesc.Name = TempPool.CopyWString(Name);
- else
- ExportDesc.Name = ShaderIndexToStr(++ShaderIndex);
-
- Subobjects.push_back({D3D12_STATE_SUBOBJECT_TYPE_DXIL_LIBRARY, &LibDesc});
- ShaderBlobs.push_back(pBlob);
-
- Result.first->second = ExportDesc.Name;
- return ExportDesc.Name;
- }
+ auto& LibDesc = *TempPool.Construct<D3D12_DXIL_LIBRARY_DESC>();
+ auto& ExportDesc = *TempPool.Construct<D3D12_EXPORT_DESC>();
+ auto* pShaderD3D12 = ValidatedCast<ShaderD3D12Impl>(pShader);
+ Uint32 ShaderIdx = GetShaderTypePipelineIndex(pShaderD3D12->GetDesc().ShaderType, PIPELINE_TYPE_RAY_TRACING);
+ auto& BindingMap = BindingMapPerStage[ShaderIdx];
+
+ CComPtr<IDxcBlob> pBlob;
+ if (!compiler->RemapResourceBindings(BindingMap, reinterpret_cast<IDxcBlob*>(pShaderD3D12->GetShaderByteCode()), &pBlob))
+ LOG_ERROR_AND_THROW("Failed to remap resource bindings");
+
+ LibDesc.DXILLibrary.BytecodeLength = pBlob->GetBufferSize();
+ LibDesc.DXILLibrary.pShaderBytecode = pBlob->GetBufferPointer();
+ LibDesc.NumExports = 1;
+ LibDesc.pExports = &ExportDesc;
+
+ ExportDesc.Flags = D3D12_EXPORT_FLAG_NONE;
+ ExportDesc.ExportToRename = TempPool.CopyWString(pShaderD3D12->GetEntryPoint());
+
+ if (Name != nullptr)
+ ExportDesc.Name = TempPool.CopyWString(Name);
else
- return Result.first->second;
+ ExportDesc.Name = ShaderIndexToStr(++ShaderIndex);
+
+ Subobjects.push_back({D3D12_STATE_SUBOBJECT_TYPE_DXIL_LIBRARY, &LibDesc});
+ ShaderBlobs.push_back(pBlob);
+
+ Result.first->second = ExportDesc.Name;
+ return ExportDesc.Name;
}
- return nullptr;
+ else
+ return Result.first->second;
};
ShaderBlobs.reserve(CreateInfo.GeneralShaderCount + CreateInfo.TriangleHitShaderCount + CreateInfo.ProceduralHitShaderCount);
@@ -277,17 +275,18 @@ void GetShaderIdentifiers(ID3D12DeviceChild* pSO,
}
}
-void ExtractResourceBindingMap(const RootSignatureBuilder& RootSig,
- const std::array<Int8, MAX_SHADERS_IN_PIPELINE>& ResourceLayoutIndex,
- const ShaderResourceLayoutD3D12* pResourceLayouts,
- const ShaderResourceLayoutD3D12* pStaticLayouts,
- TBindingMapPerStage& BindingMapPerStage) noexcept(false)
+TBindingMapPerStage ExtractResourceBindingMap(const RootSignatureBuilder& RootSig,
+ const std::array<Int8, MAX_SHADERS_IN_PIPELINE>& ResourceLayoutIndex,
+ const ShaderResourceLayoutD3D12* pResourceLayouts,
+ const ShaderResourceLayoutD3D12* pStaticLayouts) noexcept(false)
{
+ TBindingMapPerStage BindingMapPerStage;
+
const auto ExtractResources = [&](const ShaderResourceLayoutD3D12* pLayouts) //
{
for (Uint32 ShaderIdx = 0; ShaderIdx < ResourceLayoutIndex.size(); ++ShaderIdx)
{
- const Int8 LayoutIdx = ResourceLayoutIndex[ShaderIdx];
+ const auto LayoutIdx = ResourceLayoutIndex[ShaderIdx];
if (LayoutIdx < 0)
continue;
@@ -325,7 +324,7 @@ void ExtractResourceBindingMap(const RootSignatureBuilder&
{
const auto& ImtblSmplr = RootSig.GetImmutableSamplers()[i];
const Uint32 ShaderIdx = GetShaderTypePipelineIndex(ImtblSmplr.ShaderType, PIPELINE_TYPE_RAY_TRACING);
- const Int8 LayoutIdx = ResourceLayoutIndex[ShaderIdx];
+ const auto LayoutIdx = ResourceLayoutIndex[ShaderIdx];
if (LayoutIdx < 0)
continue;
@@ -336,6 +335,8 @@ void ExtractResourceBindingMap(const RootSignatureBuilder&
auto& BindingMap = BindingMapPerStage[ShaderIdx];
BindingMap.emplace(HashMapStringKey{ImtblSmplr.Name.c_str()}, ImtblSmplr.ShaderRegister);
}
+
+ return BindingMapPerStage;
}
} // namespace
@@ -358,12 +359,11 @@ size_t PipelineStateD3D12Impl::ShaderStageInfo::Count() const
}
-template <typename PSOCreateInfoType, typename InitPSODescType>
+template <typename PSOCreateInfoType>
void PipelineStateD3D12Impl::InitInternalObjects(const PSOCreateInfoType& CreateInfo,
RootSignatureBuilder& RootSigBuilder,
TShaderStages& ShaderStages,
- LocalRootSignature* pLocalRoot,
- InitPSODescType InitPSODesc)
+ LocalRootSignature* pLocalRoot)
{
m_ResourceLayoutIndex.fill(-1);
@@ -395,7 +395,7 @@ void PipelineStateD3D12Impl::InitInternalObjects(const PSOCreateInfoType& Create
for (Uint32 s = 0; s < NumShaderStages; ++s)
new (m_pStaticVarManagers + s) ShaderVariableManagerD3D12{*this, GetStaticShaderResCache(s)};
- InitPSODesc(CreateInfo, MemPool);
+ InitializePipelineDesc(CreateInfo, MemPool);
RootSigBuilder.AllocateImmutableSamplers(CreateInfo.PSODesc.ResourceLayout);
@@ -416,12 +416,7 @@ PipelineStateD3D12Impl::PipelineStateD3D12Impl(IReferenceCounters*
{
RootSignatureBuilder RootSigBuilder{m_RootSig};
TShaderStages ShaderStages;
- InitInternalObjects(CreateInfo, RootSigBuilder, ShaderStages, nullptr,
- [this](const GraphicsPipelineStateCreateInfo& CreateInfo, FixedLinearAllocator& MemPool) //
- {
- InitializePipelineDesc(CreateInfo, MemPool);
- } //
- );
+ InitInternalObjects(CreateInfo, RootSigBuilder, ShaderStages);
auto pd3d12Device = pDeviceD3D12->GetD3D12Device();
if (m_Desc.PipelineType == PIPELINE_TYPE_GRAPHICS)
@@ -510,7 +505,6 @@ PipelineStateD3D12Impl::PipelineStateD3D12Impl(IReferenceCounters*
if (FAILED(hr))
LOG_ERROR_AND_THROW("Failed to create pipeline state");
}
-
#ifdef D3D12_H_HAS_MESH_SHADER
else if (m_Desc.PipelineType == PIPELINE_TYPE_MESH)
{
@@ -628,12 +622,7 @@ PipelineStateD3D12Impl::PipelineStateD3D12Impl(IReferenceCounters*
{
RootSignatureBuilder RootSigBuilder{m_RootSig};
TShaderStages ShaderStages;
- InitInternalObjects(CreateInfo, RootSigBuilder, ShaderStages, nullptr,
- [this](const ComputePipelineStateCreateInfo& CreateInfo, FixedLinearAllocator& MemPool) //
- {
- InitializePipelineDesc(CreateInfo, MemPool);
- } //
- );
+ InitInternalObjects(CreateInfo, RootSigBuilder, ShaderStages);
auto pd3d12Device = pDeviceD3D12->GetD3D12Device();
@@ -686,25 +675,24 @@ PipelineStateD3D12Impl::PipelineStateD3D12Impl(IReferenceCounters*
{
try
{
- LocalRootSignature LocalRootSig{CreateInfo.pShaderRecordName, CreateInfo.RayTracingPipeline.ShaderRecordSize};
- TShaderStages ShaderStages;
- DynamicLinearAllocator TempPool{GetRawAllocator(), 4 << 10};
- RootSignatureBuilder RootSigBuilder{m_RootSig};
-
- InitInternalObjects(CreateInfo, RootSigBuilder, ShaderStages, &LocalRootSig,
- [&](const RayTracingPipelineStateCreateInfo& CreateInfo, FixedLinearAllocator& MemPool) //
- {
- InitializePipelineDesc(CreateInfo, MemPool);
- } //
- );
+ LocalRootSignature LocalRootSig{CreateInfo.pShaderRecordName, CreateInfo.RayTracingPipeline.ShaderRecordSize};
+ TShaderStages ShaderStages;
+ RootSignatureBuilder RootSigBuilder{m_RootSig};
+ InitInternalObjects(CreateInfo, RootSigBuilder, ShaderStages, &LocalRootSig);
- auto pd3d12Device = pDeviceD3D12->GetD3D12Device5();
+ auto* pd3d12Device = pDeviceD3D12->GetD3D12Device5();
- TBindingMapPerStage BindingMapPerStage;
- ExtractResourceBindingMap(RootSigBuilder, m_ResourceLayoutIndex, &m_pShaderResourceLayouts[0], &m_pShaderResourceLayouts[GetNumShaderStages()], BindingMapPerStage);
+ const auto* const pStaticResLayouts = m_pShaderResourceLayouts + GetNumShaderStages();
+ // Extract bindings (shader registers) assigned during the layout initialization,
+ // for every shader stage.
+ const auto BindingMapPerStage =
+ ExtractResourceBindingMap(RootSigBuilder, m_ResourceLayoutIndex, m_pShaderResourceLayouts, pStaticResLayouts);
+ DynamicLinearAllocator TempPool{GetRawAllocator(), 4 << 10};
std::vector<D3D12_STATE_SUBOBJECT> Subobjects;
std::vector<CComPtr<IDxcBlob>> ShaderBlobs;
+ // Create ray-tracing pipeline and remap shader registers using the bind points assigned during the
+ // resource layout initialization.
BuildRTPipelineDescription(CreateInfo, Subobjects, ShaderBlobs, TempPool, pDeviceD3D12->GetDxCompiler(), BindingMapPerStage);
D3D12_GLOBAL_ROOT_SIGNATURE GlobalRoot = {m_RootSig.GetD3D12RootSignature()};
@@ -783,8 +771,6 @@ void PipelineStateD3D12Impl::Destruct()
}
}
-IMPLEMENT_QUERY_INTERFACE(PipelineStateD3D12Impl, IID_PipelineStateD3D12, TPipelineStateBase)
-
void PipelineStateD3D12Impl::InitResourceLayouts(const PipelineStateCreateInfo& CreateInfo,
RootSignatureBuilder& RootSigBuilder,
TShaderStages& ShaderStages,
@@ -800,7 +786,7 @@ void PipelineStateD3D12Impl::InitResourceLayouts(const PipelineStateCreateInfo&
{
for (auto* pShader : ShaderStages[s].Shaders)
{
- Resources.push_back(&(*pShader->GetShaderResources()));
+ Resources.push_back(pShader->GetShaderResources().get());
}
}
ShaderResources::DvpVerifyResourceLayout(ResourceLayout, Resources.data(), static_cast<Uint32>(Resources.size()),
@@ -878,7 +864,7 @@ void PipelineStateD3D12Impl::InitResourceLayouts(const PipelineStateCreateInfo&
void PipelineStateD3D12Impl::CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources)
{
auto& SRBAllocator = m_pDevice->GetSRBAllocator();
- auto pResBindingD3D12 = NEW_RC_OBJ(SRBAllocator, "ShaderResourceBindingD3D12Impl instance", ShaderResourceBindingD3D12Impl)(this, false);
+ auto* pResBindingD3D12 = NEW_RC_OBJ(SRBAllocator, "ShaderResourceBindingD3D12Impl instance", ShaderResourceBindingD3D12Impl)(this, false);
if (InitStaticResources)
pResBindingD3D12->InitializeStaticResources(nullptr);
pResBindingD3D12->QueryInterface(IID_ShaderResourceBinding, reinterpret_cast<IObject**>(ppShaderResourceBinding));
@@ -1028,7 +1014,7 @@ void PipelineStateD3D12Impl::BindStaticResources(Uint32 ShaderFlags, IResourceMa
{
for (Uint32 s = 0; s < GetNumShaderStages(); ++s)
{
- auto ShaderType = GetStaticShaderResLayout(s).GetShaderType();
+ const auto ShaderType = GetStaticShaderResLayout(s).GetShaderType();
if ((ShaderFlags & ShaderType) != 0)
m_pStaticVarManagers[s].BindResources(pResourceMapping, Flags);
}
diff --git a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp
index ab997d1d..5b45511b 100644
--- a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp
@@ -39,7 +39,14 @@
namespace Diligent
{
-static constexpr auto RayTracingMask = SHADER_TYPE_RAY_GEN | SHADER_TYPE_RAY_MISS | SHADER_TYPE_RAY_CLOSEST_HIT | SHADER_TYPE_RAY_ANY_HIT | SHADER_TYPE_RAY_INTERSECTION | SHADER_TYPE_CALLABLE;
+
+static constexpr auto RAY_TRACING_SHADER_TYPES =
+ SHADER_TYPE_RAY_GEN |
+ SHADER_TYPE_RAY_MISS |
+ SHADER_TYPE_RAY_CLOSEST_HIT |
+ SHADER_TYPE_RAY_ANY_HIT |
+ SHADER_TYPE_RAY_INTERSECTION |
+ SHADER_TYPE_CALLABLE;
RootSignature::RootParamsManager::RootParamsManager(IMemoryAllocator& MemAllocator) :
m_MemAllocator{MemAllocator},
@@ -190,7 +197,7 @@ void RootSignatureBuilder::InitImmutableSampler(SHADER_TYPE
ImtblSmplr.RegisterSpace = 0;
ImtblSmplr.Name = SamplerName;
- if (ShaderType & RayTracingMask)
+ if (ShaderType & RAY_TRACING_SHADER_TYPES)
{
ImtblSmplr.ShaderRegister = m_NumResources[D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER];
m_NumResources[D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER] += SamplerAttribs.BindCount;
@@ -222,14 +229,17 @@ void RootSignatureBuilder::AllocateResourceSlot(SHADER_TYPE
const auto ShaderVisibility = ShaderTypeToD3D12ShaderVisibility(ShaderType);
auto& RootParams = m_RootSig.m_RootParams;
- // update resource binding for ray tracing
- if (ShaderType & RayTracingMask)
+ if (ShaderType & RAY_TRACING_SHADER_TYPES)
{
+ // For ray tracing shaders, original bind points are ignored as
+ // they will be remapped anyway.
BindPoint = m_NumResources[RangeType];
m_NumResources[RangeType] += ShaderResAttribs.BindCount;
}
else
+ {
BindPoint = ShaderResAttribs.BindPoint;
+ }
if (RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_CBV && ShaderResAttribs.BindCount == 1)
{
@@ -415,7 +425,8 @@ void RootSignatureBuilder::Finalize(ID3D12Device* pd3d12Device)
CComPtr<ID3DBlob> signature;
CComPtr<ID3DBlob> error;
- HRESULT hr = D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error);
+
+ HRESULT hr = D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error);
if (error)
{
LOG_ERROR_MESSAGE("Error: ", (const char*)error->GetBufferPointer());
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
index 771e2c23..75cb408b 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
@@ -145,7 +145,7 @@ void ShaderResourceLayoutD3D12::Initialize(ID3D12Device*
m_pd3d12Device = pd3d12Device;
VERIFY_EXPR((pResourceCache != nullptr) ^ (pRootSig != nullptr));
- VERIFY_EXPR(Shaders.size() > 0);
+ VERIFY_EXPR(!Shaders.empty());
const Uint32 AllowedTypeBits = GetAllowedTypeBits(AllowedVarTypes, NumAllowedTypes);