glslang/Test/hlsl.samplecmp.negative.frag
LoopDawg 195f584e09 HLSL: force textures to shadow modes from combined samplers
Texture shadow mode must match the state of the sampler they are
combined with.  This change does that, both for the AST and the
symbol table.  Note that the texture cannot easily be *created*
the right way, because this may not be known at that time.  Instead,
the texture is subsequently patched.

This cannot work if a single texture is used with both a shadow and
non-shadow sampler, so that case is detected and generates an error.
This is permitted by the HLSL language, however.  See #1073 discussion.

Fixed one test source that was using a texture with both shadow and
non-shadow samplers.
2017-09-28 14:17:25 -06:00

14 lines
348 B
GLSL

Texture2D g_nonShadowTex;
Texture2D g_shadowTex;
SamplerState g_shadowSampler;
SamplerComparisonState g_shadowSamplerComp;
float4 main() : SV_Target0
{
g_shadowTex.SampleCmp(g_shadowSamplerComp, float2(0,0), 0); // OK
g_nonShadowTex.SampleCmp(g_shadowSampler, float2(0,0), 0); // ERROR (should be comparison sampler)
return 0;
}