shader: measure MinLod mip selection and blending against an HLSL control #810
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/816"
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 lukaslw-lab on 2026-11-23T07:40:25Z.
Change
Adds
spirv_minlod_levels_{hardware,warp}for the plainSample+MinLodform claimed in #809. It builds on #804's fixture. The texture has four solid-color mips and the coordinate is constant, so the LOD equals the clamp. Each clamp runs as the translated SPIR-V shader and as a direct HLSL control (tests/spirv_window/minlod_control.hlsl) on the same adapter.MIN_MAG_POINT_MIP_LINEAR: nine clamps from 1 to 3.75 must match the exact mip blend within 1/128. The translated and control bits must be identical on each adapter.Shared test code touched:
tests/pixel_aot_vs.hlslis also built with-D PIXEL_MIP_LINEAR=1, which gives a root signature with a mip-linear static sampler.PixelInputgainslinearMipsandtolerance. Existing checks keep the bit-exact default.max_absolute_error=now prints the measured value, which stays 0 for exact checks.--check-pixel-mip-clampand--check-pixel-mip-blend.spirv_minlod_*through a new--spirv-minlod-quad-lodoperation, check for Shader Model 6.6 before creating the pipeline, as #763 did for the ballot fixture. On a runtime capped at SM 6.5 they used to fail atps_6_6pipeline creation; they now skip (77). The shared--check-pixel-quad-lodstays ungated forpixel_aot_check.py.spirv_minlod_levels_warpis added torequire_warp_results.py.Refs #809
Verification
Windows 10 22H2 (build 19045), Visual Studio 2026 18.12 (MSVC 19.52), Windows SDK 10.0.26100, CMake 4.3.1, Python 3.13.7, DXC 1.9.2609, Agility SDK 1.620.2, WARP 1.0.22. GPU: NVIDIA GeForce RTX 3080 Ti, driver 32.0.16.1047. Debug layer on.
At
af94238(rebased ond2ac415),w10build (dev preset plus the app-local Agility SDK and WARP):Before the rebase, the same change on
66669bbpassed the shader area in thedevbuild (^pixel_aot_|dxil_retarget|shader_|rdna2_tools|ffx_dispatch|rcas|pso_readiness|effect_candidates): 69 total, 69 passed.The full local suite at
af94238is still running; I'll post its result as a comment.At
a5176cc(the SM 6.6 gate), in bothdev(Windows 10 in-box runtime, SM 6.5) andw10:Measured blends (first pixel, green and blue channels; all 64 pixels matched within the tolerance):
First difference between the adapters: pixel (0, 0), channels 1 and 2 (green, blue), plus channel 0 at clamp 2.5, which blends blue and yellow. Alpha was 1 on both adapters. The adapters differed at clamps 1.25, 1.3, 1.5, 1.75, 1.00390625 and 2.5, and were identical at 1, 1.001953125 and 3.75. With point filtering they did not differ.
Classification: every difference was a finite value. No pixel kept the clear value (-1), no run timed out, and nothing was skipped on the Agility SDK runtime. The Windows 10 in-box runtime skips (77) at Shader Model 6.6.
Tools and flags, as run by
tests/spirv_window/minlod_levels.py:262bdab(v2025.5), SPIRV-Headersb824a46, SPIRV-Cross57e4efcwithtools/patches/spirv-cross-minlod.patch, all fromtools/setup-spirv-tools.ps1.spirv-as --target-env vulkan1.2,spirv-val --target-env vulkan1.2spirv-cross --hlsl --shader-model 66dxc -T ps_6_6 -E mainfor the translated HLSL;dxc -T ps_6_6 -E main -DCLAMP=<clamp>forminlod_control.hlsloffscreen_check <adapter> --check-pixel-mip-clamp <dxil> <mip>and--check-pixel-mip-blend <dxil> <clamp> 0.0078125Evidence and follow-up
Source-built inputs only. The texture is generated in
check_pixel_mip_clamp, and the shaders are the existing MITminlod.spvasmtemplate and a new 8-line HLSL control.Negative controls: a clamp of 1 checked against mip 2, and a 1.25 clamp checked against the 1.5 blend. Both must fail at pixel (0, 0), and both do on both adapters.
Confirmed in this fixture:
Not established:
Sampleonly, R8G8B8A8_UNORM, constant coordinates, point filtering within a mip.Follow-up others can pick up: other adapters (AMD, Intel), and the
SampleBias,SampleGradandSampleCmpforms with the same operations.Checklist
AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-23T08:05:05Z.
Full local suite at
af94238,devbuild (Windows 10 in-box runtime, SM 6.5; in-box WARP 10.0.19041.7811): 387 total, 337 passed, 44 skipped, 6 failed.spirv_minlod_{hardware,warp}andspirv_minlod_levels_{hardware,warp}failed atps_6_6pipeline creation instead of skipping. Fixed ina5176cc: at that commit all four skip with "skip: MinLod fixture requires SM 6.6".gpu_alias_lookup_writes_warp: known in-box WARP failure (#332).pixel_aot_title_loads_warp: fails the same way ond2ac415without this PR, on the in-box WARP only. It passes on WARP 1.0.22 and the RTX 3080 Ti.