On Fri May 19 09:17:59 2023 +0000, Giovanni Mascellani wrote:
Mmmh, maybe I am misunderstanding what `SampleCmp()` does. Based on what I can read in https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hls... it doesn't look like that you have to deal with DSVs:
For each texel fetched (based on the sampler configuration of the
filter mode), SampleCmp performs a comparison of the z value (3rd component of input) from the shader against the texel value (1 if the comparison passes; otherwise 0). SampleCmp then blends these 0 and 1 results for each texel together as in normal texture filtering (not an average) and returns the resulting [0..1] value to the shader. It seems that you just have to create a texture with some data in the third component and then sample it. Am I missing something? If I am indeed misunderstanding and it turns out that having a non trivial test would take a lot of work, then ignore my comment.
Um... that's a good question. Comparison sampling is traditionally used with depth textures, I have no idea if it works with color textures. If we can write tests and they work, then sure, but it may very well be the case that it doesn't work, or at least doesn't work consistently.