Recompiler: preserve flat pixel parameter bits #302

Manually merged
github merged 1 commit from gh-pr/302/head into gh-pr/302/base 2026-11-26 04:19:23 +00:00
Owner

@⁠ZekkJJ on GitHub · 2026-11-23 22:48 UTC · original
ZekkJJ:codex/ps-flat-integer-inputs → main · +78 −20 · 2 files · 1 commits · merged 2026-11-24 02:44 UTC

Part of #249.

V_INTERP_MOV_F32 P0 loads a parameter word. Casting that word through float changes integer selector bits, so a comparison against 1 or 2 can take the default path.

What is in it

  • Preserve the P0 input bits in the pixel shader emitter. P2 continues to emit a floating-point interpolation result.
  • Draw a synthetic translated VS/PS pair and check the output for 0, 1, 2, and 0xffffffff using both signed and unsigned vertex formats. The compile test also checks floating-point P0 and P2 code generation.

Tested

  • Windows 11 build 26200, Ryzen 7 8845HS, Rust 1.95.0, DXC 1.8.2502.11, debug profile. RTX 4060 Laptop GPU (32.0.16.1656) and Radeon 780M (32.0.31033.3).
  • With only the new regression on 9ab7d76, the RTX 4060 reproduced the bug: selector 1 rendered black where red was expected. The test failed.
  • On 2e67909, cargo test --locked -p xcl --lib p0_ -- --nocapture passed both tests on each adapter.
  • Workspace build and cargo test --locked --workspace -- --test-threads=4 --nocapture passed on NVIDIA with the same Rust diff: 652 passed, 0 failed, 40 ignored. Two wave64 cases reported runtime skips. cargo clippy --locked --workspace --all-targets passed with no diagnostics on changed lines.

Regression run
nullmarsh ran both release builds on the same retail title for 60 seconds each, on a Ryzen 7 5800X3D with an RX 9060 XT (driver 32.0.32029.2010), 32 GB RAM and Windows 11 Pro 26200. Both runs used XCL_NETWORK=0 and no input. Independent test report

The PR run retained 83.5% of the frames and used 100.4% of the peak committed memory. Neither run recorded a crash or device removal. nullmarsh reports that main had a warm shader cache and the PR rebuilt affected shaders at startup.

Both runs used the RX 9060 XT according to nullmarsh. The PR head uses an older smoke script that reports the first WMI adapter, which explains the virtual adapter listed in the original output below.

Main build

xcl-smoke v1
commit: 9ce2070eccf436d7bd38601c90407da447df34f3
gpu: AMD Radeon RX 9060 XT
title: title
seconds: 60
exit: 0x0
frames shown: 1518 (PresentX 1518)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14838 MB

PR head build

xcl-smoke v1
commit: 2e67909989242c648eb4af071326f3ea33754baa
gpu: SudoMaker Virtual Display Adapter
title: title
seconds: 60
exit: 0x0
frames shown: 1268 (PresentX 1268)
presents per 2 s (last 3): 54 52 60
device removals: 0
crashes: 0
peak commit: 14897 MB

Not tested

  • XDefiant UI rendering. The previous bit-preserving change was reverted after its UI text disappeared (58309b9). The new test establishes selector behavior on synthetic inputs.

AI use

  • Codex (GPT-6, exact variant unavailable) investigated the emitter, wrote the patch and tests, ran the checks, and drafted this description.
**@⁠ZekkJJ** on GitHub · 2026-11-23 22:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/302) `ZekkJJ:codex/ps-flat-integer-inputs` → `main` · +78 −20 · 2 files · 1 commits · merged 2026-11-24 02:44 UTC Part of #249. `V_INTERP_MOV_F32` P0 loads a parameter word. Casting that word through `float` changes integer selector bits, so a comparison against `1` or `2` can take the default path. **What is in it** - Preserve the P0 input bits in the pixel shader emitter. P2 continues to emit a floating-point interpolation result. - Draw a synthetic translated VS/PS pair and check the output for `0`, `1`, `2`, and `0xffffffff` using both signed and unsigned vertex formats. The compile test also checks floating-point P0 and P2 code generation. **Tested** - Windows 11 build 26200, Ryzen 7 8845HS, Rust 1.95.0, DXC 1.8.2502.11, debug profile. RTX 4060 Laptop GPU (32.0.16.1656) and Radeon 780M (32.0.31033.3). - With only the new regression on `9ab7d76`, the RTX 4060 reproduced the bug: selector `1` rendered black where red was expected. The test failed. - On `2e67909`, `cargo test --locked -p xcl --lib p0_ -- --nocapture` passed both tests on each adapter. - Workspace build and `cargo test --locked --workspace -- --test-threads=4 --nocapture` passed on NVIDIA with the same Rust diff: 652 passed, 0 failed, 40 ignored. Two wave64 cases reported runtime skips. `cargo clippy --locked --workspace --all-targets` passed with no diagnostics on changed lines. **Regression run** nullmarsh ran both release builds on the same retail title for 60 seconds each, on a Ryzen 7 5800X3D with an RX 9060 XT (driver 32.0.32029.2010), 32 GB RAM and Windows 11 Pro 26200. Both runs used `XCL_NETWORK=0` and no input. [Independent test report](https://github.com/ivall/xcl/pull/302#issuecomment-7120047612) The PR run retained 83.5% of the frames and used 100.4% of the peak committed memory. Neither run recorded a crash or device removal. nullmarsh reports that `main` had a warm shader cache and the PR rebuilt affected shaders at startup. Both runs used the RX 9060 XT according to nullmarsh. The PR head uses an older smoke script that reports the first WMI adapter, which explains the virtual adapter listed in the original output below. Main build ``` xcl-smoke v1 commit: 9ce2070eccf436d7bd38601c90407da447df34f3 gpu: AMD Radeon RX 9060 XT title: title seconds: 60 exit: 0x0 frames shown: 1518 (PresentX 1518) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14838 MB ``` PR head build ``` xcl-smoke v1 commit: 2e67909989242c648eb4af071326f3ea33754baa gpu: SudoMaker Virtual Display Adapter title: title seconds: 60 exit: 0x0 frames shown: 1268 (PresentX 1268) presents per 2 s (last 3): 54 52 60 device removals: 0 crashes: 0 peak commit: 14897 MB ``` **Not tested** - XDefiant UI rendering. The previous bit-preserving change was reverted after its UI text disappeared (`58309b9`). The new test establishes selector behavior on synthetic inputs. **AI use** - Codex (GPT-6, exact variant unavailable) investigated the emitter, wrote the patch and tests, ran the checks, and drafted this description.
V_INTERP_MOV_F32 P0 loads the parameter word. Casting through float changes the bits that integer selector checks consume.

Add a GPU regression for signed and unsigned selectors and retain coverage for P2 interpolation.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:19:21 +00:00
github manually merged commit 2e67909989 into gh-pr/302/base 2026-11-26 04:19:23 +00:00
Author
Owner

@⁠ZekkJJ on GitHub · 2026-11-23 23:40 UTC · original

LGTM

**@⁠ZekkJJ** on GitHub · 2026-11-23 23:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/302#issuecomment-7117235699) LGTM
Author
Owner

@⁠Fizzonaut on GitHub · 2026-11-23 23:50 UTC · original

Independent full-suite test run on commit 2e67909989242c648eb4af071326f3ea33754baa (PR #302 head; clean merge onto origin/main db1ddb2 checked via git merge-tree) on AMD RDNA3 with DXC 1.9 and the D3D12 debug layer: pass.

Tested

  • Hardware / software: AMD Radeon RX 7900 XTX (24516 MiB VRAM, driver 32.0.31007.5012), AMD Ryzen 7 7800X3D, Windows 11 Pro 26H2 (build 26300.9974), rustc 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5 via XCL_DXC_DIR, System32\xgameruntime.dll 10.0.26100.9656, D3D12 debug layer active (D3D12SDKLayers.dll), debug build.
  • Command: powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4), no XCL_SAMPLE_* set:
    • Native (default): 652 passed, 0 failed, 40 ignored, 0 SKIPPED GPU tests (exit 0)
    • XCL_SPLIT_WAVE64=1: 652 passed, 0 failed, 40 ignored, 0 SKIPPED GPU tests (exit 0)
  • Confirmed both new tests (gpu::recomp::tests::gpu_ps_p0_reads_flat_integer_selectors and gpu::recomp::tests::ps_interp_p0_preserves_bits_and_p2_converts_to_float) ran and passed in both modes.

Not tested

  • Retail title / XDefiant UI rendering / scripts/smoke.ps1 (no unpacked Xbox title available), XCL_SAMPLE_* game-data tests, release build, NVIDIA / wave32-only GPUs.
  • No manual code review performed.

AI use

  • Antigravity (Gemini 4 Neon) checked out the PR, ran both test runs, and drafted this test report from the actual output.
**@⁠Fizzonaut** on GitHub · 2026-11-23 23:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/302#issuecomment-7117412248) Independent full-suite test run on commit `2e67909989242c648eb4af071326f3ea33754baa` (PR #302 head; clean merge onto `origin/main` `db1ddb2` checked via `git merge-tree`) on AMD RDNA3 with DXC 1.9 and the D3D12 debug layer: **pass**. **Tested** - Hardware / software: AMD Radeon RX 7900 XTX (24516 MiB VRAM, driver `32.0.31007.5012`), AMD Ryzen 7 7800X3D, Windows 11 Pro 26H2 (build `26300.9974`), `rustc 1.100.0` (`stable-x86_64-pc-windows-msvc`), DXC `1.9.2609.5` via `XCL_DXC_DIR`, `System32\xgameruntime.dll` `10.0.26100.9656`, D3D12 debug layer active (`D3D12SDKLayers.dll`), debug build. - Command: `powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`), no `XCL_SAMPLE_*` set: - Native (default): **652 passed, 0 failed, 40 ignored**, **0 `SKIPPED` GPU tests** (exit 0) - `XCL_SPLIT_WAVE64=1`: **652 passed, 0 failed, 40 ignored**, **0 `SKIPPED` GPU tests** (exit 0) - Confirmed both new tests (`gpu::recomp::tests::gpu_ps_p0_reads_flat_integer_selectors` and `gpu::recomp::tests::ps_interp_p0_preserves_bits_and_p2_converts_to_float`) ran and passed in both modes. **Not tested** - Retail title / XDefiant UI rendering / `scripts/smoke.ps1` (no unpacked Xbox title available), `XCL_SAMPLE_*` game-data tests, release build, NVIDIA / wave32-only GPUs. - No manual code review performed. **AI use** - Antigravity (Gemini 4 Neon) checked out the PR, ran both test runs, and drafted this test report from the actual output.
Author
Owner

@⁠ghost on GitHub · 2026-11-24 00:00 UTC · original

Tested 2e67909 merged onto main 2b4bb43 (clean merge) on a discrete AMD RDNA4 card: pass, and both new tests fail without the emit.rs change, as on your RTX 4060.

Tested

  • AMD Radeon RX 9060 XT (RDNA4), driver 32.0.32029.2010; Ryzen 7 5800X3D; Windows 11 Pro 26200; Rust 1.100.0; DXC 1.9.2602.17 (SDK 10.0.26100); debug build.
  • .\scripts\test.ps1: 671 passed, 0 failed, 41 ignored; no SKIPPED GPU tests on this adapter.
  • XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --lib p0_: ps_interp_p0_preserves_bits_and_p2_converts_to_float and gpu_ps_p0_reads_flat_integer_selectors pass.
  • Negative control: the merged tree with only emit.rs put back to main. Both fail. The GPU test fails at DXGI_FORMAT(3) selector 0x00000001, pixel 0: it got [0, 0, 0, 1] and expected [1, 0, 0, 1].

Not tested

  • No XCL_SAMPLE_* and no retail title yet, so no smoke.ps1 runs. XDefiant's UI (the reason for 58309b9) isn't covered either.

AI use

  • Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
**@⁠ghost** on GitHub · 2026-11-24 00:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/302#issuecomment-7117598110) Tested `2e67909` merged onto `main` `2b4bb43` (clean merge) on a discrete AMD RDNA4 card: **pass**, and both new tests fail without the `emit.rs` change, as on your RTX 4060. **Tested** - AMD Radeon RX 9060 XT (RDNA4), driver 32.0.32029.2010; Ryzen 7 5800X3D; Windows 11 Pro 26200; Rust 1.100.0; DXC 1.9.2602.17 (SDK 10.0.26100); debug build. - `.\scripts\test.ps1`: 671 passed, 0 failed, 41 ignored; no `SKIPPED` GPU tests on this adapter. - `XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --lib p0_`: `ps_interp_p0_preserves_bits_and_p2_converts_to_float` and `gpu_ps_p0_reads_flat_integer_selectors` pass. - Negative control: the merged tree with only `emit.rs` put back to `main`. Both fail. The GPU test fails at `DXGI_FORMAT(3) selector 0x00000001, pixel 0`: it got `[0, 0, 0, 1]` and expected `[1, 0, 0, 1]`. **Not tested** - No `XCL_SAMPLE_*` and no retail title yet, so no `smoke.ps1` runs. XDefiant's UI (the reason for `58309b9`) isn't covered either. **AI use** - Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
Author
Owner

@⁠PHeitor1 on GitHub · 2026-11-24 00:13 UTC · original

Tested 2e67909 merged onto main 3516080.

RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed, so the debug-layer tests run), rustc 1.100.0 MSVC, debug, cargo test --workspace --no-fail-fast -- --test-threads=4, no XCL_SAMPLE_*.

Pass: 671 passed, 0 failed, 41 ignored. SKIPPED: only the 2 no wave64 tests (gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware). Build clean.

Run and written with Claude Code (Claude Opus 5.5).

**@⁠PHeitor1** on GitHub · 2026-11-24 00:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/302#issuecomment-7117845013) Tested `2e67909` merged onto `main` `3516080`. RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed, so the debug-layer tests run), rustc 1.100.0 MSVC, debug, `cargo test --workspace --no-fail-fast -- --test-threads=4`, no `XCL_SAMPLE_*`. **Pass:** 671 passed, 0 failed, 41 ignored. SKIPPED: only the 2 `no wave64` tests (`gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`). Build clean. _Run and written with Claude Code (Claude Opus 5.5)._
Author
Owner

@⁠ghost on GitHub · 2026-11-24 02:20 UTC · original

Regression run on a retail title, which the description lists as pending: same title, 60 s each, run one after the other on the same PC (AMD Radeon RX 9060 XT, RDNA4, driver 32.0.32029.2010; Ryzen 7 5800X3D; 32 GB; Windows 11 Pro 26200), release builds, XCL_NETWORK=0, no input. Both blocks come from scripts/smoke.ps1 with -Xcl pointing at that commit's release build.

main

xcl-smoke v1
commit: 9ce2070eccf436d7bd38601c90407da447df34f3
gpu: AMD Radeon RX 9060 XT
title: title
seconds: 60
exit: 0x0
frames shown: 1518 (PresentX 1518)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14838 MB

This PR's head (no uncommitted changes)

xcl-smoke v1
commit: 2e67909989242c648eb4af071326f3ea33754baa
gpu: SudoMaker Virtual Display Adapter
title: title
seconds: 60
exit: 0x0
frames shown: 1268 (PresentX 1268)
presents per 2 s (last 3): 54 52 60
device removals: 0
crashes: 0
peak commit: 14897 MB
  • No crash and no device removal on either. The PR run shows 1268 frames, 84 % of main's 1518. Its first seconds rebuild the pixel shaders whose P0 code changed, while main's cache was already warm from an earlier run.
  • The PR block's gpu: line is wrong: the game ran on the RX 9060 XT. Your head carries the older smoke.ps1, which names the first adapter WMI lists, and on this PC that's a virtual display driver. main's script reads the adapter XCL actually used.
  • Not covered yet: whether the menu text and UI still draw the same, which is the XDefiant concern behind 58309b9. I'll compare sampled frames (XCL_FRAME_DUMP) from both builds and add the result here. I won't post images.

AI use

  • Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
**@⁠ghost** on GitHub · 2026-11-24 02:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/302#issuecomment-7120047612) Regression run on a retail title, which the description lists as pending: same title, 60 s each, run one after the other on the same PC (AMD Radeon RX 9060 XT, RDNA4, driver 32.0.32029.2010; Ryzen 7 5800X3D; 32 GB; Windows 11 Pro 26200), release builds, `XCL_NETWORK=0`, no input. Both blocks come from `scripts/smoke.ps1` with `-Xcl` pointing at that commit's release build. **`main`** ``` xcl-smoke v1 commit: 9ce2070eccf436d7bd38601c90407da447df34f3 gpu: AMD Radeon RX 9060 XT title: title seconds: 60 exit: 0x0 frames shown: 1518 (PresentX 1518) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14838 MB ``` **This PR's head** (no uncommitted changes) ``` xcl-smoke v1 commit: 2e67909989242c648eb4af071326f3ea33754baa gpu: SudoMaker Virtual Display Adapter title: title seconds: 60 exit: 0x0 frames shown: 1268 (PresentX 1268) presents per 2 s (last 3): 54 52 60 device removals: 0 crashes: 0 peak commit: 14897 MB ``` - No crash and no device removal on either. The PR run shows 1268 frames, 84 % of `main`'s 1518. Its first seconds rebuild the pixel shaders whose P0 code changed, while `main`'s cache was already warm from an earlier run. - The PR block's `gpu:` line is wrong: the game ran on the RX 9060 XT. Your head carries the older `smoke.ps1`, which names the first adapter WMI lists, and on this PC that's a virtual display driver. `main`'s script reads the adapter XCL actually used. - Not covered yet: whether the menu text and UI still draw the same, which is the XDefiant concern behind `58309b9`. I'll compare sampled frames (`XCL_FRAME_DUMP`) from both builds and add the result here. I won't post images. **AI use** - Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
This discussion has been locked. Commenting is limited to contributors.
No description provided.