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/GraphicsEngine | |
| parent | Removed unused ShaderVariableManagerGL::dvpVerifyBindings (diff) | |
| download | DiligentCore-a615dcf84ce573e784e56a50bc8c2809f69c7ea7.tar.gz DiligentCore-a615dcf84ce573e784e56a50bc8c2809f69c7ea7.zip | |
Moved ProcessSignatureResources method to PipelineResourceSignatureBase
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp index db5cb061..c2f3e2bc 100644 --- a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp @@ -376,6 +376,35 @@ public: return m_SRBMemAllocator; } + // Processes resources with the allowed variable types in the allowed shader stages + // and calls user-provided handler for each resource. + template <typename HandlerType> + void ProcessResources(const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes, + Uint32 NumAllowedTypes, + SHADER_TYPE AllowedStages, + HandlerType Handler) const + { + if (AllowedVarTypes == nullptr) + NumAllowedTypes = 1; + + for (Uint32 TypeIdx = 0; TypeIdx < NumAllowedTypes; ++TypeIdx) + { + const auto IdxRange = AllowedVarTypes != nullptr ? + GetResourceIndexRange(AllowedVarTypes[TypeIdx]) : + std::make_pair<Uint32, Uint32>(0, GetTotalResourceCount()); + for (Uint32 ResIdx = IdxRange.first; ResIdx < IdxRange.second; ++ResIdx) + { + const auto& ResDesc = GetResourceDesc(ResIdx); + VERIFY_EXPR(AllowedVarTypes == nullptr || ResDesc.VarType == AllowedVarTypes[TypeIdx]); + + if ((ResDesc.ShaderStages & AllowedStages) != 0) + { + Handler(ResDesc, ResIdx); + } + } + } + } + protected: template <typename TReserveCustomData> FixedLinearAllocator AllocateInternalObjects(IMemoryAllocator& RawAllocator, |
