summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorazhirnov <zh1dron@gmail.com>2021-03-02 18:01:34 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:14 +0000
commit3d100ff6a817460c104ad5c27b42e107c26b04a4 (patch)
tree5895882b2e14275be691b632d2fb67930537aaa1 /Graphics/GraphicsEngineD3D12
parentAdded shader compiler macros to shader source (diff)
downloadDiligentCore-3d100ff6a817460c104ad5c27b42e107c26b04a4.tar.gz
DiligentCore-3d100ff6a817460c104ad5c27b42e107c26b04a4.zip
Removed mutable fields from ResourceBindingMap
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp8
-rw-r--r--Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp9
2 files changed, 14 insertions, 3 deletions
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");
}