startup: keep the sampler LOD fixture inside MinLOD <= MaxLOD #2290
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2298"
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 roansystemlabs on 2026-11-25T10:45:01Z.
Refs #2221.
Change
Follow-up to the review of #2287, which was already merged. The docs line "(
MIN_LOD2,MAX_LOD1)" read as one heap entry with an inverted pair. The draw actually uses two valid entries:MIN_LOD2 withMAX_LOD4095/256, andMIN_LOD0 withMAX_LOD1. So noMinLOD > MaxLODsampler reached D3D12 instartup_sampler_lod_{warp,hardware}. This PR makes that explicit and enforced:tests/startup_sampler_lod.cpp: the draw refuses a fixture entry whose decodedMinLODis aboveMaxLOD, and the header comment names both pairs.tests/startup_translated_sampler_bindings_check.cpp: "lod fractions" uses a valid pair (1.25/1.75). The inverted pair (1.75/1.25) is now its own named, device-free case, "min lod above max lod". It checks that the decoder passes such title words through unchanged.docs/startup-runtime.md: names both pairs and says that an inverted pair is passed through unchanged. It also notes that D3D12 documentsMaxLOD >= MinLODand that the console behaviour for that case is not established here. The line wrap is fixed.No clamp is added to the decoder. The RDNA 2 ISA (§8.2.7, table 46) defines
MIN_LODandMAX_LODbut not what the sampler does when min > max, so a clamp would pick a behaviour without a source.Verification
On
476e5bc4(base25317c63), Windows 11, presetdev, D3D12 debug layer on, WARP and an RTX 3070:ctest --preset dev --no-tests=error -R "startup_sampler_lod_|startup_translated_sampler_bindings|startup_sampler_comparison|startup_sampler_heap_|mesh_heap_sampler_" -V: 15/15 passed in each of three runs.startup_sampler_lod mismatches=0;_dropped_:wrong_mip=2 unexpected=0;startup_translated_sampler_bindings: PASS (63 cases);debug_errors=0 debug_warnings=0in every draw.ctest --preset dev --no-tests=error -R "startup_sampler|startup_translated_sampler|startup_image_|mesh_|compute_mesh_texture_|offscreen_": 118/118 passed, 0 skipped.git diff --check origin/main...HEAD: clean.Not run: a mutant that triggers the new fixture check; the condition is one line.
Evidence and follow-up
CreateSamplerand created a static sampler in a root signature. The debug layer logged no message at creation for any of the pairs, whileMaxAnisotropy17 in the same probe was reported. This covers creation only, not a draw with the inverted pair, and does not change the documentedMinLOD <= MaxLODrequirement.smplsamplers ingfx2hlsl.pyalready refuseMIN_LODaboveMAX_LOD(#2177), while sampler heap entries keep the pair unchanged. Whether heap entries should be refused as well is left open.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T10:54:14Z.
Review: COMMENTED
Review of head
476e5bc44d: 0 P1, 0 P2.startup_sampler_lod.cppthrows if a decoded fixture entry breaks this.Commands executed locally:
python3 tests/docs_links_check.py: 18 files, 436 links OK.python3 tests/bidi_controls_check.py: OK.git diff --check origin/main...HEAD: clean.ctest -R '^startup_sampler_lod_|startup_translated_sampler_bindings'is 6/6 passed in both presets. This includes the_dropped_and shared-axis controls.src/startup_stubs/translated_sampler_bindings.h, then ranstartup_translated_sampler_bindingson Win2025. It FAILS on min lod 2, max lod 1, lod fractions and others. Reverted.Build and test on Windows: SUCCESS.AI-assisted; commands listed were executed locally.
upstream-sync referenced this pull request2026-11-25 12:01:50 +00:00