diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-03-10 00:37:37 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:18 +0000 |
| commit | a615dcf84ce573e784e56a50bc8c2809f69c7ea7 (patch) | |
| tree | b57378ad5beac728138cfd5b51fd96b926168a87 /Graphics/GraphicsEngineVulkan | |
| parent | Removed unused ShaderVariableManagerGL::dvpVerifyBindings (diff) | |
| download | DiligentCore-a615dcf84ce573e784e56a50bc8c2809f69c7ea7.tar.gz DiligentCore-a615dcf84ce573e784e56a50bc8c2809f69c7ea7.zip | |
Moved ProcessSignatureResources method to PipelineResourceSignatureBase
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/include/ShaderVariableManagerVk.hpp | 7 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/ShaderVariableManagerVk.cpp | 52 |
2 files changed, 19 insertions, 40 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderVariableManagerVk.hpp b/Graphics/GraphicsEngineVulkan/include/ShaderVariableManagerVk.hpp index b5d0c687..b2980659 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderVariableManagerVk.hpp +++ b/Graphics/GraphicsEngineVulkan/include/ShaderVariableManagerVk.hpp @@ -115,13 +115,6 @@ private: const PipelineResourceDesc& GetResourceDesc(Uint32 Index) const; const ResourceAttribs& GetAttribs(Uint32 Index) const; - template <typename HandlerType> - static void ProcessSignatureResources(const PipelineResourceSignatureVkImpl& Signature, - const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes, - Uint32 NumAllowedTypes, - SHADER_TYPE ShaderStages, - HandlerType Handler); - private: PipelineResourceSignatureVkImpl const* m_pSignature = nullptr; diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVariableManagerVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVariableManagerVk.cpp index 71d2811a..58b16b90 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVariableManagerVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVariableManagerVk.cpp @@ -35,40 +35,26 @@ namespace Diligent { template <typename HandlerType> -void ShaderVariableManagerVk::ProcessSignatureResources(const PipelineResourceSignatureVkImpl& Signature, - const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes, - Uint32 NumAllowedTypes, - SHADER_TYPE ShaderStages, - HandlerType Handler) +void ProcessSignatureResources(const PipelineResourceSignatureVkImpl& Signature, + const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes, + Uint32 NumAllowedTypes, + SHADER_TYPE ShaderStages, + HandlerType Handler) { - const Uint32 AllowedTypeBits = GetAllowedTypeBits(AllowedVarTypes, NumAllowedTypes); - const bool UsingSeparateSamplers = Signature.IsUsingSeparateSamplers(); - - for (Uint32 var_type = 0; var_type < SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES; ++var_type) - { - const auto VarType = static_cast<SHADER_RESOURCE_VARIABLE_TYPE>(var_type); - if (IsAllowedType(VarType, AllowedTypeBits)) - { - const auto ResIdxRange = Signature.GetResourceIndexRange(VarType); - for (Uint32 r = ResIdxRange.first; r < ResIdxRange.second; ++r) - { - const auto& Res = Signature.GetResourceDesc(r); - const auto& Attr = Signature.GetResourceAttribs(r); - VERIFY_EXPR(Res.VarType == VarType); - - if ((Res.ShaderStages & ShaderStages) == 0) - continue; - - // When using HLSL-style combined image samplers, we need to skip separate samplers. - // Also always skip immutable separate samplers. - if (Res.ResourceType == SHADER_RESOURCE_TYPE_SAMPLER && - (!UsingSeparateSamplers || Attr.IsImmutableSamplerAssigned())) - continue; - - Handler(r); - } - } - } + const bool UsingSeparateSamplers = Signature.IsUsingSeparateSamplers(); + Signature.ProcessResources(AllowedVarTypes, NumAllowedTypes, ShaderStages, + [&](const PipelineResourceDesc& ResDesc, Uint32 Index) // + { + const auto& ResAttr = Signature.GetResourceAttribs(Index); + + // When using HLSL-style combined image samplers, we need to skip separate samplers. + // Also always skip immutable separate samplers. + if (ResDesc.ResourceType == SHADER_RESOURCE_TYPE_SAMPLER && + (!UsingSeparateSamplers || ResAttr.IsImmutableSamplerAssigned())) + return; + + Handler(Index); + }); } size_t ShaderVariableManagerVk::GetRequiredMemorySize(const PipelineResourceSignatureVkImpl& Signature, |
