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

Merged
lukaslw-lab merged 1 commit from upstream-pr/3704 into main 2026-12-01 08:44:54 +00:00
lukaslw-lab commented 2026-12-01 05:42:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T05:42:38Z.


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 #3703 (comment 7301683823). On the 24 captured slot 86 requests listed there, with #3702 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 #3703, #3641.

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 #3703 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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5579827706 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3704). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-12-01T05:42:38Z. --- ## 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 #3703 (comment 7301683823). On the 24 captured slot 86 requests listed there, with #3702 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 #3703, #3641. ## 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 #3703 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)
R0Y00 commented 2026-12-01 08:43:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-01T08:43:26Z.

Review: APPROVED


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6127739622 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3704#pullrequestreview-6127739622). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-01T08:43:26Z. **Review:** APPROVED --- 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.
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!3704
No description provided.