From 7a148ffcd6569ad21dc112c1823feb7b7477cb10 Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 15 Feb 2021 19:06:56 -0800 Subject: Removed duplicates of FindAssignedSampler and FindImmutableSampler functions --- .../include/PipelineResourceSignatureVkImpl.hpp | 3 --- .../src/PipelineResourceSignatureVkImpl.cpp | 29 ++-------------------- 2 files changed, 2 insertions(+), 30 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp index ea20151b..4236f7c1 100644 --- a/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/PipelineResourceSignatureVkImpl.hpp @@ -316,9 +316,6 @@ private: size_t CalculateHash() const; - // Finds a separate sampler assigned to the image SepImg and returns its index in m_Desc.Resources. - Uint32 FindAssignedSampler(const PipelineResourceDesc& SepImg) const; - static inline CACHE_GROUP GetResourceCacheGroup(const PipelineResourceDesc& Res); static inline DESCRIPTOR_SET_ID VarTypeToDescriptorSetId(SHADER_RESOURCE_VARIABLE_TYPE VarType); diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp index 000d3458..a4928130 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp @@ -468,7 +468,7 @@ void PipelineResourceSignatureVkImpl::CreateSetLayouts(const CacheOffsetsType& C // The sampler may not be yet initialized, but this is OK as all resources are initialized // in the same order as in m_Desc.Resources const auto AssignedSamplerInd = DescrType == DescriptorType::SeparateImage ? - FindAssignedSampler(ResDesc) : + FindAssignedSampler(ResDesc, ResourceAttribs::InvalidSamplerInd) : ResourceAttribs::InvalidSamplerInd; VkSampler* pVkImmutableSamplers = nullptr; @@ -478,7 +478,7 @@ void PipelineResourceSignatureVkImpl::CreateSetLayouts(const CacheOffsetsType& C // Only search for immutable sampler for combined image samplers and separate samplers. // Note that for DescriptorType::SeparateImage with immutable sampler, we will initialize // a separate immutable sampler below. It will not be assigned to the image variable. - Int32 SrcImmutableSamplerInd = FindImmutableSampler(ResDesc, DescrType, m_Desc, GetCombinedSamplerSuffix()); + const auto SrcImmutableSamplerInd = FindImmutableSampler(ResDesc, DescrType, m_Desc, GetCombinedSamplerSuffix()); if (SrcImmutableSamplerInd >= 0) { auto& ImmutableSampler = m_ImmutableSamplers[SrcImmutableSamplerInd]; @@ -654,31 +654,6 @@ void PipelineResourceSignatureVkImpl::CreateSetLayouts(const CacheOffsetsType& C VERIFY_EXPR(NumSets == GetNumDescriptorSets()); } -Uint32 PipelineResourceSignatureVkImpl::FindAssignedSampler(const PipelineResourceDesc& SepImg) const -{ - Uint32 SamplerInd = ResourceAttribs::InvalidSamplerInd; - if (IsUsingCombinedSamplers()) - { - const auto IdxRange = GetResourceIndexRange(SepImg.VarType); - - for (Uint32 i = IdxRange.first; i < IdxRange.second; ++i) - { - const auto& Res = m_Desc.Resources[i]; - VERIFY_EXPR(SepImg.VarType == Res.VarType); - - if (Res.ResourceType == SHADER_RESOURCE_TYPE_SAMPLER && - (SepImg.ShaderStages & Res.ShaderStages) && - StreqSuff(Res.Name, SepImg.Name, GetCombinedSamplerSuffix())) - { - VERIFY_EXPR((Res.ShaderStages & SepImg.ShaderStages) == SepImg.ShaderStages); - SamplerInd = i; - break; - } - } - } - return SamplerInd; -} - size_t PipelineResourceSignatureVkImpl::CalculateHash() const { if (m_Desc.NumResources == 0 && m_Desc.NumImmutableSamplers == 0) -- cgit v1.2.3