When trying to compile the following HLSL:
Texture2DArray gShadowmap : register(TEXTURE_REGISTER_DEPTH);
SamplerState gShadowmapSampler : register(SAMPLER_REGISTER_DEPTH);
// ...
float3 projCoords = (float3)mul(gSplitVPMatrices[index], worldPos);
float viewDepth = projCoords.z - DEPTH_BIAS;
projCoords.z = float(index);
float visibilty = gShadowmap.SampleCmp(gShadowmapSampler, projCoords, viewDepth).r;
visual studio gives me:
error X3013: 'SampleCmp': no matching 3 parameter intrinsic method
error X3013: Possible intrinsic methods are:
error X3013: Texture2DArray<float4>.SampleCmp(SamplerComparisonState, float3|half3|min10float3|min16float3, float1|half1|min10float1|min16float1)
error X3013: Texture2DArray<float4>.SampleCmp(SamplerComparisonState, float3|half3|min10float3|min16float3, float1|half1|min10float1|min16float1, int2)
error X3013: Texture2DArray<float4>.SampleCmp(SamplerComparisonState, float3|half3|min10float3|min16float3, float1|half1|min10float1|min16float1, int2, float1|half1|min10float1|min16float1)
error X3013: Texture2DArray<float4>.SampleCmp(SamplerComparisonState, float3|half3|min10float3|min16float3, float1|half1|min10float1|min16float1, int2, float1|half1|min10float1|min16float1, out uint status)
I believe I match the first method, so why is this?
SamplerState
andSamplerComparisonState
are not the same thing. Read this: msdn.microsoft.com/en-us/library/windows/desktop/… \$\endgroup\$