shader: accept partial channel masks on uncompressed pixel_aot exports #429

Manually merged
github merged 6 commits from gh-pr/429/head into gh-pr/429/base 2026-11-26 21:51:17 +00:00
Owner

@⁠abilliontokens on GitHub · 2026-11-22 01:45 UTC · original
abilliontokens:shader/exp-enable-mask-uncompressed → main · +57 −20 · 5 files · 6 commits · merged 2026-11-23 08:24 UTC

Change

Refs #361 — stage 3 (non-compressed 32-bit exports with per-channel off masks), per the issue's proposed split. Depends on #398 (shader/exp-enable-mask, stage 1), which itself depends on #363; this branch stacks on #398's head and must land after both. Until they merge, the diff against main includes their commits; the incremental change is the single commit on top.

  • lower() now accepts off in any operand of the uncompressed export exp mrt0 vA, vB, vC, vD done vm. Each enabled operand must be a distinct sample/alu register; the four enable bits form the channel mask reported by return_write_mask (so masks 0x1..0xE become reachable for this form, in addition to 0xF). Disabled channels return 0.0f behind the same immaterial-values comment as stage 1, since the harness blocks those writes with the PSO's RenderTargetWriteMask[0]. An all-off export (mask 0) is rejected, and a partial mask combined with integer_export is rejected (out of scope); the full-mask integer path is byte-identical to before.
  • Compressed exports stay restricted to the three LLVM-normalized forms {0x3, 0xC, 0xF}: off inside a compressed export and half-pair text such as v16, off, off, off done compr vm remain rejected. LLVM 15 normalizes compressed half-pair enables to whole pairs, so they are unexpressible in disassembly text (stage 2 stays dropped).
  • Case plumbing: write_case(write_mask=...) accepts any nonzero nibble 0x1..0xF, and the renderer accepts any nonzero trailer nibble (0 keeps the all-channel default), clearing to the sentinel (-1, 2, -3, 4) for every partial mask. Cases written without a trailer keep the original 1280-byte format byte-identically.
  • Fixtures: uncompressed_export(body, mask) builds the per-channel-off text; masks 0x1, 0x8, 0x5, 0xA joined the LLVM 15 assembler round-trip list in check_binary. check_exp_mask_uncompressed_draw draws masks 0x1, 0x8, 0x5, 0xA, 0xF with distinct per-channel constant words through v_sub_f32: enabled channels compare bit-exactly against the reference on the R32G32B32A32 target, disabled channels keep the sentinel. Two negative controls must report pixel_mismatch on every backend: the EN=0x5 shader drawn under an all-channel PSO write mask against the sentinel-expecting reference (receives the immaterial zeros), and a corrupted enabled-channel reference. Rejection controls cover off in a compressed export, compressed half-pair text, the all-off uncompressed export, a duplicated enabled register, and partial mask + integer_export.

Verification

Windows 11 x64 build via tools/dev.ps1 (MSVC), cmake --preset dev -B out/build/dev-361s3 -DINTAKE_PYTHON=out/pe-env/Scripts/python.exe, then:

Gate Command Result
Build cmake --build out/build/dev-361s3 371/371 targets, no warnings
Binary round trip out/pe-env/Scripts/python.exe -B tests/pixel_aot_check.py binary <llvm-mc.exe> <llvm15/bin/llvm-objcopy.exe> <llvm15/bin/LLVM-C.dll> pass (incl. the four new per-channel-off fixtures reassembling bit-identically)
WARP ctest --test-dir out/build/dev-361s3 --no-tests=error -R "^pixel_aot_" 2/2 passed (pixel_aot_warp, pixel_aot_hardware)
RX 9060 XT $env:XBOX2WINDOWS_ADAPTER="RX 9060 XT"; ctest ... -R "^pixel_aot_hardware$" 1/1 passed
RTX 5060 Ti $env:XBOX2WINDOWS_ADAPTER="RTX 5060 Ti"; ctest ... -R "^pixel_aot_hardware$" 1/1 passed
Form coverage out/pe-env/Scripts/python.exe -B tests/form_coverage_check.py form coverage checks passed
Full suite ctest --test-dir out/build/dev-361s3 --no-tests=error 146/146 passed; 3 capability skips (bvh_wave64_hardware, bvh_wave64_warp, wave_shuffle_warp)
Negative controls (all three backends): all-channel PSO vs sentinel-expecting reference and corrupted enabled-channel reference each exit 1 with pixel_mismatch; rejection controls raise before any program is recorded for coverage. Sentinels: enabled channels bit-exact, disabled channels hold (-1, 2, -3, 4).

Environment

  • Windows 11 10.0.26200.9711, MSVC 14.44.35207 (VS 2022 Build Tools), CMake dev preset.
  • SDK DXC bin/10.0.26100.0/x64/dxc.exe (dxcompiler 1.8.2502.11), -denorm preserve at ps_6_2.
  • Adapters: AMD RX 9060 XT (32.0.32029.2010), NVIDIA RTX 5060 Ti (32.0.16.2124), WARP 10.0.26100.9711. Debug layer unavailable.
  • Assembler round trip: LLVM 15.0.7 gfx1013 via the clang-wrapper tools.

Evidence / follow-up

  • Measured on LLVM 15.0.7: exp mrt0 v12, off, off, off done vm and the mixed forms reassemble bit-identically, so per-channel off text is authoritative for the uncompressed form (round-trip fixtures pin this).
  • Out of scope, still rejected: other targets (mrt1+, mrtz, null), exports without done vm, multiple exports, partial mask + integer export.
  • #338 (null export after a kill) can build on this stage later.
**@⁠abilliontokens** on GitHub · 2026-11-22 01:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/429) `abilliontokens:shader/exp-enable-mask-uncompressed` → `main` · +57 −20 · 5 files · 6 commits · merged 2026-11-23 08:24 UTC ## Change Refs #361 — **stage 3** (non-compressed 32-bit exports with per-channel `off` masks), per the issue's proposed split. **Depends on #398** (`shader/exp-enable-mask`, stage 1), which itself depends on #363; this branch stacks on #398's head and must land after both. Until they merge, the diff against `main` includes their commits; the incremental change is the single commit on top. - `lower()` now accepts `off` in any operand of the uncompressed export `exp mrt0 vA, vB, vC, vD done vm`. Each enabled operand must be a distinct sample/alu register; the four enable bits form the channel mask reported by `return_write_mask` (so masks 0x1..0xE become reachable for this form, in addition to 0xF). Disabled channels return `0.0f` behind the same immaterial-values comment as stage 1, since the harness blocks those writes with the PSO's `RenderTargetWriteMask[0]`. An all-off export (mask 0) is rejected, and a partial mask combined with `integer_export` is rejected (out of scope); the full-mask integer path is byte-identical to before. - Compressed exports stay restricted to the three LLVM-normalized forms {0x3, 0xC, 0xF}: `off` inside a compressed export and half-pair text such as `v16, off, off, off done compr vm` remain rejected. LLVM 15 normalizes compressed half-pair enables to whole pairs, so they are unexpressible in disassembly text (stage 2 stays dropped). - Case plumbing: `write_case(write_mask=...)` accepts any nonzero nibble 0x1..0xF, and the renderer accepts any nonzero trailer nibble (0 keeps the all-channel default), clearing to the sentinel (-1, 2, -3, 4) for every partial mask. Cases written without a trailer keep the original 1280-byte format byte-identically. - Fixtures: `uncompressed_export(body, mask)` builds the per-channel-off text; masks 0x1, 0x8, 0x5, 0xA joined the LLVM 15 assembler round-trip list in `check_binary`. `check_exp_mask_uncompressed_draw` draws masks 0x1, 0x8, 0x5, 0xA, 0xF with distinct per-channel constant words through `v_sub_f32`: enabled channels compare bit-exactly against the reference on the R32G32B32A32 target, disabled channels keep the sentinel. Two negative controls must report `pixel_mismatch` on every backend: the EN=0x5 shader drawn under an all-channel PSO write mask against the sentinel-expecting reference (receives the immaterial zeros), and a corrupted enabled-channel reference. Rejection controls cover `off` in a compressed export, compressed half-pair text, the all-off uncompressed export, a duplicated enabled register, and partial mask + `integer_export`. ## Verification Windows 11 x64 build via `tools/dev.ps1` (MSVC), `cmake --preset dev -B out/build/dev-361s3 -DINTAKE_PYTHON=out/pe-env/Scripts/python.exe`, then: | Gate | Command | Result | |---|---|---| | Build | `cmake --build out/build/dev-361s3` | 371/371 targets, no warnings | | Binary round trip | `out/pe-env/Scripts/python.exe -B tests/pixel_aot_check.py binary <llvm-mc.exe> <llvm15/bin/llvm-objcopy.exe> <llvm15/bin/LLVM-C.dll>` | pass (incl. the four new per-channel-off fixtures reassembling bit-identically) | | WARP | `ctest --test-dir out/build/dev-361s3 --no-tests=error -R "^pixel_aot_"` | 2/2 passed (`pixel_aot_warp`, `pixel_aot_hardware`) | | RX 9060 XT | `$env:XBOX2WINDOWS_ADAPTER="RX 9060 XT"; ctest ... -R "^pixel_aot_hardware$"` | 1/1 passed | | RTX 5060 Ti | `$env:XBOX2WINDOWS_ADAPTER="RTX 5060 Ti"; ctest ... -R "^pixel_aot_hardware$"` | 1/1 passed | | Form coverage | `out/pe-env/Scripts/python.exe -B tests/form_coverage_check.py` | `form coverage checks passed` | | Full suite | `ctest --test-dir out/build/dev-361s3 --no-tests=error` | 146/146 passed; 3 capability skips (`bvh_wave64_hardware`, `bvh_wave64_warp`, `wave_shuffle_warp`) | Negative controls (all three backends): all-channel PSO vs sentinel-expecting reference and corrupted enabled-channel reference each exit 1 with `pixel_mismatch`; rejection controls raise before any program is recorded for coverage. Sentinels: enabled channels bit-exact, disabled channels hold (-1, 2, -3, 4). ## Environment - Windows 11 10.0.26200.9711, MSVC 14.44.35207 (VS 2022 Build Tools), CMake dev preset. - SDK DXC `bin/10.0.26100.0/x64/dxc.exe` (dxcompiler 1.8.2502.11), `-denorm preserve` at `ps_6_2`. - Adapters: AMD RX 9060 XT (32.0.32029.2010), NVIDIA RTX 5060 Ti (32.0.16.2124), WARP 10.0.26100.9711. Debug layer unavailable. - Assembler round trip: LLVM 15.0.7 gfx1013 via the clang-wrapper tools. ## Evidence / follow-up - Measured on LLVM 15.0.7: `exp mrt0 v12, off, off, off done vm` and the mixed forms reassemble bit-identically, so per-channel `off` text is authoritative for the uncompressed form (round-trip fixtures pin this). - Out of scope, still rejected: other targets (`mrt1`+, `mrtz`, `null`), exports without `done vm`, multiple exports, partial mask + integer export. - #338 (null export after a kill) can build on this stage later.
Refs #361 stage 3, stacked on #398/#363. exp mrt0 ... done vm takes per-channel off, which LLVM 15 round-trips verbatim; the enabled channels' 4-bit mask is reported via return_write_mask. Trailer write-mask nibble widens to 0x1..0xF (renderer sentinel-clears for any partial mask); compressed stays {0x3,0xC,0xF} with half-pair text still rejected. All-off, duplicated enabled registers and partial mask + integer_export are refused. Sentinel draws for masks 0x1/0x8/0x5/0xA/0xF on WARP, RX 9060 XT and RTX 5060 Ti plus all-channel-PSO and corrupted-reference negative controls; assembler round-trip fixtures added.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:51:15 +00:00
github manually merged commit 463bf9f762 into gh-pr/429/base 2026-11-26 21:51:17 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-23 07:06 UTC · original

I pushed b639001 after #434 merged. Partial uncompressed exports require the explicit floating-point RT0 mask, with the ordinary API and integer export both refusing them. LLVM 15 and the WARP and hardware Release draws passed for both compressed and uncompressed fixtures. The uncompressed references retain bits below binary16 precision and detect both a wrong PSO mask and a wrong enabled-channel value. Waiting for the final CI.

**@⁠R0Y00** on GitHub · 2026-11-23 07:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/429#issuecomment-7093991154) I pushed `b639001` after #434 merged. Partial uncompressed exports require the explicit floating-point RT0 mask, with the ordinary API and integer export both refusing them. LLVM 15 and the WARP and hardware Release draws passed for both compressed and uncompressed fixtures. The uncompressed references retain bits below binary16 precision and detect both a wrong PSO mask and a wrong enabled-channel value. Waiting for the final CI.
This discussion has been locked. Commenting is limited to contributors.
No description provided.