shader: cover four v_mad_legacy_f32 and literal multiply-add lowerings #654

Merged
Leyukaka merged 1 commit from upstream-pr/660 into main 2026-11-22 18:31:20 +00:00
Leyukaka commented 2026-11-22 18:16:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-22T18:16:40Z.


Change

This closes four coverage gaps in the v_mad_legacy_f32 and literal multiply-add lowering of tools/pixel_aot.py. Each was a one-line mutation of the translator that passed every WARP test on main. Only tests/pixel_aot_check.py changes (19 added, 4 removed lines); the translator does not.

check_legacy_multiply_add_draws first draws one edge program, with s44..s47 = -0.0, +inf, NaN, -1.0:

Channel Instruction Expected Mutation it covers
R v_mad_legacy_f32 v12, s44, s45, 1.0 (-0.0 * +inf + 1.0) 1.0 only +0.0 treated as zero (bit test)
G v_mad_legacy_f32 v13, s46, 1.0, 1.0 (NaN * 1.0 + 1.0) NaN (checked by class) NaN operand forced to a zero product
B v_madak_f32 v14, s44, v19, 0x3f400000 0.75 literal loses bit 22
A v_mad_legacy_f32 v15, 1.0, |v19|, 0.0 with v19 = -1.0 1.0 |src1| loses its abs modifier

Then the original program is translated and compiled again, and the existing draws run unchanged. The inner case writer is renamed to write_legacy_case, so the module-level write_case (which takes nan_mask) is reachable from this function.

Verification

On efd2ea0 (branch on 7009a7e), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14, WARP:

ctest --preset dev --no-tests=error -j 4

All 293 tests pass.

Each mutation was applied to tools/pixel_aot.py one at a time, and all WARP tests were run. On main, all of them passed for each mutation. A control that subtracted the addend in mad_legacy was caught by pixel_aot_predicate_rounding_warp, so the run does detect a broken translator. On this branch, each of the four mutations fails pixel_aot_predicate_rounding_warp.

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

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6545957124 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/660). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-22T18:16:40Z. --- ## Change This closes four coverage gaps in the `v_mad_legacy_f32` and literal multiply-add lowering of `tools/pixel_aot.py`. Each was a one-line mutation of the translator that passed every WARP test on `main`. Only `tests/pixel_aot_check.py` changes (19 added, 4 removed lines); the translator does not. `check_legacy_multiply_add_draws` first draws one edge program, with `s44..s47` = `-0.0, +inf, NaN, -1.0`: | Channel | Instruction | Expected | Mutation it covers | |---|---|---|---| | R | `v_mad_legacy_f32 v12, s44, s45, 1.0` (`-0.0 * +inf + 1.0`) | 1.0 | only +0.0 treated as zero (bit test) | | G | `v_mad_legacy_f32 v13, s46, 1.0, 1.0` (`NaN * 1.0 + 1.0`) | NaN (checked by class) | NaN operand forced to a zero product | | B | `v_madak_f32 v14, s44, v19, 0x3f400000` | 0.75 | literal loses bit 22 | | A | `v_mad_legacy_f32 v15, 1.0, \|v19\|, 0.0` with `v19 = -1.0` | 1.0 | `\|src1\|` loses its abs modifier | Then the original program is translated and compiled again, and the existing draws run unchanged. The inner case writer is renamed to `write_legacy_case`, so the module-level `write_case` (which takes `nan_mask`) is reachable from this function. ## Verification On `efd2ea0` (branch on `7009a7e`), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14, WARP: ```text ctest --preset dev --no-tests=error -j 4 ``` All 293 tests pass. Each mutation was applied to `tools/pixel_aot.py` one at a time, and all WARP tests were run. On `main`, all of them passed for each mutation. A control that subtracted the addend in `mad_legacy` was caught by `pixel_aot_predicate_rounding_warp`, so the run does detect a broken translator. On this branch, each of the four mutations fails `pixel_aot_predicate_rounding_warp`. ## 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. - [ ] I updated README/docs when a capability or build requirement changed. (No capability changed.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:44:12 +00:00
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!654
No description provided.