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

Manually merged
github merged 1 commit from github-bot/gh-3065 into gh-pr/3065/base 2026-11-27 15:09:29 +00:00 AGit
Owner

@⁠RonLogic on GitHub · 2026-11-27 13:28 UTC · original
RonLogic:test/gather-implicit-mip-selection → main · +151 −16 · 7 files · 1 commits · merged 2026-11-27 15:07 UTC

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.

**@⁠RonLogic** on GitHub · 2026-11-27 13:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3065) `RonLogic:test/gather-implicit-mip-selection` → `main` · +151 −16 · 7 files · 1 commits · merged 2026-11-27 15:07 UTC ## 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 13:32:51 +00:00
github-bot changed target branch from main to gh-pr/3065/base 2026-11-27 15:09:28 +00:00
github manually merged commit d8f569a8e1 into gh-pr/3065/base 2026-11-27 15:09:29 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-27 15:07 UTC · original · approved these changes

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.

**@⁠R0Y00** on GitHub · 2026-11-27 15:07 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3065#pullrequestreview-6090116629) · **approved these changes** 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.