It is in a shader include file which works fine in the test app, but the test app is a much simpler shader. Just shadowed, textured mesh with diffuse lighting.
I am trying to add it to my ocean shader which is much more complex.
I think (not 100% sure as it has been a while) that the important ones are Filter, ComparisonFunction and FilterMode.
PS: You could try to not use SampleCmpLevelZero and sample the shadow texture + do the depth test yourself. This would confirm or not that the issue is with SampleCmpLevelZero.
The pixel shader gets the environment and shadow maps
All good.
But when I look at the sampler states, I see the sampler for the shadow map is totally wrong. It’s the sampler for the normal map.
So what I think we have is a bug in the shader compiler. It looks like the compiler creates an array of three samplers then indexes into it with the wrong count.
Vertex shader has one sampler (index 0)
Pixel shader has two samplers (index 1 and 2) but is using index 0 and 1
Well it’s a possibility at least , have to think of a way of proving it.