shader: cover eight depth-mask lowerings that no draw observed #624

Merged
Leyukaka merged 1 commit from upstream-pr/630 into main 2026-11-22 17:23:36 +00:00
Leyukaka commented 2026-11-22 16:31:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-22T16:31:39Z.


Change

This closes eight coverage gaps in tools/depth_mask_aot.py. Each was a one-line mutation of the translator that passed every WARP test on main. Only tests/depth_mask_check.py changes; the translator does not.

The check gains an extended program next to the existing one (which is unchanged):

  • it reads its seed from constant row 1, component z (offset 0x18);
  • it adds 12 with s_add_i32 and masks the result with s_and_b32 31;
  • it samples Y with a 32-pixel period.

The extended program runs the existing positive draws and swap controls, plus thresholds of 62/64 and 63/64 at the top of its noise range. The expected pictures come from the check's own Python model.

Verification

On 91bc890 (branch on 2f1f832), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14, WARP and NVIDIA GeForce RTX 5080:

ctest --preset dev --no-tests=error -R '^depth_mask_draw_(warp|hardware)$'
ctest --preset dev --no-tests=error -j 4

Both pass (282 of 282 for the full suite).

Each mutation was applied to tools/depth_mask_aot.py one at a time, and all WARP tests were run. On main, all of them passed for each mutation. A control that inverted the depth comparison was caught by depth_mask_draw_warp, so the run does detect a broken translator. On this branch, each mutation fails depth_mask_draw_warp:

Mutation Caught through
position Y read as X Y-period noise
constant row from offset // 32 seed in row 1
constant components z and w swapped seed in component z
s_add_i32 lowered as a subtraction the +12 offset
s_and_b32 lowered as an OR the mask after the add
the comparison becomes <= threshold 63/64, equal to the top noise value
fract cap lowered to 62/64 threshold 62/64
byte extraction masked to 4 bits seed + 12 = 19

Two limits remain: the maximum noise is 63/64, so removing the fract cap entirely would still pass, and the & 31 mask is a no-op for seed 7.

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:6544849748 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/630). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-22T16:31:39Z. --- ## Change This closes eight coverage gaps in `tools/depth_mask_aot.py`. Each was a one-line mutation of the translator that passed every WARP test on `main`. Only `tests/depth_mask_check.py` changes; the translator does not. The check gains an extended program next to the existing one (which is unchanged): - it reads its seed from constant row 1, component z (offset `0x18`); - it adds 12 with `s_add_i32` and masks the result with `s_and_b32 31`; - it samples Y with a 32-pixel period. The extended program runs the existing positive draws and swap controls, plus thresholds of 62/64 and 63/64 at the top of its noise range. The expected pictures come from the check's own Python model. ## Verification On `91bc890` (branch on `2f1f832`), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14, WARP and NVIDIA GeForce RTX 5080: ```text ctest --preset dev --no-tests=error -R '^depth_mask_draw_(warp|hardware)$' ctest --preset dev --no-tests=error -j 4 ``` Both pass (282 of 282 for the full suite). Each mutation was applied to `tools/depth_mask_aot.py` one at a time, and all WARP tests were run. On `main`, all of them passed for each mutation. A control that inverted the depth comparison was caught by `depth_mask_draw_warp`, so the run does detect a broken translator. On this branch, each mutation fails `depth_mask_draw_warp`: | Mutation | Caught through | |---|---| | position Y read as X | Y-period noise | | constant row from `offset // 32` | seed in row 1 | | constant components z and w swapped | seed in component z | | `s_add_i32` lowered as a subtraction | the +12 offset | | `s_and_b32` lowered as an OR | the mask after the add | | the comparison becomes `<=` | threshold 63/64, equal to the top noise value | | fract cap lowered to 62/64 | threshold 62/64 | | byte extraction masked to 4 bits | seed + 12 = 19 | Two limits remain: the maximum noise is 63/64, so removing the fract cap entirely would still pass, and the `& 31` mask is a no-op for seed 7. ## 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:03 +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!624
No description provided.