shader: lower v_cvt_i32_f32 and v_mad_f32 in the mesh frontend #3706

Manually merged
github merged 1 commit from github-bot/gh-3704 into main 2026-12-01 08:47:18 +00:00 AGit
Owner

@⁠lukaslw-lab on GitHub · 2026-12-01 05:42 UTC · original
lukaslw-lab:shader/mesh-cvt-i32-mad-f32 → main · +23 −2 · 3 files · 1 commits · merged 2026-12-01 08:44 UTC

Change

The mesh VALU list now routes v_cvt_i32_f32 and v_mad_f32 to the shared ALU, which already lowers both:

  • v_cvt_i32_f32 is a saturating conversion with NaN mapped to zero.
  • v_mad_f32 is an unfused multiply and add, emitted as fmul then fadd, not fma. Like v_mad_legacy_f32, it takes three sources.

The VOP3 clamp form of v_cvt_i32_f32 keeps the shared integer conversion output modifier refusal.

This is item 2 of the work split in #3705 (comment 7301683823). On the 24 captured slot 86 requests listed there, with #3704 also applied:

  • the 3 requests that stopped at v_mad_f32 now stop at an idxen offen raw load (item 3);
  • the 18 requests behind the scalar loop (item 1) no longer stop at v_cvt_i32_f32 once past the loop. Their next refusal is the 2D table image load (item 4).

Refs #3705, #3643.

Verification

Build release at this branch (Windows 10 19045, MSVC 2022, DXC 1.9.2609):

python -B tests/native_direct_mesh_check.py <compile_dxil.exe> <dxc dir>  -> passed
python -B tests/docs_links_check.py                                       -> passed
ctest --test-dir out/build/release -R "native_direct|native_scalar|mesh|native_.*root"
  -> 212 tests: 105 passed, 83 capability skips (77), 24 failed

The same 24 _hardware tests fail on this host without this change (Windows 10 without the Agility SDK; NVIDIA RTX 3080 Ti, driver 32.0.16.1047, debug layer on).

New cases in native_direct_mesh_check.py, built on the source-built triangle:

  • v-cvt-i32-f32: v_cvt_f32_u32 v1, v0, then v_cvt_i32_f32 v1, v1. Checks the fptosi, the NaN test and that the result reaches the exported X.
  • v-cvt-i32-f32-clamp: the VOP3 form with clamp is refused.
  • v-mad-f32: v_mad_f32 v1, v1, 2.0, -1.0. Checks one fmul and one fadd, and no dx.op.tertiary.f32.

Controls:

  • Without the source change, v-cvt-i32-f32 fails with unsupported mesh instruction or EXEC state: v_cvt_i32_f32.
  • With only v_mad_f32 removed from the list, v-mad-f32 fails with ... v_mad_f32.

Evidence and follow-up

Source-built words only. The counts on captured requests are local, offline (compile_dxil ... gfx1013-container-ms-texture-heap). Note added at the end of docs/experiments/native-fixed-mesh57.md.

Items 1, 3 and 4 of #3705 stay open.

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.

🤖 Generated with Claude Code

**@⁠lukaslw-lab** on GitHub · 2026-12-01 05:42 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3704) `lukaslw-lab:shader/mesh-cvt-i32-mad-f32` → `main` · +23 −2 · 3 files · 1 commits · merged 2026-12-01 08:44 UTC ## Change The mesh VALU list now routes `v_cvt_i32_f32` and `v_mad_f32` to the shared ALU, which already lowers both: - `v_cvt_i32_f32` is a saturating conversion with NaN mapped to zero. - `v_mad_f32` is an unfused multiply and add, emitted as `fmul` then `fadd`, not `fma`. Like `v_mad_legacy_f32`, it takes three sources. The VOP3 clamp form of `v_cvt_i32_f32` keeps the shared `integer conversion output modifier` refusal. This is item 2 of the work split in #3705 (comment 7301683823). On the 24 captured slot 86 requests listed there, with #3704 also applied: - the 3 requests that stopped at `v_mad_f32` now stop at an `idxen offen` raw load (item 3); - the 18 requests behind the scalar loop (item 1) no longer stop at `v_cvt_i32_f32` once past the loop. Their next refusal is the 2D table image load (item 4). Refs #3705, #3643. ## Verification Build `release` at this branch (Windows 10 19045, MSVC 2022, DXC 1.9.2609): ``` python -B tests/native_direct_mesh_check.py <compile_dxil.exe> <dxc dir> -> passed python -B tests/docs_links_check.py -> passed ctest --test-dir out/build/release -R "native_direct|native_scalar|mesh|native_.*root" -> 212 tests: 105 passed, 83 capability skips (77), 24 failed ``` The same 24 `_hardware` tests fail on this host without this change (Windows 10 without the Agility SDK; NVIDIA RTX 3080 Ti, driver 32.0.16.1047, debug layer on). New cases in `native_direct_mesh_check.py`, built on the source-built triangle: - `v-cvt-i32-f32`: `v_cvt_f32_u32 v1, v0`, then `v_cvt_i32_f32 v1, v1`. Checks the `fptosi`, the NaN test and that the result reaches the exported X. - `v-cvt-i32-f32-clamp`: the VOP3 form with clamp is refused. - `v-mad-f32`: `v_mad_f32 v1, v1, 2.0, -1.0`. Checks one `fmul` and one `fadd`, and no `dx.op.tertiary.f32`. Controls: - Without the source change, `v-cvt-i32-f32` fails with `unsupported mesh instruction or EXEC state: v_cvt_i32_f32`. - With only `v_mad_f32` removed from the list, `v-mad-f32` fails with `... v_mad_f32`. ## Evidence and follow-up Source-built words only. The counts on captured requests are local, offline (`compile_dxil ... gfx1013-container-ms-texture-heap`). Note added at the end of `docs/experiments/native-fixed-mesh57.md`. Items 1, 3 and 4 of #3705 stay open. ## 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The shared ALU already lowers both: v_cvt_i32_f32 as a saturating
conversion with NaN mapped to zero, v_mad_f32 as an unfused multiply and
add. Route them from the mesh VALU list; v_mad_f32 takes three sources,
like v_mad_legacy_f32. The clamp form of v_cvt_i32_f32 keeps the shared
"integer conversion output modifier" refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 05:44:55 +00:00
github manually merged commit b673a885f4 into main 2026-12-01 08:47:18 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-01 08:43 UTC · original · approved these changes

Reviewed the reuse of the existing C++ ALU for v_cvt_i32_f32 and v_mad_f32, including source tracking for the three-operand case. The integrated native_direct_mesh and WARP and RTX 4060 startup_mesh57_runtime fixtures passed.

**@⁠R0Y00** on GitHub · 2026-12-01 08:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3704#pullrequestreview-6127739622) · **approved these changes** Reviewed the reuse of the existing C++ ALU for v_cvt_i32_f32 and v_mad_f32, including source tracking for the three-operand case. The integrated native_direct_mesh and WARP and RTX 4060 startup_mesh57_runtime fixtures passed.
This discussion has been locked. Commenting is limited to contributors.
No description provided.