tests: check fractional MinLod one step below both observed mip transitions #2404

Merged
RavenCurseBurg merged 1 commit from upstream-pr/2412 into main 2026-11-25 17:24:26 +00:00
RavenCurseBurg commented 2026-11-25 15:45:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T15:45:21Z.


Refs #809. The four fractional point-filter inputs were all exact multiples of 1/128. A translated shader could round every clamp to the nearest 1/128 and still pass the existing fixture on Intel, NVIDIA and WARP.

I swept a synthetic four-mip texture across [1, 2] with the translated SPIR-V shader and its direct HLSL control, first in steps of 1/16, then in steps of 1/256 around each observed transition. Both shaders matched the selected mip over all 64 pixels at every sampled clamp. Runnable measurement.

Adapter Last sampled clamp selecting mip 1 First sampled clamp selecting mip 2
Intel UHD Graphics 770, 32.0.101.5973 1.99609375 2
NVIDIA RTX 4060, 32.0.15.9579 1.49609375 1.5
In-box WARP, 10.0.26100.9711 1.49609375 1.5

The regression fixture adds the two lower endpoints and the exact clamp 2. For the two fractional cases it requires complete, identical mip readbacks from the translated shader and direct control; the existing optional strict mode checks nearest-mip selection. The normal test succeeded on all three adapters. Rounding only the translated constant to 1/128 before assembling the shader made the new fixture fail at 1.99609375 on Intel and 1.49609375 on WARP and RTX. In each case the translated shader read mip 2 while the control read mip 1. The original four-input fixture passed that same mutation on all three devices.

Local runs used Windows 11 24H2 build 26100.9711, DXC 1.9.2609.5 (-T ps_6_6 -E main), project-pinned SPIRV-Tools and patched SPIRV-Cross. The local debug layer was unavailable. The exact and mip-linear entry also passed on all three adapters. Strict fractional rounding passed on RTX/WARP and reproduced the documented 1.5625 failure on Intel. The wrong-mip-0 control failed at pixel (0, 0), channel 0, on each adapter. Documentation links and the bidirectional-control check passed.

cmake --build --preset dev --target offscreen_check
ctest --preset dev --no-tests=error -V -R '^spirv_minlod_fractional_(hardware|warp)$'

Hosted Windows Server 2025 WARP used the debug layer, WARP 10.0.26100.33648 and DXC 1.9.2602.17. The stock draw passed, the previous fixture accepted the rounded shader, and the new fixture rejected it at 1.49609375.

AI assistance: Codex + GPT-6.2 Astra (xhigh).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6608259376 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2412). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T15:45:21Z. --- Refs #809. The four fractional point-filter inputs were all exact multiples of 1/128. A translated shader could round every clamp to the nearest 1/128 and still pass the existing fixture on Intel, NVIDIA and WARP. I swept a synthetic four-mip texture across [1, 2] with the translated SPIR-V shader and its direct HLSL control, first in steps of 1/16, then in steps of 1/256 around each observed transition. Both shaders matched the selected mip over all 64 pixels at every sampled clamp. [Runnable measurement](https://github.com/RavenCurseBurg/Xbox2Windows/blob/cff4c5746d01329c90233824c64393b64ca4d6bd/tests/measure_minlod_point_boundary.py). | Adapter | Last sampled clamp selecting mip 1 | First sampled clamp selecting mip 2 | | --- | ---: | ---: | | Intel UHD Graphics 770, 32.0.101.5973 | 1.99609375 | 2 | | NVIDIA RTX 4060, 32.0.15.9579 | 1.49609375 | 1.5 | | In-box WARP, 10.0.26100.9711 | 1.49609375 | 1.5 | The regression fixture adds the two lower endpoints and the exact clamp 2. For the two fractional cases it requires complete, identical mip readbacks from the translated shader and direct control; the existing optional strict mode checks nearest-mip selection. The normal test succeeded on all three adapters. Rounding **only the translated constant** to 1/128 before assembling the shader made the new fixture fail at 1.99609375 on Intel and 1.49609375 on WARP and RTX. In each case the translated shader read mip 2 while the control read mip 1. The original four-input fixture passed that same mutation on all three devices. Local runs used Windows 11 24H2 build 26100.9711, DXC 1.9.2609.5 (`-T ps_6_6 -E main`), project-pinned SPIRV-Tools and patched SPIRV-Cross. The local debug layer was unavailable. The exact and mip-linear entry also passed on all three adapters. Strict fractional rounding passed on RTX/WARP and reproduced the documented 1.5625 failure on Intel. The wrong-mip-0 control failed at pixel (0, 0), channel 0, on each adapter. Documentation links and the bidirectional-control check passed. ```powershell cmake --build --preset dev --target offscreen_check ctest --preset dev --no-tests=error -V -R '^spirv_minlod_fractional_(hardware|warp)$' ``` [Hosted Windows Server 2025 WARP](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45648415606) used the debug layer, WARP 10.0.26100.33648 and DXC 1.9.2602.17. The stock draw passed, the previous fixture accepted the rounded shader, and the new fixture rejected it at 1.49609375. AI assistance: Codex + GPT-6.2 Astra (xhigh).
tedin7 commented 2026-11-25 17:01:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T16:08:07Z.

Review: COMMENTED


Review of head 3d1b95c3 (test-only: tests/spirv_window/minlod_levels.py, docs/experiments.md).

What I checked:

  • FRACTIONAL has one consumer (minlod_levels.py:68); the added clamps (1.49609375, 1.99609375, 2) are covered by the same loop, and the wrong-mip control is unchanged.
  • The new inputs are not multiples of 1/128, so a translator that rounds the clamp to 1/128 now fails (the PR reports exactly that on three adapters). That is a real guard, not a string check: it is a D3D12 readback against the direct HLSL control.
  • Accepted mips match the documented transitions: (1, 2) one step below 1.5, (2, 1) below 2, exactly 2 at 2.
  • Scope: two files, additive, no CI/launcher/hook changes. No open or merged PR covers the same clamps (searched MinLod; earlier merged PRs added the 4-input fixture and adapter notes only).
  • The docs text matches the new table.

No blocking findings. Next: update with main, CI, Win2025 WARP dev+release.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6060942165 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2412#pullrequestreview-6060942165). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T16:08:07Z. **Review:** COMMENTED --- Review of head 3d1b95c3 (test-only: `tests/spirv_window/minlod_levels.py`, `docs/experiments.md`). What I checked: - `FRACTIONAL` has one consumer (`minlod_levels.py:68`); the added clamps (1.49609375, 1.99609375, 2) are covered by the same loop, and the wrong-mip control is unchanged. - The new inputs are not multiples of 1/128, so a translator that rounds the clamp to 1/128 now fails (the PR reports exactly that on three adapters). That is a real guard, not a string check: it is a D3D12 readback against the direct HLSL control. - Accepted mips match the documented transitions: (1, 2) one step below 1.5, (2, 1) below 2, exactly 2 at 2. - Scope: two files, additive, no CI/launcher/hook changes. No open or merged PR covers the same clamps (searched MinLod; earlier merged PRs added the 4-input fixture and adapter notes only). - The docs text matches the new table. No blocking findings. Next: update with main, CI, Win2025 WARP dev+release. AI-assisted; commands listed were executed locally.
KelboLive commented 2026-11-25 17:01:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-25T16:06:09Z.


APPROVED. Tests fractional MinLod below mip transitions.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7167595166 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2412#issuecomment-7167595166). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-25T16:06:09Z. --- APPROVED. Tests fractional MinLod below mip transitions.
tedin7 commented 2026-11-25 17:01:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T16:16:14Z.


Win2025 WARP receipt for head 3d1b95c3 after updating with main.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 3d1b95c315c3a0941065ed9493d7147b6910e691:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev -- -j 2): 158.52s (configure 1.65s)
    • Test (ctest --preset dev -R 'spirv_minlod_(fractional|levels)_warp' --parallel 6 --no-tests=error --output-on-failure): 2/2 passed (2.62s: spirv_minlod_fractional_warp 1.49s, spirv_minlod_levels_warp 2.52s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release -- -j 2): 175.49s (configure 1.67s)
    • Test (ctest --preset release -R 'spirv_minlod_(fractional|levels)_warp' --parallel 6 --no-tests=error --output-on-failure): 2/2 passed (2.23s: spirv_minlod_fractional_warp 1.18s, spirv_minlod_levels_warp 2.14s)
  • sccache: 1234/1310 hits; wall 346.9s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7167740974 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2412#issuecomment-7167740974). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T16:16:14Z. --- Win2025 WARP receipt for head 3d1b95c3 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `3d1b95c315c3a0941065ed9493d7147b6910e691`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev -- -j 2`): `158.52s` (configure `1.65s`) - Test (`ctest --preset dev -R 'spirv_minlod_(fractional|levels)_warp' --parallel 6 --no-tests=error --output-on-failure`): **2/2 passed** (`2.62s`: `spirv_minlod_fractional_warp` `1.49s`, `spirv_minlod_levels_warp` `2.52s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release -- -j 2`): `175.49s` (configure `1.67s`) - Test (`ctest --preset release -R 'spirv_minlod_(fractional|levels)_warp' --parallel 6 --no-tests=error --output-on-failure`): **2/2 passed** (`2.23s`: `spirv_minlod_fractional_warp` `1.18s`, `spirv_minlod_levels_warp` `2.14s`) - `sccache`: 1234/1310 hits; wall `346.9s` AI-assisted; commands listed were executed locally.
RavenCurseBurg commented 2026-11-25 17:01:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T16:21:54Z.


@tedin7 I checked the reviewed head 3d1b95c3 against upstream main at 7092683a. It contains that main commit, and all three upstream CI jobs passed.

I rebuilt offscreen_check from this exact head using the stock dev (Debug) and release presets on Windows Server 2025. The fractional WARP fixture passed in both builds with the D3D12 debug layer enabled. The translated and direct HLSL draws selected mip 1 at 1.49609375, mip 2 at 1.99609375, and mip 2 at 2. Both wrong-mip-0 controls failed at pixel (0,0) as expected.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7167853806 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2412#issuecomment-7167853806). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T16:21:54Z. --- @tedin7 I checked the reviewed head `3d1b95c3` against upstream `main` at `7092683a`. It contains that main commit, and all three upstream CI jobs passed. I rebuilt `offscreen_check` from this exact head using the stock [dev (Debug)](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45652416347/job/139340127213) and [release](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45652416347/job/139340127346) presets on Windows Server 2025. The fractional WARP fixture passed in both builds with the D3D12 debug layer enabled. The translated and direct HLSL draws selected mip 1 at 1.49609375, mip 2 at 1.99609375, and mip 2 at 2. Both wrong-mip-0 controls failed at pixel (0,0) as expected.
upstream-sync closed this pull request 2026-11-25 18:01:01 +00:00
MasterDomino commented 2026-11-25 18:01:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-25T17:24:22Z.

Review: APPROVED


Approved at head 3d1b95c3. The change is test-only: tests/spirv_window/minlod_levels.py and docs/experiments.md. This adds an AMD adapter and a local run of the 1/128-rounding mutant to @tedin7's review and WARP receipt.

Environment

  • Windows 11 build 26300, --preset dev, offscreen_check built at 3d1b95c3.
  • The pinned SPIR-V tools from tools/setup-spirv-tools.ps1, and DXC from SDK 10.0.26100.

Normal run

ctest --preset dev --no-tests=error -V -R '^spirv_minlod'
  • All 8 pass on AMD and WARP: spirv_minlod, _exact, _levels and _fractional, each on hardware (AMD Radeon RX 9070 XT, 1002:7550, driver 32.0.32029.2010) and on warp. There were no skips.
  • AMD's fractional point-filter selection: the translated shader and the HLSL control agree at every clamp. They give 1.4375→1, 1.49609375→1, 1.5→2, 1.5625→2, 1.99609375→2, 2→2 and 3.75→3. So the RX 9070 XT switches at 1.5, like the RTX 4060 and WARP in the description's table, and unlike the UHD 770.
  • Negative controls: all report their expected pixel mismatches. These are the wrong mip 0 at 1.5625, the mip 2 at clamp 1, and the blend at 1.25 against 1.5.

Negative control (the description's mutant)

I rounded only the translated SPIR-V constant to 1/128 (%clamp = OpConstant %float {round(float(clamp) * 128) / 128}) and left the HLSL control unchanged:

  • spirv_minlod_fractional_hardware (RX 9070 XT) and _warp both fail with Clamp 1.49609375 read mip 2 translated, mip 1 in the HLSL control.
  • After reverting, both pass.
  • On main's clamp list the mutant is a no-op, because 1.4375, 1.5, 1.5625 and 3.75 are exact multiples of 1/128. That is the gap this PR closes.

Merge checks: the branch merges cleanly with current main. Required CI passed at this head. The /O2 and coverage skips come from explicit workflow conditions. There are no review threads.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6062012796 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2412#pullrequestreview-6062012796). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-25T17:24:22Z. **Review:** APPROVED --- Approved at head `3d1b95c3`. The change is test-only: `tests/spirv_window/minlod_levels.py` and `docs/experiments.md`. This adds an AMD adapter and a local run of the 1/128-rounding mutant to @tedin7's review and WARP receipt. ### Environment - Windows 11 build 26300, `--preset dev`, `offscreen_check` built at `3d1b95c3`. - The pinned SPIR-V tools from `tools/setup-spirv-tools.ps1`, and DXC from SDK 10.0.26100. ### Normal run ```powershell ctest --preset dev --no-tests=error -V -R '^spirv_minlod' ``` - **All 8 pass on AMD and WARP:** `spirv_minlod`, `_exact`, `_levels` and `_fractional`, each on `hardware` (**AMD Radeon RX 9070 XT**, 1002:7550, driver 32.0.32029.2010) and on `warp`. There were no skips. - **AMD's fractional point-filter selection:** the translated shader and the HLSL control agree at every clamp. They give `1.4375→1`, `1.49609375→1`, `1.5→2`, `1.5625→2`, `1.99609375→2`, `2→2` and `3.75→3`. So the RX 9070 XT switches at 1.5, like the RTX 4060 and WARP in the description's table, and unlike the UHD 770. - **Negative controls:** all report their expected pixel mismatches. These are the wrong mip 0 at 1.5625, the mip 2 at clamp 1, and the blend at 1.25 against 1.5. ### Negative control (the description's mutant) I rounded only the translated SPIR-V constant to 1/128 (`%clamp = OpConstant %float {round(float(clamp) * 128) / 128}`) and left the HLSL control unchanged: - **`spirv_minlod_fractional_hardware` (RX 9070 XT) and `_warp` both fail** with `Clamp 1.49609375 read mip 2 translated, mip 1 in the HLSL control`. - **After reverting,** both pass. - **On `main`'s clamp list the mutant is a no-op,** because 1.4375, 1.5, 1.5625 and 3.75 are exact multiples of 1/128. That is the gap this PR closes. Merge checks: the branch merges cleanly with current `main`. Required CI passed at this head. The `/O2` and coverage skips come from explicit workflow conditions. There are no review threads. AI-assisted; commands listed were executed 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!2404
No description provided.