tests: make explicit gradients select the mip above a MinLod floor #2655
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2663"
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 RavenCurseBurg on 2026-11-26T01:09:09Z.
Change
The MinLod smoke test used an explicit gradient covering only a quarter of a texel on the base level and a minimum LOD of 1. A shader that discarded both gradients could still sample the expected green mip.
This adds the complementary case. The X and Y gradients each span two texels on the existing 8×8 texture, so the expected LOD is 1 even with a floor of 0. The same constant UV with implicit derivatives reads red mip 0. The fixture uses its existing mip texture, checks all covered pixels and retains its clear-color check outside the triangle.
Verification
At
17a52445on Windows 11 build 26100.9711 I ranI selected each physical card with
XBOX2WINDOWS_ADAPTER. On all three backends the new case passed. I then replaced every Grad sample in the test with an implicit sample at the same floor. All four previous cases still passed. With the new case, each backend reported the first mismatch at pixel (0,0), channel R, expected0x00000000, actual0x3f800000(red in place of green).The source-built public tools used SPIRV-Tools
262bdab4, patched SPIRV-Cross57e4efcc, DXC 1.9.2609 (-T ps_6_0 -E main) and the offscreen renderer built atc601e6e9. The desktop debug layer was unavailable.Evidence and follow-up
In a separate four-mip experiment I compared the translated
Grad|MinLodinstruction with a direct HLSLSampleGradat 14 clamp/gradient settings per device. All 42 pairs of 8×8 RGBA readbacks matched bit for bit (10,752 channel comparisons). Both paths also matched the independent mip blend within 2/256. That sweep covers constant orthogonal gradients and solid-color mips. The original finite mismatches are still open in #809.Refs #809.
AI-assisted contribution using Codex (GPT-6.2 Astra, xhigh).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T01:16:37Z.
Review: COMMENTED
Review of head
07be2124(after updating with main). Code review only.What I checked:
tests/spirv_window/minlod.spvasm/minlod.py: newgrad-above-clampcase. Gradients of 0.25 on the 8x8 texture span two texels, so the explicit LOD is 1 with a floor of 0. It expects the same exact readback as the other passing cases (64 pixels, max error 0, green mip 1). Theno-clampnegative control is unchanged. This does guard what the title says: a lowering that drops the Grad operands would read red mip 0 and fail the exact readback.%zero,%quarterexist in the fixture; no production code is touched (2 files, 4 lines).implicit,bias,grad) are untouched and still run in the same loop. No other open or merged PR covers this slice.Commands run (Linux):
spirv-as+spirv-val --target-env vulkan1.2on all five generated variants -> all validpython3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py-> passedgit diff --check origin/main...HEAD-> cleanFindings: none blocking.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T01:22:26Z.
Windows WARP check for head
07be2124(after updating with main): not verified here.On Windows Server 2025 (build 26100, D3D12 WARP),
ctest -R minlodran 8 tests in dev and release. All 8 were reported as Skipped (exit 77), includingspirv_minlod_warp. The test skips when the SPIRV-Cross build on the machine lacks MinLod support (tools/setup-spirv-tools.ps1not applied), so the newgrad-above-clampdraw readback did not execute on our side.git diff --checkpass.AI-assisted; commands listed were executed locally.