shader: lower gfx1013 v_cvt_f32_ubyte0-3 in pixel_aot #348

Merged
denn0x merged 4 commits from upstream-pr/353 into main 2026-11-22 07:51:17 +00:00
denn0x commented 2026-11-21 23:07:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-21T23:07:21Z.


Change

Advances an independent problem: gfx1013 instruction coverage in pixel_aot. It adds one lowering branch in tools/pixel_aot.py and a draw check in tests/pixel_aot_check.py. No open PR claims v_cvt_f32_ubyte*, and no prerequisite PR is needed.

v_cvt_f32_ubyte0 to v_cvt_f32_ubyte3 convert byte N of a 32-bit source to binary32 as an unsigned integer, which is a common step when unpacking byte-packed data. The source is read as bits (asuint, or the literal word), giving float((word >> 8N) & 0xff). Float abs/neg modifiers do not apply to an integer source, so the translator does not accept them, and the existing sample-overlap and entry-mask guards apply.

Fixture unpack_bytes(). Each of the four outputs reads a different byte, in e32 and e64 forms, and the last uses clamp.

Draw check check_unpack_byte_draws.

  • Two sets of constant words, each a normal binary32 value so its bits survive the constant buffer, with four distinct bytes per word.
  • Each set is compared bit for bit over the 64×64 target on the selected backend.
  • The fixture is also added to check_binary for the LLVM assemble/disassemble round trip.

Negative control: replacing ubyte1 with ubyte0 must produce pixel_mismatch.

Verification

Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, D3D12 debug layer enabled.

  • AMD Radeon RX 9070 XT (vendor 1002, device 7550), driver 32.0.32015.7029
  • WARP: Microsoft Basic Render Driver 10.0.26100.9818
ctest --preset dev --no-tests=error -R '^pixel_aot_' -V
1/2 Test #129: pixel_aot_hardware ...............   Passed   10.28 sec
2/2 Test #132: pixel_aot_warp ...................   Passed    4.21 sec
100% tests passed, 0 tests failed out of 2
  • Mutation check (local, reverted): selecting byte N ^ 1 in the lowering makes pixel_aot_warp fail with pixel_mismatch x=0 y=0 in the new draw.
  • Full suite: ctest --preset dev --no-tests=error gives 146 passed, 0 failed, with the bvh_wave64_warp and wave_shuffle_warp capability skips.

Not run locally: tests/pixel_aot_check.py binary, because this machine has no LLVM with gfx1013. Ubuntu CI covers it.

This is independent of #350 (v_rcp_iflag_f32). Both add a fixture next to the ceiling fixture, so whichever merges second needs a trivial rebase.

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.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6535596709 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/353). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-21T23:07:21Z. --- ## Change Advances an independent problem: gfx1013 instruction coverage in `pixel_aot`. It adds one lowering branch in `tools/pixel_aot.py` and a draw check in `tests/pixel_aot_check.py`. No open PR claims `v_cvt_f32_ubyte*`, and no prerequisite PR is needed. `v_cvt_f32_ubyte0` to `v_cvt_f32_ubyte3` convert byte N of a 32-bit source to binary32 as an unsigned integer, which is a common step when unpacking byte-packed data. The source is read as bits (`asuint`, or the literal word), giving `float((word >> 8N) & 0xff)`. Float `abs`/`neg` modifiers do not apply to an integer source, so the translator does not accept them, and the existing sample-overlap and entry-mask guards apply. **Fixture `unpack_bytes()`.** Each of the four outputs reads a different byte, in e32 and e64 forms, and the last uses `clamp`. **Draw check `check_unpack_byte_draws`.** - Two sets of constant words, each a normal binary32 value so its bits survive the constant buffer, with four distinct bytes per word. - Each set is compared bit for bit over the 64×64 target on the selected backend. - The fixture is also added to `check_binary` for the LLVM assemble/disassemble round trip. **Negative control:** replacing `ubyte1` with `ubyte0` must produce `pixel_mismatch`. ## Verification Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, D3D12 debug layer enabled. - AMD Radeon RX 9070 XT (vendor 1002, device 7550), driver 32.0.32015.7029 - WARP: Microsoft Basic Render Driver 10.0.26100.9818 ```powershell ctest --preset dev --no-tests=error -R '^pixel_aot_' -V ``` ```text 1/2 Test #129: pixel_aot_hardware ............... Passed 10.28 sec 2/2 Test #132: pixel_aot_warp ................... Passed 4.21 sec 100% tests passed, 0 tests failed out of 2 ``` - **Mutation check (local, reverted):** selecting byte `N ^ 1` in the lowering makes `pixel_aot_warp` fail with `pixel_mismatch x=0 y=0` in the new draw. - **Full suite:** `ctest --preset dev --no-tests=error` gives 146 passed, 0 failed, with the `bvh_wave64_warp` and `wave_shuffle_warp` capability skips. Not run locally: `tests/pixel_aot_check.py binary`, because this machine has no LLVM with gfx1013. Ubuntu CI covers it. This is independent of #350 (`v_rcp_iflag_f32`). Both add a fixture next to the ceiling fixture, so whichever merges second needs a trivial rebase. ## 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. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. _AI-assisted (Claude Code)._
upstream-sync closed this pull request 2026-11-24 06:42:36 +00:00
R0Y00 commented 2026-11-24 06:48:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T02:44:45Z.


A three-way merge against main at 1606f7b conflicts in tests/pixel_aot_check.py. The translator hunk merges cleanly. Please preserve the main draw registrations and register check_unpack_byte_draws after the initial adapter availability check. Please rerun the binary fixture and pixel_aot_warp at the new head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7073095899 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/353#issuecomment-7073095899). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T02:44:45Z. --- A three-way merge against main at 1606f7b conflicts in tests/pixel_aot_check.py. The translator hunk merges cleanly. Please preserve the main draw registrations and register check_unpack_byte_draws after the initial adapter availability check. Please rerun the binary fixture and pixel_aot_warp at the new head.
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!348
No description provided.