From abb6f8c12bdb7639ee4a200fa1243b1e6fb96dac Mon Sep 17 00:00:00 2001 From: assiduous Date: Fri, 19 Feb 2021 16:08:39 -0800 Subject: Unified static resource methods in PipelineResourceSignatureVkImpl and PipelineResourceSignatureD3D12Impl --- .../src/PipelineResourceSignatureVkImpl.cpp | 35 +++------------------- 1 file changed, 4 insertions(+), 31 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp index 2489ee10..9bff0621 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp @@ -747,51 +747,24 @@ void PipelineResourceSignatureVkImpl::CreateShaderResourceBinding(IShaderResourc Uint32 PipelineResourceSignatureVkImpl::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* PipelineResourceSignatureVkImpl::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* PipelineResourceSignatureVkImpl::GetStaticVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) { - const auto VarMngrInd = GetStaticVariableByIndexHelper(ShaderType, Index); - if (VarMngrInd < 0) - return nullptr; - - const auto& StaticVarMgr = m_StaticVarsMgrs[VarMngrInd]; - return StaticVarMgr.GetVariable(Index); + return GetStaticVariableByIndexImpl(ShaderType, Index, m_StaticVarsMgrs); } void PipelineResourceSignatureVkImpl::BindStaticResources(Uint32 ShaderFlags, IResourceMapping* pResMapping, Uint32 Flags) { - const auto PipelineType = GetPipelineType(); - for (auto StaticResStageIdx : m_StaticResStageIndex) - { - if (StaticResStageIdx >= 0) - { - // ShaderInd is the shader type pipeline index here - const auto ShaderType = GetShaderTypeFromPipelineIndex(StaticResStageIdx, PipelineType); - if (ShaderFlags & ShaderType) - { - m_StaticVarsMgrs[StaticResStageIdx].BindResources(pResMapping, Flags); - } - } - } + BindStaticResourcesImpl(ShaderFlags, pResMapping, Flags, m_StaticVarsMgrs); } void PipelineResourceSignatureVkImpl::InitSRBResourceCache(ShaderResourceCacheVk& ResourceCache, -- cgit v1.2.3