summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-03-10 00:37:37 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:18 +0000
commita615dcf84ce573e784e56a50bc8c2809f69c7ea7 (patch)
treeb57378ad5beac728138cfd5b51fd96b926168a87 /Graphics/GraphicsEngineD3D12
parentRemoved unused ShaderVariableManagerGL::dvpVerifyBindings (diff)
downloadDiligentCore-a615dcf84ce573e784e56a50bc8c2809f69c7ea7.tar.gz
DiligentCore-a615dcf84ce573e784e56a50bc8c2809f69c7ea7.zip
Moved ProcessSignatureResources method to PipelineResourceSignatureBase
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp7
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp51
2 files changed, 18 insertions, 40 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp
index a67b977c..7fc3c6dc 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderVariableManagerD3D12.hpp
@@ -120,13 +120,6 @@ private:
const PipelineResourceDesc& GetResourceDesc(Uint32 Index) const;
const ResourceAttribs& GetResourceAttribs(Uint32 Index) const;
- template <typename HandlerType>
- static void ProcessSignatureResources(const PipelineResourceSignatureD3D12Impl& Signature,
- const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes,
- Uint32 NumAllowedTypes,
- SHADER_TYPE ShaderStages,
- HandlerType Handler);
-
private:
PipelineResourceSignatureD3D12Impl const* m_pSignature = nullptr;
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp
index 9078debb..b8e33cb0 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderVariableManagerD3D12.cpp
@@ -37,40 +37,25 @@ namespace Diligent
{
template <typename HandlerType>
-void ShaderVariableManagerD3D12::ProcessSignatureResources(const PipelineResourceSignatureD3D12Impl& Signature,
- const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes,
- Uint32 NumAllowedTypes,
- SHADER_TYPE ShaderStages,
- HandlerType Handler)
+void ProcessSignatureResources(const PipelineResourceSignatureD3D12Impl& Signature,
+ const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes,
+ Uint32 NumAllowedTypes,
+ SHADER_TYPE ShaderStages,
+ HandlerType Handler)
{
- const Uint32 AllowedTypeBits = GetAllowedTypeBits(AllowedVarTypes, NumAllowedTypes);
- const bool UsingCombinedSamplers = Signature.IsUsingCombinedSamplers();
-
- for (SHADER_RESOURCE_VARIABLE_TYPE VarType = SHADER_RESOURCE_VARIABLE_TYPE_STATIC; VarType < SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES; VarType = static_cast<SHADER_RESOURCE_VARIABLE_TYPE>(VarType + 1))
- {
- 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))
- continue;
-
- if (Res.ResourceType == SHADER_RESOURCE_TYPE_SAMPLER &&
- (UsingCombinedSamplers || Attr.IsImmutableSamplerAssigned()))
- {
- // Skip samplers combined with textures and immutable samplers
- continue;
- }
-
- Handler(r);
- }
- }
- }
+ const bool UsingCombinedSamplers = Signature.IsUsingCombinedSamplers();
+ Signature.ProcessResources(AllowedVarTypes, NumAllowedTypes, ShaderStages,
+ [&](const PipelineResourceDesc& ResDesc, Uint32 Index) //
+ {
+ const auto& ResAttr = Signature.GetResourceAttribs(Index);
+
+ // Skip samplers combined with textures and immutable samplers
+ if (ResDesc.ResourceType == SHADER_RESOURCE_TYPE_SAMPLER &&
+ (UsingCombinedSamplers || ResAttr.IsImmutableSamplerAssigned()))
+ return;
+
+ Handler(Index);
+ });
}
size_t ShaderVariableManagerD3D12::GetRequiredMemorySize(const PipelineResourceSignatureD3D12Impl& Signature,