Pin the SPIR-V sampler split's profile, interface, set and ID checks #978

Manually merged
github merged 2 commits from gh-pr/978/head into gh-pr/978/base 2026-11-26 22:32:34 +00:00
Owner

@⁠Leyukaka on GitHub · 2026-11-23 19:34 UTC · original
Leyukaka:sps-controls → main · +26 −0 · 1 files · 2 commits · merged 2026-11-23 19:53 UTC

Change

This closes eight gaps in the test coverage of tools/spirv_sampler_split.py. Each is a one-statement mutation of the split that passes spirv_compare_sampler_warp and spirv_compare_sampler_hardware on main. Only controls() in tests/spirv_window/compare_sampler.py changes; the split does not.

New case Mutation it covers
Ordinary binding -1: Ordinary sampler binding must be nonnegative lower bound relaxed to < -1
Entry point changed to Fragment: requires a single GLCompute entry point execution-model half of that check removed
Arrayed OpTypeImage: only non-array float32 Texture2D sampling is supported arrayed operand no longer compared
%cmpSampler dropped from the entry-point interface: sampler must be listed in the entry-point interface interface check removed
%cmpSampler in set 1 with ordinary binding 3, which set 0 already uses: the split succeeds and the new sampler is decorated set 1, binding 3 occupancy check ignoring the descriptor set
Same case new sampler always decorated DescriptorSet 0
Existing %x2w_plain_sampler_0 ID: Reserved sampler split ID is already in use reserved-ID check narrowed to an exact match of %x2w_plain_sampler
The loaded sampler copied with OpCopyObject: loaded sampler feeds OpCopyObject non-OpSampledImage consumers of the loaded sampler skipped

The new rejection cases and the set-1 case are text-level; they derive from shared_sampler.spvasm and call split_comparison_sampler() directly. No fixture file is added.

Verification

On 453a251 (based on main at 0bcda16), 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_split.py one at a time and the two spirv_compare_sampler_* tests were run with the main and the branch versions of compare_sampler.py. With the unmutated split both pass. On main, both tests passed under all eight mutations; on this branch they fail under each of them.

The eight edits to tools/spirv_sampler_split.py:

  1. if ordinary_binding < 0: -> if ordinary_binding < -1:
  2. if len(entries) != 1 or parsed[entries[0]][1] != "GLCompute": -> if len(entries) != 1:
  3. texture[4:] != ["0", "0", "1", "Unknown"] -> texture[5:] != ["0", "1", "Unknown"]
  4. the if sampler not in parsed[entry][4:]: check and its raise removed
  5. if descriptor_sets.get(variable, 0) == descriptor_set and slot == ordinary_binding: -> if slot == ordinary_binding:
  6. OpDecorate {PREFIX} DescriptorSet {descriptor_set} -> OpDecorate {PREFIX} DescriptorSet 0
  7. word.startswith(PREFIX) -> word == PREFIX in the reserved-ID check
  8. the raise for a non-OpSampledImage use of the loaded sampler -> continue

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 19:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/978) `Leyukaka:sps-controls` → `main` · +26 −0 · 1 files · 2 commits · merged 2026-11-23 19:53 UTC ## Change This closes eight gaps in the test coverage of `tools/spirv_sampler_split.py`. Each is a one-statement mutation of the split that passes `spirv_compare_sampler_warp` and `spirv_compare_sampler_hardware` on `main`. Only `controls()` in `tests/spirv_window/compare_sampler.py` changes; the split does not. | New case | Mutation it covers | |---|---| | Ordinary binding `-1`: `Ordinary sampler binding must be nonnegative` | lower bound relaxed to `< -1` | | Entry point changed to `Fragment`: `requires a single GLCompute entry point` | execution-model half of that check removed | | Arrayed `OpTypeImage`: `only non-array float32 Texture2D sampling is supported` | arrayed operand no longer compared | | `%cmpSampler` dropped from the entry-point interface: `sampler must be listed in the entry-point interface` | interface check removed | | `%cmpSampler` in set 1 with ordinary binding 3, which set 0 already uses: the split succeeds and the new sampler is decorated set 1, binding 3 | occupancy check ignoring the descriptor set | | Same case | new sampler always decorated `DescriptorSet 0` | | Existing `%x2w_plain_sampler_0` ID: `Reserved sampler split ID is already in use` | reserved-ID check narrowed to an exact match of `%x2w_plain_sampler` | | The loaded sampler copied with `OpCopyObject`: `loaded sampler feeds OpCopyObject` | non-`OpSampledImage` consumers of the loaded sampler skipped | The new rejection cases and the set-1 case are text-level; they derive from `shared_sampler.spvasm` and call `split_comparison_sampler()` directly. No fixture file is added. ## Verification On `453a251` (based on `main` at `0bcda16`), 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_split.py` one at a time and the two `spirv_compare_sampler_*` tests were run with the `main` and the branch versions of `compare_sampler.py`. With the unmutated split both pass. On `main`, both tests passed under all eight mutations; on this branch they fail under each of them. The eight edits to `tools/spirv_sampler_split.py`: 1. `if ordinary_binding < 0:` -> `if ordinary_binding < -1:` 2. `if len(entries) != 1 or parsed[entries[0]][1] != "GLCompute":` -> `if len(entries) != 1:` 3. `texture[4:] != ["0", "0", "1", "Unknown"]` -> `texture[5:] != ["0", "1", "Unknown"]` 4. the `if sampler not in parsed[entry][4:]:` check and its `raise` removed 5. `if descriptor_sets.get(variable, 0) == descriptor_set and slot == ordinary_binding:` -> `if slot == ordinary_binding:` 6. `OpDecorate {PREFIX} DescriptorSet {descriptor_set}` -> `OpDecorate {PREFIX} DescriptorSet 0` 7. `word.startswith(PREFIX)` -> `word == PREFIX` in the reserved-ID check 8. the `raise` for a non-`OpSampledImage` use of the loaded sampler -> `continue` ## 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:32:33 +00:00
github manually merged commit 453a251a96 into gh-pr/978/base 2026-11-26 22:32:34 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.