shader: verify derivative-selected gather across a mip view #3065

Merged
RonLogic merged 1 commit from upstream-pr/3065 into main 2026-11-27 15:07:31 +00:00
RonLogic commented 2026-11-27 13:28:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-27T13:28:33Z.


Change

Refs #1802. Add the requested differential on an 8×8 texture with a two-level SRV starting at resource mip 1. A synthetic pixel stage routes the existing image_get_lod result into image_gather4_l. With UV fixed at (9/16, 9/16) at the readback pixel, UV steps 1/4 and 1/2 select view-relative mips 0 and 1.

Each draw checks four distinct taps against the CPU texel pattern and a separate image_gather4_lz draw on a single-level view of the expected resource mip. Binding the full two-level view to that same fixed-mip gather is the negative control. It disagrees at all four taps when the second visible mip is expected.

Verification

Tested d8f569a8e1b27167f39483db274bf1e42cf41d6b based on db28a796; trial-merged cleanly with ff04a75e. Windows 11 build 26300.10075, MSVC 19.52, Windows SDK 10.0.26100 and DXC 1.9.2602.17.

$env:XBOX2WINDOWS_ADAPTER = 'RTX 4070'
$tests = '^startup_(gather_implicit_mip_(warp|hardware)|image_get_lod_(view|array_view)_(warp|hardware)|image_gather_lz(_(warp|hardware))?|compute_gather_l_(warp|hardware))$'
foreach ($preset in 'release', 'dev') {
    cmake --build --preset $preset --target offscreen_check
    ctest --preset $preset --no-tests=error -j 1 -R $tests -V
}
  • Release 9/9, Debug 9/9, no skips. Both WARP 10.0.26100.10068 and RTX 4070 32.0.16.2124 matched [146,147,139,138]/512 for resource mip 1 and [265,266,258,257]/512 for mip 2. The D3D12 debug layer reported zero errors and warnings.
  • Docs links, bidi controls and git diff --check passed.

Evidence and follow-up

The fixture uses synthetic guest words and the existing D3D12 mip-view renderer. This demonstrates a desktop equivalent for the two exact, integer-mip cases. Guest image_gather4 still requires independent RDNA evidence for its mip choice and remains refused. Fractional thresholds are outside the fixture.

Checklist

  • One reviewable behavior.
  • Test commands, results and capability limits recorded.
  • GPU wrong-mip control checked.
  • Experiment notes updated.
  • Diff checked for game files, dumps, distribution links and secrets.

I used Codex to prepare the change and ran verification locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5527446080 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3065). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-27T13:28:33Z. --- ## Change Refs #1802. Add the requested differential on an 8×8 texture with a two-level SRV starting at resource mip 1. A synthetic pixel stage routes the existing `image_get_lod` result into `image_gather4_l`. With UV fixed at `(9/16, 9/16)` at the readback pixel, UV steps `1/4` and `1/2` select view-relative mips 0 and 1. Each draw checks four distinct taps against the CPU texel pattern and a separate `image_gather4_lz` draw on a single-level view of the expected resource mip. Binding the full two-level view to that same fixed-mip gather is the negative control. It disagrees at all four taps when the second visible mip is expected. ## Verification Tested `d8f569a8e1b27167f39483db274bf1e42cf41d6b` based on `db28a796`; trial-merged cleanly with `ff04a75e`. Windows 11 build 26300.10075, MSVC 19.52, Windows SDK 10.0.26100 and DXC 1.9.2602.17. ```powershell $env:XBOX2WINDOWS_ADAPTER = 'RTX 4070' $tests = '^startup_(gather_implicit_mip_(warp|hardware)|image_get_lod_(view|array_view)_(warp|hardware)|image_gather_lz(_(warp|hardware))?|compute_gather_l_(warp|hardware))$' foreach ($preset in 'release', 'dev') { cmake --build --preset $preset --target offscreen_check ctest --preset $preset --no-tests=error -j 1 -R $tests -V } ``` - **Release 9/9, Debug 9/9**, no skips. Both WARP `10.0.26100.10068` and RTX 4070 `32.0.16.2124` matched `[146,147,139,138]/512` for resource mip 1 and `[265,266,258,257]/512` for mip 2. The D3D12 debug layer reported zero errors and warnings. - Docs links, bidi controls and `git diff --check` passed. ## Evidence and follow-up The fixture uses synthetic guest words and the existing D3D12 mip-view renderer. This demonstrates a desktop equivalent for the two exact, integer-mip cases. Guest `image_gather4` still requires independent RDNA evidence for its mip choice and remains refused. Fractional thresholds are outside the fixture. ## Checklist - [x] One reviewable behavior. - [x] Test commands, results and capability limits recorded. - [x] GPU wrong-mip control checked. - [x] Experiment notes updated. - [x] Diff checked for game files, dumps, distribution links and secrets. I used Codex to prepare the change and ran verification locally.
R0Y00 commented 2026-11-27 15:07:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T15:07:19Z.

Review: APPROVED


Independent review at d8f569a8 with main ca659396 (tree bce7c5fae7a9c30f64ad1a657bd45a3ffd2ab73e). The test-only changes keep the two visible mips distinct and compare the selected level to both the CPU tap order and a one-level SRV. The first-visible negative control differs in all four taps when resource mip 2 is required.

Built offscreen_check, then ran ctest --test-dir <build> --no-tests=error -j 1 -V -R '^startup_(gather_implicit_mip_(warp|hardware)|image_get_lod_(view|array_view)_(warp|hardware)|image_gather_lz(_(warp|hardware))?|compute_gather_l_(warp|hardware))$'. Debug and Release /O2 each passed 9/9 with zero skips. Both adapters matched [146,147,139,138]/512 and [265,266,258,257]/512 in the two cases. Windows 11 26200.9974, WARP 10.0.26100.9818, RTX 4060 Laptop driver 32.0.16.1656, SDK 10.0.26100, D3D12 debug layer enabled. #1802 still tracks guest RDNA mip selection.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6090116629 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3065#pullrequestreview-6090116629). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T15:07:19Z. **Review:** APPROVED --- Independent review at `d8f569a8` with `main` `ca659396` (tree `bce7c5fae7a9c30f64ad1a657bd45a3ffd2ab73e`). The test-only changes keep the two visible mips distinct and compare the selected level to both the CPU tap order and a one-level SRV. The first-visible negative control differs in all four taps when resource mip 2 is required. Built `offscreen_check`, then ran `ctest --test-dir <build> --no-tests=error -j 1 -V -R '^startup_(gather_implicit_mip_(warp|hardware)|image_get_lod_(view|array_view)_(warp|hardware)|image_gather_lz(_(warp|hardware))?|compute_gather_l_(warp|hardware))$'`. Debug and Release `/O2` each passed 9/9 with zero skips. Both adapters matched `[146,147,139,138]/512` and `[265,266,258,257]/512` in the two cases. Windows 11 26200.9974, WARP 10.0.26100.9818, RTX 4060 Laptop driver 32.0.16.1656, SDK 10.0.26100, D3D12 debug layer enabled. #1802 still tracks guest RDNA mip selection.
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!3065
No description provided.