shader: lower explicit-LOD 2D gather in direct DXIL #3068
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3068"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-27T13:45:12Z.
Change
Fixes #3066. Refs #1802 and #3065. Lower
image_gather4_lin the direct C++ DXIL frontend for a fixed table-bound 2D SRV. The frontend validates the constant sampler, rounds the clamped LOD, limits it to the SRV's visible mip range and emits four typed loads in guest tap order. The clamp and rounding match the existing startup HLSL path. Nonfinite coordinates or LOD give zero in active destination lanes.The baseline rejected the explicit opcode in both native Pixel and Compute containers. This change is for explicit LOD with a normalized clamp, point-mip sampler. The guest implicit-mip proof remains tracked in #1802.
Verification
Tested
09bdd3082a26d67357147fd2bd656498561371bdon36d2cbebwith Windows 11 build 26300.10075, MSVC 19.52, Windows SDK 10.0.26100 and DXC 1.9.2602.17.10.0.26100.10068and RTX 407032.0.16.2124. Native Compute passed on RTX 4070. Local WARP exposed4..4lanes, so the Compute run requiring wave32 skipped with exit 77. GPU readback ran with the D3D12 debug layer enabled and zero errors or warnings.git diff --checkpassed.Evidence and follow-up
The source-built fixtures check the original four-channel texel pattern against an independent CPU reference, including a view whose resource base mip is 1, a full three-mip view, both sides of the half-mip threshold, sampler clamping, edge coordinates, and nonfinite operands. Four Compute lanes select resource mips 1, 2, 2, 2 in one dispatch. Forcing mip zero made the Pixel readback fail at
(0,0)and changed exactly four words in Compute.Checklist
I used Codex to prepare the change and ran verification locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T15:14:21Z.
Review: APPROVED
Independent review at
09bdd308withmainde1595b9(tree28f16ed40147aba0dc026d31e492e212a13e882e). The path checks the sampler and channel, bounds the LOD by the SRV's visible mip count, and clamps each coordinate before integer conversion. The four loads preserve guest tap order. Nonfinite inputs are masked in active destination lanes.Built
compile_dxil offscreen_check native_recording_check.ctest --test-dir <build> --no-tests=error -j 1 -V -R '^(native_(gather_lod_.+|direct_container|gather_compare_warp)|startup_(compute_gather_l|image_get_lod_view|image_gather_lz)_(warp|hardware))$'gave 12 passes and one capability skip per preset. Native Pixel matched the CPU taps on WARP and RTX, and native Compute matched on RTX. The fixed-mip substitution was detected. The native Compute WARP case returned 77 because the adapter reports four lanes. Windows 11 26200.9974, WARP 10.0.26100.9818, RTX 4060 Laptop driver 32.0.16.1656, SDK 10.0.26100, GPU fixture debug layer enabled. This verifies explicit LOD; #1802 still tracks guest implicit mip selection.