Pin the SPIR-V address window's end bound, direct casts and profile rejections #964

Merged
Leyukaka merged 2 commits from upstream-pr/971 into main 2026-11-23 19:39:38 +00:00
Leyukaka commented 2026-11-23 19:20:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-23T19:20:55Z.


Change

This closes six gaps in the test coverage of tools/spirv_address_window.py. Each is a one-line mutation of the lowering that passes both tests/spirv_window/check.py and the spirv_address_window_warp and _hardware readbacks on main. Only check.py changes; the lowering does not.

New check Mutation it covers
The indexed range compare is OpULessThan on the indexed address against %x2w_end OpULessThan changed to OpULessThanEqual
A direct OpConvertUToPtr %_ptr_PSB_uint cast is masked from its own address, and the lowered module assembles and validates the direct path using %x2w_zero64 as the address
%user_data already at descriptor set 1: rejected with descriptor sets set check narrowed to set 2
Two OpEntryPoint lines: expected one shader entry point count check accepting 1 or 2
ArrayStride 8 on %rt_uint: scalar layout stride 4 dropped from the required declarations
An extra PushConstant pointer type: unrecognized push-constant declaration push-constant allowlist check removed

Two further mutations of the emitted text were left out, because the spirv_address_window_* readbacks on main already fail under both: {name}_nowrap = OpUGreaterThanEqual %bool {addr} {base} with %x2w_zero64 for {base}, and OpSelect %uint {valid} {name}_word %x2w_invalid with the last two operands swapped.

No fixture file is added; the variants are derived from subtract.spvasm inside check.py.

Verification

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

python -B tests/spirv_window/check.py
ctest --preset dev --no-tests=error -R spirv -j 6

check.py passes, and all 16 spirv 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_address_window.py one at a time. With main's check.py, both check.py and the spirv_address_window_* CTest entries passed under all six; with the branch's check.py, check.py fails under each. Both versions pass with the unmutated lowering.

The six edits to tools/spirv_address_window.py:

  1. f"{name}_range = OpULessThan %bool {addr} %x2w_end", -> OpULessThanEqual
  2. output.extend(word_pointer(dst, addr, None)) -> word_pointer(dst, "%x2w_zero64", None)
  3. DescriptorSet [12]", line) for line in lines -> DescriptorSet 2", line) for line in lines
  4. != 1: in the OpEntryPoint count -> not in (1, 2):
  5. "OpDecorate %rt_uint ArrayStride 4" removed from required
  6. if line.split(" = ")[0] not in ("%_ptr_PC_UserData", "%_ptr_PC_uint", "%user_data"): -> if False:

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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6567012276 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/971). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-23T19:20:55Z. --- ## Change This closes six gaps in the test coverage of `tools/spirv_address_window.py`. Each is a one-line mutation of the lowering that passes both `tests/spirv_window/check.py` and the `spirv_address_window_warp` and `_hardware` readbacks on `main`. Only `check.py` changes; the lowering does not. | New check | Mutation it covers | |---|---| | The indexed range compare is `OpULessThan` on the indexed address against `%x2w_end` | `OpULessThan` changed to `OpULessThanEqual` | | A direct `OpConvertUToPtr %_ptr_PSB_uint` cast is masked from its own address, and the lowered module assembles and validates | the direct path using `%x2w_zero64` as the address | | `%user_data` already at descriptor set 1: rejected with `descriptor sets` | set check narrowed to set 2 | | Two `OpEntryPoint` lines: `expected one shader entry point` | count check accepting 1 or 2 | | `ArrayStride 8` on `%rt_uint`: `scalar layout` | stride 4 dropped from the required declarations | | An extra `PushConstant` pointer type: `unrecognized push-constant declaration` | push-constant allowlist check removed | Two further mutations of the emitted text were left out, because the `spirv_address_window_*` readbacks on `main` already fail under both: `{name}_nowrap = OpUGreaterThanEqual %bool {addr} {base}` with `%x2w_zero64` for `{base}`, and `OpSelect %uint {valid} {name}_word %x2w_invalid` with the last two operands swapped. No fixture file is added; the variants are derived from `subtract.spvasm` inside `check.py`. ## Verification On `3a795d0` (branch on `4878211`), Windows 11 build 26300, MSVC 14.44.35207, Python 3.14, SPIR-V tools from `tools/setup-spirv-tools.ps1`: ```text python -B tests/spirv_window/check.py ctest --preset dev --no-tests=error -R spirv -j 6 ``` `check.py` passes, and all 16 `spirv` 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_address_window.py` one at a time. With `main`'s `check.py`, both `check.py` and the `spirv_address_window_*` CTest entries passed under all six; with the branch's `check.py`, `check.py` fails under each. Both versions pass with the unmutated lowering. The six edits to `tools/spirv_address_window.py`: 1. `f"{name}_range = OpULessThan %bool {addr} %x2w_end",` -> `OpULessThanEqual` 2. `output.extend(word_pointer(dst, addr, None))` -> `word_pointer(dst, "%x2w_zero64", None)` 3. `DescriptorSet [12]", line) for line in lines` -> `DescriptorSet 2", line) for line in lines` 4. `!= 1:` in the `OpEntryPoint` count -> `not in (1, 2):` 5. `"OpDecorate %rt_uint ArrayStride 4"` removed from `required` 6. `if line.split(" = ")[0] not in ("%_ptr_PC_UserData", "%_ptr_PC_uint", "%user_data"):` -> `if False:` ## 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.
upstream-sync closed this pull request 2026-11-24 06:45:39 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!964
No description provided.