From 3d100ff6a817460c104ad5c27b42e107c26b04a4 Mon Sep 17 00:00:00 2001 From: azhirnov Date: Tue, 2 Mar 2021 21:01:34 +0300 Subject: Removed mutable fields from ResourceBindingMap --- .../src/PipelineResourceSignatureD3D12Impl.cpp | 8 ++++++-- Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp | 9 ++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp index edfbeda7..beb3d675 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp @@ -341,6 +341,7 @@ void PipelineResourceSignatureD3D12Impl::AllocateRootParameters(StaticResCacheTb const auto IsArray = ResDesc.ArraySize != 1; d3d12RootParamType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE; + static_assert(SHADER_RESOURCE_TYPE_LAST == SHADER_RESOURCE_TYPE_ACCEL_STRUCT, "Please update the switch below to handle the new shader resource type"); switch (ResDesc.ResourceType) { case SHADER_RESOURCE_TYPE_CONSTANT_BUFFER: @@ -635,6 +636,7 @@ void PipelineResourceSignatureD3D12Impl::CommitRootViews(const CommitCacheResour VERIFY_EXPR(BufferGPUAddress != 0); auto* const pd3d12CmdList = CommitAttribs.Ctx.GetCommandList(); + static_assert(SHADER_RESOURCE_TYPE_LAST == SHADER_RESOURCE_TYPE_ACCEL_STRUCT, "Please update the switch below to handle the new shader resource type"); switch (Res.Type) { case SHADER_RESOURCE_TYPE_CONSTANT_BUFFER: @@ -792,7 +794,8 @@ void PipelineResourceSignatureD3D12Impl::UpdateShaderResourceBindingMap(Resource { Attribs.Register, Attribs.Space + BaseRegisterSpace, - ResDesc.ArraySize // + ResDesc.ArraySize, + ResDesc.ResourceType // }; auto IsUnique = ResourceMap.emplace(HashMapStringKey{ResDesc.Name}, BindInfo).second; VERIFY(IsUnique, "Shader resource '", ResDesc.Name, @@ -816,7 +819,8 @@ void PipelineResourceSignatureD3D12Impl::UpdateShaderResourceBindingMap(Resource { SampAttr.ShaderRegister, SampAttr.RegisterSpace + BaseRegisterSpace, - SampAttr.ArraySize // + SampAttr.ArraySize, + SHADER_RESOURCE_TYPE_SAMPLER // }; auto it_inserted = ResourceMap.emplace(HashMapStringKey{SampName}, BindInfo); diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp index 549f7065..1ac3e9dd 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp @@ -608,7 +608,14 @@ void PipelineStateD3D12Impl::InitRootSignature(const PipelineStateCreateInfo& Cr if (pLocalRootSig != nullptr && pLocalRootSig->IsDefined()) { - bool IsUnique = ResourceMap.emplace(HashMapStringKey{pLocalRootSig->GetName()}, ResourceBinding::BindInfo{pLocalRootSig->GetShaderRegister(), pLocalRootSig->GetRegisterSpace(), 1}).second; + ResourceBinding::BindInfo BindInfo // + { + pLocalRootSig->GetShaderRegister(), + pLocalRootSig->GetRegisterSpace(), + 1, + SHADER_RESOURCE_TYPE_CONSTANT_BUFFER // + }; + bool IsUnique = ResourceMap.emplace(HashMapStringKey{pLocalRootSig->GetName()}, BindInfo).second; if (!IsUnique) LOG_ERROR_AND_THROW("Shader record constant buffer already exists in the resource signature"); } -- cgit v1.2.3