On Thu May 18 16:09:47 2023 +0000, Zebediah Figura wrote:
Comparison samplers by themselves aren't hard, but it does mean we need to add stuff for depth write and also support rebinding a DSV as an SRV. (Or blitting?) Both things that'd be nice to have eventually; I'd like everything to have at least some manner of test even if it's not in the shader runner...
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.