sample_compare returning neither 1 nor 0?

Hi,

Maybe I'm doing something wrong, but form MSL 2.4 spec, sample_compare should return either 0 or 1.

I'm on a MBP 16 M1 Pro, Monterey 12.3.1 and Xcode 13.3.1.

Now, I'm receiving a value in between. Coordinates, sampler etc.. seems correct:

shadow = 0.125:

Sorry, in the image is not seen, but "i == 0" and shadow_map is a texture with four slices.

Thanks

Answered by Graphics and Games Engineer in 711290022

From MSL Spec 2.4 page 185...

These comparison result values per-pixel are then blended together as in normal texture filtering and the resulting value between 0.0 and 1.0 is returned.

The sampler in the screenshot has linear filtering, so you should get linearly-interpolated values.

Accepted Answer

From MSL Spec 2.4 page 185...

These comparison result values per-pixel are then blended together as in normal texture filtering and the resulting value between 0.0 and 1.0 is returned.

The sampler in the screenshot has linear filtering, so you should get linearly-interpolated values.

sample_compare returning neither 1 nor 0?
 
 
Q