shader: cover seven sampled-coverage lowerings that no draw observed #617

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

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


Change

This closes seven coverage gaps in tools/sampled_coverage_aot.py. Each was a mutation of the translator that passed every WARP test on main. Only tests/sampled_coverage_check.py changes; the translator does not.

  • A red-channel program (RED_PROGRAM, red_bindings): a descriptor selector that needs a shift of 8, a threshold read from constant vector 2, and a red sample that is 1 in texture 0 and 0 in texture 1. Its other-texture control is unchanged.
  • A variant of that program that reads the scale from component w (word 3).
  • A case with a negative scale and a negative threshold, (-1, -0.5), on the alpha program.

Expected coverage is computed in Python from the texture contents in tests/pixel_aot_render.cpp.

Verification

On cd17e1f (branch on efecacf), 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 '^sampled_coverage_(warp|hardware)$'
ctest --preset dev --no-tests=error -j 4

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

Each mutation was applied to tools/sampled_coverage_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 discard comparison was caught by sampled_coverage_warp, so the run does detect a broken translator. On this branch, each mutation fails sampled_coverage_warp:

Mutation Caught by
the sampled channel index gains bit 1 red program
constant components x and w swap scale read from component w
the constant vector index wraps at 2 threshold from vector 2
the scale is taken as its absolute value negative scale
the threshold is taken as its absolute value negative threshold
the selector shift is masked to 3 bits shift of 8
the shifted selector loses bit 31 shift of 8 into bit 31

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:6544725352 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/623). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-22T16:19:39Z. --- ## Change This closes seven coverage gaps in `tools/sampled_coverage_aot.py`. Each was a mutation of the translator that passed every WARP test on `main`. Only `tests/sampled_coverage_check.py` changes; the translator does not. - A red-channel program (`RED_PROGRAM`, `red_bindings`): a descriptor selector that needs a shift of 8, a threshold read from constant vector 2, and a red sample that is 1 in texture 0 and 0 in texture 1. Its other-texture control is unchanged. - A variant of that program that reads the scale from component w (word 3). - A case with a negative scale and a negative threshold, `(-1, -0.5)`, on the alpha program. Expected coverage is computed in Python from the texture contents in `tests/pixel_aot_render.cpp`. ## Verification On `cd17e1f` (branch on `efecacf`), 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 '^sampled_coverage_(warp|hardware)$' ctest --preset dev --no-tests=error -j 4 ``` Both pass (281 of 281 for the full suite). Each mutation was applied to `tools/sampled_coverage_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 discard comparison was caught by `sampled_coverage_warp`, so the run does detect a broken translator. On this branch, each mutation fails `sampled_coverage_warp`: | Mutation | Caught by | |---|---| | the sampled channel index gains bit 1 | red program | | constant components x and w swap | scale read from component w | | the constant vector index wraps at 2 | threshold from vector 2 | | the scale is taken as its absolute value | negative scale | | the threshold is taken as its absolute value | negative threshold | | the selector shift is masked to 3 bits | shift of 8 | | the shifted selector loses bit 31 | shift of 8 into bit 31 | ## 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:00 +00:00
JB2WIN commented 2026-11-24 06:48:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-22T18:53:34Z.


Independent Windows run of this PR on physical hardware:

  • Commit under test: cd17e1f (PR head), built from source
  • Windows 11 (10.0.26200.9974), VS Build Tools 2026 (MSVC 19.51), SDK 10.0.26100.8249 (DXC 1.8.2502.11), dev preset
  • NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP 10.0.26100.9818, D3D12 debug layer enabled

ctest --preset dev --no-tests=error -R '^pixel_aot_' -V: 22/22 passed (11 hardware + 11 WARP), no skips. The debug layer reported debug_errors=0 on all 436 draws. pixel_aot_hardware took 34.6 s, pixel_aot_predicate_rounding_hardware 32.3 s and pixel_aot_blend_scalar_hardware 33.1 s.

I only ran the unmutated PR, not the mutation table.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7083948316 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/623#issuecomment-7083948316). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-22T18:53:34Z. --- Independent Windows run of this PR on physical hardware: - Commit under test: `cd17e1f` (PR head), built from source - Windows 11 (10.0.26200.9974), VS Build Tools 2026 (MSVC 19.51), SDK 10.0.26100.8249 (DXC 1.8.2502.11), dev preset - NVIDIA GeForce RTX 3080 (driver 32.0.16.2124) and WARP 10.0.26100.9818, D3D12 debug layer enabled `ctest --preset dev --no-tests=error -R '^pixel_aot_' -V`: **22/22 passed** (11 hardware + 11 WARP), no skips. The debug layer reported `debug_errors=0` on all 436 draws. `pixel_aot_hardware` took 34.6 s, `pixel_aot_predicate_rounding_hardware` 32.3 s and `pixel_aot_blend_scalar_hardware` 33.1 s. I only ran the unmutated PR, not the mutation table. AI-assisted.
rwZephyr commented 2026-11-24 06:48:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rwZephyr on 2026-11-22T19:05:15Z.


Independent check of the x/w component-swap control on cd17e1f85ff611633a28ee35c2af6771d8f2a611 and its parent efecacfca7266cac0623226eb7ca8d40926c3407. Windows 10 22H2 build 19045.6466, MSVC 19.44.35230, Windows SDK 10.0.26100.0, DXC 1.8.2502.11, Debug with /MTd. D3D12 debug layer unavailable on both adapters.

cmake --preset dev "-DINTAKE_PYTHON=$((Get-Command python).Source)" "-DDXC_EXECUTABLE=$dxc" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug
cmake --build --preset dev --parallel 4 --target offscreen_check
$env:XBOX2WINDOWS_ADAPTER = 'RTX 3060 Ti'
ctest --preset dev --no-tests=error -V -R '^sampled_coverage_(hardware|warp)$'
  • Hardware: RTX 3060 Ti (10de:2414), driver 621.24 (32.0.16.2124 via DXGI). Clean fixture passed.
  • Software: In-box WARP (1414:008c), driver 10.0.19041.5794. Clean fixture passed. No skips on either adapter.

The clean PR checked 64 pixels per draw across all 13 positive draws on each adapter. The final red case, which reads the scale from .w, covered all 64 samples as expected.

For the negative control I changed 'xyzw'[index % 4] to 'wyzx'[index % 4] in a temporary in-memory copy of tools/sampled_coverage_aot.py. I ran tests/sampled_coverage_check.py <dxc> <offscreen_check.exe> <hardware|warp> from the parent and PR with the same renderer. The parent fixture passed with and without the mutation. The PR fixture caught the mutation twice on each adapter at the .w case: coverage pixel=0 expected=1 actual=0, then Sample coverage mismatch (exit 1). The tracked checkout stayed clean.

AI-assisted. All reported tests ran locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7084097632 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/623#issuecomment-7084097632). Originally posted by [rwZephyr](https://github.com/rwZephyr) on 2026-11-22T19:05:15Z. --- Independent check of the x/w component-swap control on `cd17e1f85ff611633a28ee35c2af6771d8f2a611` and its parent `efecacfca7266cac0623226eb7ca8d40926c3407`. Windows 10 22H2 build `19045.6466`, MSVC `19.44.35230`, Windows SDK `10.0.26100.0`, DXC `1.8.2502.11`, Debug with `/MTd`. D3D12 debug layer unavailable on both adapters. ```powershell cmake --preset dev "-DINTAKE_PYTHON=$((Get-Command python).Source)" "-DDXC_EXECUTABLE=$dxc" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug cmake --build --preset dev --parallel 4 --target offscreen_check $env:XBOX2WINDOWS_ADAPTER = 'RTX 3060 Ti' ctest --preset dev --no-tests=error -V -R '^sampled_coverage_(hardware|warp)$' ``` - **Hardware:** RTX 3060 Ti (`10de:2414`), driver `621.24` (`32.0.16.2124` via DXGI). Clean fixture passed. - **Software:** In-box WARP (`1414:008c`), driver `10.0.19041.5794`. Clean fixture passed. No skips on either adapter. The clean PR checked 64 pixels per draw across all 13 positive draws on each adapter. The final red case, which reads the scale from `.w`, covered all 64 samples as expected. For the negative control I changed `'xyzw'[index % 4]` to `'wyzx'[index % 4]` in a temporary in-memory copy of `tools/sampled_coverage_aot.py`. I ran `tests/sampled_coverage_check.py <dxc> <offscreen_check.exe> <hardware|warp>` from the parent and PR with the same renderer. The parent fixture passed with and without the mutation. The PR fixture caught the mutation twice on each adapter at the `.w` case: `coverage pixel=0 expected=1 actual=0`, then `Sample coverage mismatch` (exit 1). The tracked checkout stayed clean. AI-assisted. All reported tests ran locally.
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!617
No description provided.