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.
This commit is contained in:
parent
f21c173a05
commit
195f584e09
13 changed files with 2358 additions and 2366 deletions
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
Texture2D g_nonShadowTex;
|
||||
Texture2D g_shadowTex;
|
||||
SamplerState g_shadowSampler;
|
||||
SamplerComparisonState g_shadowSamplerComp;
|
||||
|
|
@ -6,7 +7,7 @@ SamplerComparisonState g_shadowSamplerComp;
|
|||
float4 main() : SV_Target0
|
||||
{
|
||||
g_shadowTex.SampleCmp(g_shadowSamplerComp, float2(0,0), 0); // OK
|
||||
g_shadowTex.SampleCmp(g_shadowSampler, float2(0,0), 0); // ERROR (should be comparison sampler)
|
||||
g_nonShadowTex.SampleCmp(g_shadowSampler, float2(0,0), 0); // ERROR (should be comparison sampler)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue