Pin the SPIR-V sampler view split's gather, multi-comparison and rejection paths #960

Manually merged
github merged 2 commits from gh-pr/960/head into gh-pr/960/base 2026-11-26 22:31:23 +00:00
Owner

@⁠Leyukaka on GitHub · 2026-11-23 18:48 UTC · original
Leyukaka:sampler-controls → main · +59 −0 · 1 files · 2 commits · merged 2026-11-23 19:17 UTC

Change

This closes eight gaps in the test coverage of tools/spirv_sampler_views.py. Each was a one-line mutation that passed spirv_sampler_views_warp on main. Only tests/spirv_window/sampler.py changes; the rewrite does not.

The new cases run in the fragment-stage pass, whose ordinary sample is OpImageSampleImplicitLod.

New case Mutation it covers
Two depth-reference samples: both use their own bridge image only the first comparison rewritten
OpImageDrefGather as the comparison: rewritten comparisons detected only as OpImageSampleDref*
OpImageGather as the ordinary use: comparison still rewritten, gather left on %si plain gathers not counted as ordinary uses
OpGroupDecorate present: unsupported indirect descriptor decorations indirect-decoration guard removed
An existing %bridge_cmp ID: comparison sampler view requires free descriptor set 3 and bridge_cmp IDs ID half of that guard removed (main already covers the set 3 half)
Comparison sampler loaded from another table: unsupported depth-reference sampler provenance provenance check no longer requires %samplers
Sampler table at set 4: expected undecorated sampler table at set 0 binding 1 descriptor-set half of the binding check removed
NonUniformEXT on the sampled image: unsupported decorated sampler path sampled image dropped from the decorated-path check

Each rewritten comparison is also checked to load its sampler through %bridge_cmp. A mutation that builds that pointer from %samplers already fails on main through the existing checks on the emitted module, so it is not counted above; the new assertion reports it directly. The new cases are text-only and are not assembled.

Verification

On e5b396d (branch on 0f0c3eb), Windows 11 build 26300, MSVC 14.44.35207, Python 3.14, SPIR-V tools from tools/setup-spirv-tools.ps1:

ctest --preset dev --no-tests=error -R spirv -j 6

All 16 tests pass. The eight _hardware tests ran on an NVIDIA GeForce RTX 5080 (driver 32.0.16.2101) and none was skipped.

Each mutation was applied to tools/spirv_sampler_views.py one at a time and spirv_sampler_views_warp was run with the main and the branch versions of sampler.py. With the unmutated tool both pass. On main, the test passed under all eight mutations; on this branch it fails under each of them.

The eight edits to tools/spirv_sampler_views.py:

  1. for index, words in comparisons: -> for index, words in comparisons[:1]:
  2. words[2].startswith("OpImage") and "Dref" in words[2] -> words[2].startswith("OpImageSampleDref")
  3. startswith(("OpImageSample", "OpImageGather")) -> startswith("OpImageSample")
  4. (["OpGroupDecorate"], ["OpDecorateId"]) -> (["OpDecorateId"],)
  5. if prefix in assembly or -> if False or
  6. pointer[:3] != ["OpAccessChain", "%_ptr_UC_smp", "%samplers"] -> pointer[:2] != ["OpAccessChain", "%_ptr_UC_smp"]
  7. the set 0 / binding 1 comparison -> if "OpDecorate %samplers Binding 1" not in bindings:
  8. ("%samplers", words[4], image[3], sampler[2]) -> ("%samplers", image[3], sampler[2])

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed. (No change needed.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

**@⁠Leyukaka** on GitHub · 2026-11-23 18:48 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/960) `Leyukaka:sampler-controls` → `main` · +59 −0 · 1 files · 2 commits · merged 2026-11-23 19:17 UTC ## Change This closes eight gaps in the test coverage of `tools/spirv_sampler_views.py`. Each was a one-line mutation that passed `spirv_sampler_views_warp` on `main`. Only `tests/spirv_window/sampler.py` changes; the rewrite does not. The new cases run in the fragment-stage pass, whose ordinary sample is `OpImageSampleImplicitLod`. | New case | Mutation it covers | |---|---| | Two depth-reference samples: both use their own bridge image | only the first comparison rewritten | | `OpImageDrefGather` as the comparison: rewritten | comparisons detected only as `OpImageSampleDref*` | | `OpImageGather` as the ordinary use: comparison still rewritten, gather left on `%si` | plain gathers not counted as ordinary uses | | `OpGroupDecorate` present: `unsupported indirect descriptor decorations` | indirect-decoration guard removed | | An existing `%bridge_cmp` ID: `comparison sampler view requires free descriptor set 3 and bridge_cmp IDs` | ID half of that guard removed (`main` already covers the set 3 half) | | Comparison sampler loaded from another table: `unsupported depth-reference sampler provenance` | provenance check no longer requires `%samplers` | | Sampler table at set 4: `expected undecorated sampler table at set 0 binding 1` | descriptor-set half of the binding check removed | | `NonUniformEXT` on the sampled image: `unsupported decorated sampler path` | sampled image dropped from the decorated-path check | Each rewritten comparison is also checked to load its sampler through `%bridge_cmp`. A mutation that builds that pointer from `%samplers` already fails on `main` through the existing checks on the emitted module, so it is not counted above; the new assertion reports it directly. The new cases are text-only and are not assembled. ## Verification On `e5b396d` (branch on `0f0c3eb`), Windows 11 build 26300, MSVC 14.44.35207, Python 3.14, SPIR-V tools from `tools/setup-spirv-tools.ps1`: ```text ctest --preset dev --no-tests=error -R spirv -j 6 ``` All 16 tests pass. The eight `_hardware` tests ran on an NVIDIA GeForce RTX 5080 (driver 32.0.16.2101) and none was skipped. Each mutation was applied to `tools/spirv_sampler_views.py` one at a time and `spirv_sampler_views_warp` was run with the `main` and the branch versions of `sampler.py`. With the unmutated tool both pass. On `main`, the test passed under all eight mutations; on this branch it fails under each of them. The eight edits to `tools/spirv_sampler_views.py`: 1. `for index, words in comparisons:` -> `for index, words in comparisons[:1]:` 2. `words[2].startswith("OpImage") and "Dref" in words[2]` -> `words[2].startswith("OpImageSampleDref")` 3. `startswith(("OpImageSample", "OpImageGather"))` -> `startswith("OpImageSample")` 4. `(["OpGroupDecorate"], ["OpDecorateId"])` -> `(["OpDecorateId"],)` 5. `if prefix in assembly or` -> `if False or` 6. `pointer[:3] != ["OpAccessChain", "%_ptr_UC_smp", "%samplers"]` -> `pointer[:2] != ["OpAccessChain", "%_ptr_UC_smp"]` 7. the set 0 / binding 1 comparison -> `if "OpDecorate %samplers Binding 1" not in bindings:` 8. `("%samplers", words[4], image[3], sampler[2])` -> `("%samplers", image[3], sampler[2])` ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [ ] I updated README/docs when a capability or build requirement changed. (No change needed.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:31:21 +00:00
github manually merged commit e5b396d017 into gh-pr/960/base 2026-11-26 22:31:23 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.