test: isolate the quad axis in the compute LOD replay #3301

Manually merged
github merged 1 commit from github-bot/gh-3299 into gh-pr/3299/base 2026-11-28 06:28:07 +00:00 AGit
Owner

@⁠RonLogic on GitHub · 2026-11-28 06:15 UTC · original
RonLogic:test/implicit-lod-quad-ramp → main · +20 −7 · 2 files · 1 commits · merged 2026-11-28 06:23 UTC

Change

Refs #3257 and the RX 9060 XT readback in #3243.

The multidimensional Compute replay uses a trilinear sampler. Its original ramp produced horizontal and vertical derivatives of 0.5 and 1 texel along the same texture axis, while the reference required an exact mip-0 value. The revised ramp is constant within each horizontal pair. It places consecutive quads at a 0.75-texel vertical footprint and spatial 2D quads at three texels. This leaves room below the mip transition and keeps the layout difference visible in the readback.

The compile controls also inspect DXIL NumThreads. The implicit shader must use flattened dimensions and the explicit-LOD shader must retain the requested shape. Production shader lowering and runtime bindings are unchanged.

Verification

1936f7ac on 6a1968a1. Windows 11 build 26300.10075, DXC 1.9.2602.17, Agility 1.620.2. RTX 4070 driver 32.0.16.2124 and app-local WARP 1.0.22. Both adapters had the D3D12 debug layer enabled.

cmake --build out/build/release-agility --target offscreen_check compile_dxil
ctest --test-dir out/build/release-agility --no-tests=error -R '^(native_compute_implicit_lod_.*|native_direct_container|shader_wave32_(hardware|warp))$' -V

All six checks passed, with zero skips. The independent source-built HLSL control read ddx=0 and ddy=0.75 texels for all 32 flattened threads on both adapters, and all 320 output and guard words matched. With an actual 8x4x1 spatial dispatch, it read ddy=3 and the mip-0 oracle rejected all 32 sample words. The first mismatch was 0x3f800000 expected versus 0x40560000 on RTX and 0x404b0000 on WARP. The metadata check independently rejected the unflattened 8x4x1 module when substituted for the flattened shader.

Evidence and follow-up

The RX 9060 XT report remains to be rerun with this ramp. Its original 0x3f948000 word is consistent with a fractional trilinear blend, so it leaves both the LOD calculation and the lane-order hypothesis open. The changed programs are generated by the existing synthetic fixture. I used Codex to prepare the change and ran verification locally.

**@⁠RonLogic** on GitHub · 2026-11-28 06:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3299) `RonLogic:test/implicit-lod-quad-ramp` → `main` · +20 −7 · 2 files · 1 commits · merged 2026-11-28 06:23 UTC ## Change Refs #3257 and the [RX 9060 XT readback in #3243](https://git.gtahub.st/github/R0Y00--Xbox2Windows/pulls/3243). The multidimensional Compute replay uses a trilinear sampler. Its original ramp produced horizontal and vertical derivatives of 0.5 and 1 texel along the same texture axis, while the reference required an exact mip-0 value. The revised ramp is constant within each horizontal pair. It places consecutive quads at a 0.75-texel vertical footprint and spatial 2D quads at three texels. This leaves room below the mip transition and keeps the layout difference visible in the readback. The compile controls also inspect DXIL `NumThreads`. The implicit shader must use flattened dimensions and the explicit-LOD shader must retain the requested shape. Production shader lowering and runtime bindings are unchanged. ## Verification `1936f7ac` on `6a1968a1`. Windows 11 build 26300.10075, DXC 1.9.2602.17, Agility 1.620.2. RTX 4070 driver 32.0.16.2124 and app-local WARP 1.0.22. Both adapters had the D3D12 debug layer enabled. ```powershell cmake --build out/build/release-agility --target offscreen_check compile_dxil ctest --test-dir out/build/release-agility --no-tests=error -R '^(native_compute_implicit_lod_.*|native_direct_container|shader_wave32_(hardware|warp))$' -V ``` All six checks passed, with zero skips. The independent source-built HLSL control read `ddx=0` and `ddy=0.75` texels for all 32 flattened threads on both adapters, and all 320 output and guard words matched. With an actual `8x4x1` spatial dispatch, it read `ddy=3` and the mip-0 oracle rejected all 32 sample words. The first mismatch was `0x3f800000` expected versus `0x40560000` on RTX and `0x404b0000` on WARP. The metadata check independently rejected the unflattened `8x4x1` module when substituted for the flattened shader. ## Evidence and follow-up The RX 9060 XT report remains to be rerun with this ramp. Its original `0x3f948000` word is consistent with a fractional trilinear blend, so it leaves both the LOD calculation and the lane-order hypothesis open. The changed programs are generated by the existing synthetic fixture. I used Codex to prepare the change and ran verification locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 06:21:25 +00:00
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-28 06:18 UTC · original

Thanks, this fixes a flaw in the #3257 fixture that I missed. The original ramp, V = (index & 15) / 16 on the 8-texel-tall base, gave the consecutive quad 0.5 texel in ddx and 1 texel in ddy, both along the same texture axis. Under max() that is LOD 0, right at the trilinear boundary. The RX 9060 XT word 0x3f948000 is 1 + 41/256. That is consistent with LOD log2(hypot(0.5, 1)) = 0.161 under trilinear filtering, which would blend in mip 1. I have not verified that on that card.

I checked the new ramp by reading the diff (not run). V = (index & 14) * 3 / (8 * HEIGHT) gives:

  • zero ddx, since lane pairs share a value. That removes the dependence on how the two derivatives are combined;
  • 0.75 texel in ddy for consecutive quads (LOD about -0.42, mip 0, with margin);
  • 3 texels for spatial 2D quads (LOD about 1.58).

The & 14 wrap falls between quads, never inside one. So the wrong quad layout stays observable, and the expected sample stays clear of the mip transition. The NumThreads check on both shaders also pins the flattening directly, independent of the driver.

AI-assisted.

**@⁠Leyukaka** on GitHub · 2026-11-28 06:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3299#issuecomment-7235209181) Thanks, this fixes a flaw in the #3257 fixture that I missed. The original ramp, `V = (index & 15) / 16` on the 8-texel-tall base, gave the consecutive quad 0.5 texel in ddx and 1 texel in ddy, both along the same texture axis. Under `max()` that is LOD 0, right at the trilinear boundary. The RX 9060 XT word `0x3f948000` is 1 + 41/256. That is consistent with LOD log2(hypot(0.5, 1)) = 0.161 under trilinear filtering, which would blend in mip 1. I have not verified that on that card. I checked the new ramp by reading the diff (not run). `V = (index & 14) * 3 / (8 * HEIGHT)` gives: - zero ddx, since lane pairs share a value. That removes the dependence on how the two derivatives are combined; - 0.75 texel in ddy for consecutive quads (LOD about -0.42, mip 0, with margin); - 3 texels for spatial 2D quads (LOD about 1.58). The `& 14` wrap falls between quads, never inside one. So the wrong quad layout stays observable, and the expected sample stays clear of the mip transition. The `NumThreads` check on both shaders also pins the flattening directly, independent of the driver. AI-assisted.
github-bot changed target branch from main to gh-pr/3299/base 2026-11-28 06:28:05 +00:00
github manually merged commit 1936f7ac54 into gh-pr/3299/base 2026-11-28 06:28:07 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-28 06:23 UTC · original · approved these changes

Independent Release check on 1936f7ac: ctest --preset release --no-tests=error --output-on-failure -j 1 -R '^(native_compute_implicit_lod_.*|native_direct_container|shader_wave32_(hardware|warp))$' reported four passes and two capability skips. The RTX 4060 Laptop hardware replay and DXIL dimensions controls passed on Windows 11 build 26200/DXC 10.0.26100; inbox WARP 10.0.26100.9818 skipped the two wave32 cases. The revised ramp holds the coordinate constant across horizontal pairs and still distinguishes spatial ordering. The diff is confined to fixture and documentation. The RX 9060 XT follow-up remains open.

**@⁠R0Y00** on GitHub · 2026-11-28 06:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3299#pullrequestreview-6096258143) · **approved these changes** Independent Release check on `1936f7ac`: `ctest --preset release --no-tests=error --output-on-failure -j 1 -R '^(native_compute_implicit_lod_.*|native_direct_container|shader_wave32_(hardware|warp))$'` reported four passes and two capability skips. The RTX 4060 Laptop hardware replay and DXIL dimensions controls passed on Windows 11 build 26200/DXC 10.0.26100; inbox WARP 10.0.26100.9818 skipped the two wave32 cases. The revised ramp holds the coordinate constant across horizontal pairs and still distinguishes spatial ordering. The diff is confined to fixture and documentation. The RX 9060 XT follow-up remains open.
This discussion has been locked. Commenting is limited to contributors.
No description provided.