summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-02-20 00:08:39 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:09 +0000
commitabb6f8c12bdb7639ee4a200fa1243b1e6fb96dac (patch)
treef6dd312a1840b1955d2581cf1190092b5db76840 /Graphics/GraphicsEngineD3D12
parentMoved duplicate static resources logic from PipelineResourceSignatureD3D12Imp... (diff)
downloadDiligentCore-abb6f8c12bdb7639ee4a200fa1243b1e6fb96dac.tar.gz
DiligentCore-abb6f8c12bdb7639ee4a200fa1243b1e6fb96dac.zip
Unified static resource methods in PipelineResourceSignatureVkImpl and PipelineResourceSignatureD3D12Impl
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp36
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp4
3 files changed, 8 insertions, 36 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp
index 3e6428af..9c0b3ad0 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp
@@ -99,8 +99,8 @@ public:
void Destroy(IMemoryAllocator& Allocator);
- ShaderVariableD3D12Impl* GetVariable(const Char* Name);
- ShaderVariableD3D12Impl* GetVariable(Uint32 Index);
+ ShaderVariableD3D12Impl* GetVariable(const Char* Name) const;
+ ShaderVariableD3D12Impl* GetVariable(Uint32 Index) const;
void BindResources(IResourceMapping* pResourceMapping, Uint32 Flags);
diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp
index 4eb6bc1e..e61dd9fd 100644
--- a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp
@@ -428,52 +428,24 @@ void PipelineResourceSignatureD3D12Impl::CreateShaderResourceBinding(IShaderReso
Uint32 PipelineResourceSignatureD3D12Impl::GetStaticVariableCount(SHADER_TYPE ShaderType) const
{
- const auto VarMngrInd = GetStaticVariableCountHelper(ShaderType);
- if (VarMngrInd < 0)
- return 0;
-
- auto& StaticVarMgr = m_StaticVarsMgrs[VarMngrInd];
- return StaticVarMgr.GetVariableCount();
+ return GetStaticVariableCountImpl(ShaderType, m_StaticVarsMgrs);
}
IShaderResourceVariable* PipelineResourceSignatureD3D12Impl::GetStaticVariableByName(SHADER_TYPE ShaderType, const Char* Name)
{
- const auto VarMngrInd = GetStaticVariableByNameHelper(ShaderType, Name);
- if (VarMngrInd < 0)
- return nullptr;
-
- auto& StaticVarMgr = m_StaticVarsMgrs[VarMngrInd];
- return StaticVarMgr.GetVariable(Name);
+ return GetStaticVariableByNameImpl(ShaderType, Name, m_StaticVarsMgrs);
}
IShaderResourceVariable* PipelineResourceSignatureD3D12Impl::GetStaticVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index)
{
- const auto VarMngrInd = GetStaticVariableByIndexHelper(ShaderType, Index);
- if (VarMngrInd < 0)
- return nullptr;
-
- auto& StaticVarMgr = m_StaticVarsMgrs[VarMngrInd];
- return StaticVarMgr.GetVariable(Index);
+ return GetStaticVariableByIndexImpl(ShaderType, Index, m_StaticVarsMgrs);
}
void PipelineResourceSignatureD3D12Impl::BindStaticResources(Uint32 ShaderFlags,
IResourceMapping* pResMapping,
Uint32 Flags)
{
- const auto PipelineType = GetPipelineType();
- for (Uint32 ShaderInd = 0; ShaderInd < m_StaticResStageIndex.size(); ++ShaderInd)
- {
- const auto VarMngrInd = m_StaticResStageIndex[ShaderInd];
- if (VarMngrInd >= 0)
- {
- // ShaderInd is the shader type pipeline index here
- const auto ShaderType = GetShaderTypeFromPipelineIndex(ShaderInd, PipelineType);
- if (ShaderFlags & ShaderType)
- {
- m_StaticVarsMgrs[VarMngrInd].BindResources(pResMapping, Flags);
- }
- }
- }
+ BindStaticResourcesImpl(ShaderFlags, pResMapping, Flags, m_StaticVarsMgrs);
}
size_t PipelineResourceSignatureD3D12Impl::CalculateHash() const
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp
index fb71679d..08000a6e 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp
@@ -135,7 +135,7 @@ void ShaderVariableManagerD3D12::Destroy(IMemoryAllocator& Allocator)
}
}
-ShaderVariableD3D12Impl* ShaderVariableManagerD3D12::GetVariable(const Char* Name)
+ShaderVariableD3D12Impl* ShaderVariableManagerD3D12::GetVariable(const Char* Name) const
{
ShaderVariableD3D12Impl* pVar = nullptr;
for (Uint32 v = 0; v < m_NumVariables; ++v)
@@ -152,7 +152,7 @@ ShaderVariableD3D12Impl* ShaderVariableManagerD3D12::GetVariable(const Char* Nam
}
-ShaderVariableD3D12Impl* ShaderVariableManagerD3D12::GetVariable(Uint32 Index)
+ShaderVariableD3D12Impl* ShaderVariableManagerD3D12::GetVariable(Uint32 Index) const
{
if (Index >= m_NumVariables)
{