summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-02-14 01:28:04 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:31:37 +0000
commitb6b37364652f9fd8dd6b42c95691162abca11801 (patch)
tree0e4a201e2f102d8ef83407d82ac088a7bf595eaa /Graphics/GraphicsEngine
parentRootParamsBuilder: minor improvement to AllocateResourceSlot (diff)
downloadDiligentCore-b6b37364652f9fd8dd6b42c95691162abca11801.tar.gz
DiligentCore-b6b37364652f9fd8dd6b42c95691162abca11801.zip
Removed duplicates of FindImmutableSampler
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/ShaderResourceVariableBase.hpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngine/include/ShaderResourceVariableBase.hpp b/Graphics/GraphicsEngine/include/ShaderResourceVariableBase.hpp
index dbd7fb46..eada5264 100644
--- a/Graphics/GraphicsEngine/include/ShaderResourceVariableBase.hpp
+++ b/Graphics/GraphicsEngine/include/ShaderResourceVariableBase.hpp
@@ -122,15 +122,22 @@ inline Uint32 GetAllowedTypeBits(const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVar
inline Int32 FindImmutableSampler(const ImmutableSamplerDesc* ImtblSamplers,
Uint32 NumImtblSamplers,
- SHADER_TYPE ShaderType,
+ SHADER_TYPE ShaderStages,
const char* ResourceName,
const char* SamplerSuffix)
{
for (Uint32 s = 0; s < NumImtblSamplers; ++s)
{
const auto& Sam = ImtblSamplers[s];
- if (((Sam.ShaderStages & ShaderType) != 0) && StreqSuff(ResourceName, Sam.SamplerOrTextureName, SamplerSuffix))
+ if (((Sam.ShaderStages & ShaderStages) != 0) && StreqSuff(ResourceName, Sam.SamplerOrTextureName, SamplerSuffix))
+ {
+ DEV_CHECK_ERR((Sam.ShaderStages & ShaderStages) == ShaderStages,
+ "Resource '", ResourceName, "' is defined for the following shader stages: ", GetShaderStagesString(ShaderStages),
+ ", but immutable sampler '", Sam.SamplerOrTextureName, "' specifes only some of these stages: ", GetShaderStagesString(Sam.ShaderStages),
+ ". A resource that is present in multiple shader stages can't use different immutable samples in different stages. "
+ "Either use separate resources for different stages, or define the immutable sample for all stages that the resource uses.");
return s;
+ }
}
return -1;