From 28c3ade2e429349d3d1b24147c1b363518111cc2 Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 15 Feb 2021 19:07:28 -0800 Subject: ShaderResources: removed obsolete functions --- .../include/ShaderResources.hpp | 11 -- .../GraphicsEngineD3DBase/src/ShaderResources.cpp | 118 --------------------- 2 files changed, 129 deletions(-) (limited to 'Graphics/GraphicsEngineD3DBase') diff --git a/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp b/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp index 4a6930c8..dcd0289b 100644 --- a/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp +++ b/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp @@ -380,17 +380,6 @@ public: size_t GetHash() const; - SHADER_RESOURCE_VARIABLE_TYPE FindVariableType(const D3DShaderResourceAttribs& ResourceAttribs, - const PipelineResourceLayoutDesc& ResourceLayout) const; - - Int32 FindImmutableSampler(const D3DShaderResourceAttribs& ResourceAttribs, - const PipelineResourceLayoutDesc& ResourceLayoutDesc, - bool LogImmutableSamplerArrayError) const; - - D3DShaderResourceCounters CountResources(const PipelineResourceLayoutDesc& ResourceLayout, - const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes, - Uint32 NumAllowedTypes, - bool CountImmutableSamplers) const noexcept; #ifdef DILIGENT_DEVELOPMENT static void DvpVerifyResourceLayout(const PipelineResourceLayoutDesc& ResourceLayout, const ShaderResources* const pShaderResources[], diff --git a/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp b/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp index 4694a44f..0142bea1 100644 --- a/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp +++ b/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp @@ -106,124 +106,6 @@ void ShaderResources::AllocateMemory(IMemoryAllocator& Allocator, } } -SHADER_RESOURCE_VARIABLE_TYPE ShaderResources::FindVariableType(const D3DShaderResourceAttribs& ResourceAttribs, - const PipelineResourceLayoutDesc& ResourceLayout) const -{ - if (ResourceAttribs.GetInputType() == D3D_SIT_SAMPLER) - { - // Only use CombinedSamplerSuffix when looking for the sampler variable type - return GetShaderVariableType( - m_ShaderType, ResourceLayout.DefaultVariableType, ResourceLayout.Variables, ResourceLayout.NumVariables, - [&](const char* VarName) // - { - return StreqSuff(ResourceAttribs.Name, VarName, m_SamplerSuffix); - } // - ); - } - else - { - return GetShaderVariableType(m_ShaderType, ResourceAttribs.Name, ResourceLayout); - } -} - -Int32 ShaderResources::FindImmutableSampler(const D3DShaderResourceAttribs& ResourceAttribs, - const PipelineResourceLayoutDesc& ResourceLayoutDesc, - bool LogImmutableSamplerArrayError) const -{ - VERIFY(ResourceAttribs.GetInputType() == D3D_SIT_SAMPLER, "Sampler is expected"); - - auto ImtblSamplerInd = - Diligent::FindImmutableSampler(ResourceLayoutDesc.ImmutableSamplers, - ResourceLayoutDesc.NumImmutableSamplers, - m_ShaderType, - ResourceAttribs.Name, - m_SamplerSuffix); - - if (ImtblSamplerInd >= 0 && ResourceAttribs.BindCount > 1) - { - Uint32 ShaderMajorVersion = 0; - Uint32 ShaderMinorVersion = 0; - GetShaderModel(ShaderMajorVersion, ShaderMinorVersion); - if (ShaderMajorVersion >= 6 || ShaderMajorVersion >= 5 && ShaderMinorVersion >= 1) - { - if (LogImmutableSamplerArrayError) - { - LOG_ERROR_MESSAGE("Immutable sampler '", ResourceAttribs.Name, '[', ResourceAttribs.BindCount, - "]' will be ignored because static sampler arrays are not allowed in shader model 5.1 and above. " - "Compile the shader using shader model 5.0 or use non-array sampler variable."); - } - ImtblSamplerInd = -1; - } - } - - return ImtblSamplerInd; -} - - -D3DShaderResourceCounters ShaderResources::CountResources(const PipelineResourceLayoutDesc& ResourceLayout, - const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes, - Uint32 NumAllowedTypes, - bool CountImmutableSamplers) const noexcept -{ - auto AllowedTypeBits = GetAllowedTypeBits(AllowedVarTypes, NumAllowedTypes); - - D3DShaderResourceCounters Counters; - ProcessResources( - [&](const D3DShaderResourceAttribs& CB, Uint32) // - { - auto VarType = FindVariableType(CB, ResourceLayout); - if (IsAllowedType(VarType, AllowedTypeBits)) - ++Counters.NumCBs; - }, - [&](const D3DShaderResourceAttribs& Sam, Uint32) // - { - auto VarType = FindVariableType(Sam, ResourceLayout); - if (IsAllowedType(VarType, AllowedTypeBits)) - { - if (!CountImmutableSamplers) - { - constexpr bool LogImtblSamplerArrayError = false; - if (FindImmutableSampler(Sam, ResourceLayout, LogImtblSamplerArrayError) >= 0) - return; // Skip immutable sampler if requested - } - ++Counters.NumSamplers; - } - }, - [&](const D3DShaderResourceAttribs& TexSRV, Uint32) // - { - auto VarType = FindVariableType(TexSRV, ResourceLayout); - if (IsAllowedType(VarType, AllowedTypeBits)) - ++Counters.NumTexSRVs; - }, - [&](const D3DShaderResourceAttribs& TexUAV, Uint32) // - { - auto VarType = FindVariableType(TexUAV, ResourceLayout); - if (IsAllowedType(VarType, AllowedTypeBits)) - ++Counters.NumTexUAVs; - }, - [&](const D3DShaderResourceAttribs& BufSRV, Uint32) // - { - auto VarType = FindVariableType(BufSRV, ResourceLayout); - if (IsAllowedType(VarType, AllowedTypeBits)) - ++Counters.NumBufSRVs; - }, - [&](const D3DShaderResourceAttribs& BufUAV, Uint32) // - { - auto VarType = FindVariableType(BufUAV, ResourceLayout); - if (IsAllowedType(VarType, AllowedTypeBits)) - ++Counters.NumBufUAVs; - }, - [&](const D3DShaderResourceAttribs& AccelStruct, Uint32) // - { - auto VarType = FindVariableType(AccelStruct, ResourceLayout); - if (IsAllowedType(VarType, AllowedTypeBits)) - ++Counters.NumAccelStructs; - } // - ); - - return Counters; -} - #ifdef DILIGENT_DEVELOPMENT void ShaderResources::DvpVerifyResourceLayout(const PipelineResourceLayoutDesc& ResourceLayout, const ShaderResources* const pShaderResources[], -- cgit v1.2.3