Skip to content
Snippets Groups Projects

vkd3d-shader/hlsl: Implement SampleCmp() method.

Merged Nikolay Sivov requested to merge nsivov/vkd3d:samplecmp into master
1 unresolved thread

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Elizabeth Figura
    • Resolved by Nikolay Sivov

      I won't ask for it for this patch, since I've already reviewed it, but in the future, please try to split up commits more. It's a lot easier to review with granular changes. E.g. in this case we could have had:

      • change "lod" to "params"
      • parse SamplerComparisonState
      • parse the SampleCmp() function
      • emit sm4 for HLSL_RESOURCE_SAMPLE_CMP
  • Nikolay Sivov added 5 commits

    added 5 commits

    • 0e8c4793 - vkd3d-shader/hlsl: Move object type checks to methods handlers.
    • ed2e7f33 - vkd3d-shader/hlsl: Use a function table for object methods handlers.
    • 792d5e3d - vkd3d-shader/hlsl: Parse SamplerComparisonState objects.
    • 6d077f12 - vkd3d-shader/hlsl: Parse SampleCmp() method.
    • 398b4c30 - vkd3d-shader/tpf: Write out comparison mode sampler declarations and...

    Compare with previous version

    • That's all good for me, but as usual I would like to have some tests. It doesn't seem it should be hard to add support for comparison samplers to the shader runner, or I am missing something?

    • 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-hlsl-to-samplecmp 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.

      Edited by Giovanni Mascellani
    • 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.

    • Please register or sign in to reply
  • Elizabeth Figura approved this merge request

    approved this merge request

  • Nikolay Sivov added 16 commits

    added 16 commits

    • 398b4c30...1af662ae - 11 commits from branch wine:master
    • ce5c5406 - vkd3d-shader/hlsl: Move object type checks to methods handlers.
    • 41ce32d2 - vkd3d-shader/hlsl: Use a function table for object methods handlers.
    • 5b15f7b5 - vkd3d-shader/hlsl: Parse SamplerComparisonState objects.
    • ca83e013 - vkd3d-shader/hlsl: Parse SampleCmp() method.
    • 4bdd9c34 - vkd3d-shader/tpf: Write out comparison mode sampler declarations and...

    Compare with previous version

  • Nikolay Sivov added 12 commits

    added 12 commits

    • 4bdd9c34...855bb71f - 7 commits from branch wine:master
    • f20071da - vkd3d-shader/hlsl: Move object type checks to methods handlers.
    • c7df2754 - vkd3d-shader/hlsl: Use a function table for object methods handlers.
    • 52f45b6c - vkd3d-shader/hlsl: Parse SamplerComparisonState objects.
    • 33497b62 - vkd3d-shader/hlsl: Parse SampleCmp() method.
    • 8741481b - vkd3d-shader/tpf: Write out comparison mode sampler declarations and...

    Compare with previous version

  • Nikolay Sivov added 11 commits

    added 11 commits

    • 8741481b...ea7d8c65 - 6 commits from branch wine:master
    • 69cead6c - vkd3d-shader/hlsl: Move object type checks to methods handlers.
    • 66fe3a70 - vkd3d-shader/hlsl: Use a function table for object methods handlers.
    • 58b38454 - vkd3d-shader/hlsl: Parse SamplerComparisonState objects.
    • c0e222d0 - vkd3d-shader/hlsl: Parse SampleCmp() method.
    • 1d2e9b0e - vkd3d-shader/tpf: Write out comparison mode sampler declarations and...

    Compare with previous version

  • Nikolay Sivov added 1 commit

    added 1 commit

    • efc91cff - vkd3d-shader/hlsl: Parse SampleCmpLevelZero() method.

    Compare with previous version

  • Nikolay Sivov added 26 commits

    added 26 commits

    • efc91cff...bb680e73 - 20 commits from branch wine:master
    • 32d981ec - vkd3d-shader/hlsl: Move object type checks to methods handlers.
    • 9b1d7228 - vkd3d-shader/hlsl: Use a function table for object methods handlers.
    • 90eb00eb - vkd3d-shader/hlsl: Parse SamplerComparisonState objects.
    • 8ed58548 - vkd3d-shader/hlsl: Parse SampleCmp() method.
    • 04d8c3d0 - vkd3d-shader/tpf: Write out comparison mode sampler declarations and...
    • 8c5a892d - vkd3d-shader/hlsl: Parse SampleCmpLevelZero() method.

    Compare with previous version

  • Giovanni Mascellani approved this merge request

    approved this merge request

  • Henri Verbeet approved this merge request

    approved this merge request

  • added 7 commits

    • aa17d139 - 1 commit from branch wine:master
    • 87cd3f87 - vkd3d-shader/hlsl: Move object type checks to methods handlers.
    • efe107d2 - vkd3d-shader/hlsl: Use a function table for object methods handlers.
    • 7c94705c - vkd3d-shader/hlsl: Parse SamplerComparisonState objects.
    • 2fd3550b - vkd3d-shader/hlsl: Parse SampleCmp() method.
    • c33219c9 - vkd3d-shader/tpf: Write out comparison mode sampler declarations and...
    • a2e85a8a - vkd3d-shader/hlsl: Parse SampleCmpLevelZero() method.

    Compare with previous version

  • Alexandre Julliard approved this merge request

    approved this merge request

  • Please register or sign in to reply
    Loading