diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-10-19 17:21:30 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-10-19 17:21:30 +0000 |
| commit | a520bf4f9748d20e432bcf7994be3148d0b75d54 (patch) | |
| tree | 73e69ab1f7eb2f1844ed7c834f80837947dd50bb /Graphics/GraphicsEngineD3DBase | |
| parent | Updated third-party modules; fixed compiler warnings (diff) | |
| download | DiligentCore-a520bf4f9748d20e432bcf7994be3148d0b75d54.tar.gz DiligentCore-a520bf4f9748d20e432bcf7994be3148d0b75d54.zip | |
Renamed static sampler to immutable sampler (API240076)
Diffstat (limited to 'Graphics/GraphicsEngineD3DBase')
| -rw-r--r-- | Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp | 10 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp | 62 |
2 files changed, 36 insertions, 36 deletions
diff --git a/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp b/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp index 2843f9f0..f15d2e74 100644 --- a/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp +++ b/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp @@ -372,20 +372,20 @@ public: SHADER_RESOURCE_VARIABLE_TYPE FindVariableType(const D3DShaderResourceAttribs& ResourceAttribs, const PipelineResourceLayoutDesc& ResourceLayout) const; - Int32 FindStaticSampler(const D3DShaderResourceAttribs& ResourceAttribs, - const PipelineResourceLayoutDesc& ResourceLayoutDesc, - bool LogStaticSamplerArrayError) 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 CountStaticSamplers) const noexcept; + bool CountImmutableSamplers) const noexcept; #ifdef DILIGENT_DEVELOPMENT static void DvpVerifyResourceLayout(const PipelineResourceLayoutDesc& ResourceLayout, const ShaderResources* const pShaderResources[], Uint32 NumShaders, bool VerifyVariables, - bool VerifyStaticSamplers); + bool VerifyImmutableSamplers); #endif void GetShaderModel(Uint32& Major, Uint32& Minor) const diff --git a/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp b/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp index 498e31a2..86a7fc35 100644 --- a/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp +++ b/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp @@ -122,44 +122,44 @@ SHADER_RESOURCE_VARIABLE_TYPE ShaderResources::FindVariableType(const D3DShaderR } } -Int32 ShaderResources::FindStaticSampler(const D3DShaderResourceAttribs& ResourceAttribs, - const PipelineResourceLayoutDesc& ResourceLayoutDesc, - bool LogStaticSamplerArrayError) const +Int32 ShaderResources::FindImmutableSampler(const D3DShaderResourceAttribs& ResourceAttribs, + const PipelineResourceLayoutDesc& ResourceLayoutDesc, + bool LogImmutableSamplerArrayError) const { VERIFY(ResourceAttribs.GetInputType() == D3D_SIT_SAMPLER, "Sampler is expected"); - auto StaticSamplerInd = - Diligent::FindStaticSampler(ResourceLayoutDesc.StaticSamplers, - ResourceLayoutDesc.NumStaticSamplers, - m_ShaderType, - ResourceAttribs.Name, - m_SamplerSuffix); + auto ImtblSamplerInd = + Diligent::FindImmutableSampler(ResourceLayoutDesc.ImmutableSamplers, + ResourceLayoutDesc.NumImmutableSamplers, + m_ShaderType, + ResourceAttribs.Name, + m_SamplerSuffix); - if (StaticSamplerInd >= 0 && ResourceAttribs.BindCount > 1) + if (ImtblSamplerInd >= 0 && ResourceAttribs.BindCount > 1) { Uint32 ShaderMajorVersion = 0; Uint32 ShaderMinorVersion = 0; GetShaderModel(ShaderMajorVersion, ShaderMinorVersion); if (ShaderMajorVersion >= 6 || ShaderMajorVersion >= 5 && ShaderMinorVersion >= 1) { - if (LogStaticSamplerArrayError) + if (LogImmutableSamplerArrayError) { - LOG_ERROR_MESSAGE("Static sampler '", ResourceAttribs.Name, '[', ResourceAttribs.BindCount, + 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."); } - StaticSamplerInd = -1; + ImtblSamplerInd = -1; } } - return StaticSamplerInd; + return ImtblSamplerInd; } D3DShaderResourceCounters ShaderResources::CountResources(const PipelineResourceLayoutDesc& ResourceLayout, const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes, Uint32 NumAllowedTypes, - bool CountStaticSamplers) const noexcept + bool CountImmutableSamplers) const noexcept { auto AllowedTypeBits = GetAllowedTypeBits(AllowedVarTypes, NumAllowedTypes); @@ -176,11 +176,11 @@ D3DShaderResourceCounters ShaderResources::CountResources(const PipelineResource auto VarType = FindVariableType(Sam, ResourceLayout); if (IsAllowedType(VarType, AllowedTypeBits)) { - if (!CountStaticSamplers) + if (!CountImmutableSamplers) { - constexpr bool LogStaticSamplerArrayError = false; - if (FindStaticSampler(Sam, ResourceLayout, LogStaticSamplerArrayError) >= 0) - return; // Skip static sampler if requested + constexpr bool LogImtblSamplerArrayError = false; + if (FindImmutableSampler(Sam, ResourceLayout, LogImtblSamplerArrayError) >= 0) + return; // Skip immutable sampler if requested } ++Counters.NumSamplers; } @@ -219,7 +219,7 @@ void ShaderResources::DvpVerifyResourceLayout(const PipelineResourceLayoutDesc& const ShaderResources* const pShaderResources[], Uint32 NumShaders, bool VerifyVariables, - bool VerifyStaticSamplers) + bool VerifyImmutableSamplers) { auto GetAllowedShadersString = [&](SHADER_TYPE ShaderStages) // { @@ -300,40 +300,40 @@ void ShaderResources::DvpVerifyResourceLayout(const PipelineResourceLayoutDesc& } } - if (VerifyStaticSamplers) + if (VerifyImmutableSamplers) { - for (Uint32 sam = 0; sam < ResourceLayout.NumStaticSamplers; ++sam) + for (Uint32 sam = 0; sam < ResourceLayout.NumImmutableSamplers; ++sam) { - const auto& StSamDesc = ResourceLayout.StaticSamplers[sam]; + const auto& StSamDesc = ResourceLayout.ImmutableSamplers[sam]; if (StSamDesc.ShaderStages == SHADER_TYPE_UNKNOWN) { - LOG_WARNING_MESSAGE("No allowed shader stages are specified for static sampler '", StSamDesc.SamplerOrTextureName, "'."); + LOG_WARNING_MESSAGE("No allowed shader stages are specified for immutable sampler '", StSamDesc.SamplerOrTextureName, "'."); continue; } const auto* TexOrSamName = StSamDesc.SamplerOrTextureName; - bool StaticSamplerFound = false; - for (Uint32 s = 0; s < NumShaders && !StaticSamplerFound; ++s) + bool ImtblSamplerFound = false; + for (Uint32 s = 0; s < NumShaders && !ImtblSamplerFound; ++s) { const auto& Resources = *pShaderResources[s]; if ((StSamDesc.ShaderStages & Resources.GetShaderType()) == 0) continue; - // Look for static sampler. + // Look for immutable sampler. // In case HLSL-style combined image samplers are used, the condition is Sampler.Name == "g_Texture" + "_sampler". // Otherwise the condition is Sampler.Name == "g_Texture_sampler" + "". const auto* CombinedSamplerSuffix = Resources.GetCombinedSamplerSuffix(); - for (Uint32 n = 0; n < Resources.GetNumSamplers() && !StaticSamplerFound; ++n) + for (Uint32 n = 0; n < Resources.GetNumSamplers() && !ImtblSamplerFound; ++n) { const auto& Sampler = Resources.GetSampler(n); - StaticSamplerFound = StreqSuff(Sampler.Name, TexOrSamName, CombinedSamplerSuffix); + ImtblSamplerFound = StreqSuff(Sampler.Name, TexOrSamName, CombinedSamplerSuffix); } } - if (!StaticSamplerFound) + if (!ImtblSamplerFound) { - LOG_WARNING_MESSAGE("Static sampler '", TexOrSamName, "' is not found in any of the designated shader stages: ", + LOG_WARNING_MESSAGE("Immutable sampler '", TexOrSamName, "' is not found in any of the designated shader stages: ", GetAllowedShadersString(StSamDesc.ShaderStages)); } } |
