docs, tests: describe heap sampler LOD limits as applied at run time #2322
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2330"
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-25T12:36:06Z.
Refs #2221.
Follow-up to #2287 and #2298, which said this cleanup could come separately. There is no behaviour change; the diff touches two docs and one test fixture.
Docs.
docs/startup-runtime.mdanddocs/experiments.mdstill said a heap sampler translates "with an unbounded LOD range". Since #2287, the run-time heap table applies each entry's MIN_LOD and MAX_LOD throughdynamic_sampler(). Both passages now describe what main does:gfx2hlsl.pystill does not validate a heap sampler and logs that once per module;X2W_SAMPLER_HEAP=1, a table entry applies its MIN_LOD and MAX_LOD at run time;Test.
tests/mesh_heap_sampler_draw.cppdecoded MinLOD/MaxLOD a second time afterdynamic_sampler(). The body of #2287 offered to drop that decode, and this change does.fixture_sampler()now returnsdynamic_sampler(words)unchanged, so the mesh draw exercises the production decode. The fixture, expected colours and assertions are the same.Evidence. Windows 11, WARP and an RTX 3070, with the debug layer on:
debug_errors=0 debug_warnings=0on every draw.dynamic_sampler()was made to decode without the LOD fields.mesh_heap_sampler_draw_{warp,hardware}then fail at word 0x20 with 1,024 of 1,024 mismatches, so the clamp the mesh draw depends on now comes fromdynamic_sampler().startup_sampler_lod_*andstartup_translated_sampler_bindingsfail under the same change.python -B tests/docs_links_check.pypasses.Not tested: AMD or Intel GPUs, and console hardware.
Open question, no code change without your call. Constant and
smplsamplers ingfx2hlsl.pyalready refuse MIN_LOD above MAX_LOD (#2177). A heap entry with the same pair is passed to D3D12 unchanged. Should heap entries:We have no source for what the console sampler does with that pair. The RDNA 2 ISA (§8.2.7, table 46) defines the fields but not the inverted case, so we have left the behaviour as it is.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:10:31Z.
Review: COMMENTED
Review of head
2102ab014a2797b32c158954670c0cdf361e6c42(docs + one test fixture, no production code).Findings: 0 P1, 0 P2.
tests/mesh_heap_sampler_draw.cpp: the fixture no longer re-decodes MIN_LOD/MAX_LOD. It now relies ondynamic_sampler()->decode_sampler(words, 0, false, true)insrc/startup_stubs/translated_sampler_bindings.h, which divides word 1 bits 11:0 / 23:12 by 256 (4.8 fixed point). The test therefore guards the real code path instead of a copy.docs/experiments.md,docs/startup-runtime.md) match the code: heap entries apply MIN/MAX LOD, bias is not carried, MIN_LOD > MAX_LOD passes through, default-sampler shortcut stays unbounded (border_sampler()resets MaxLOD).Commands executed locally:
python3 tests/docs_links_check.py-> 18 files, 451 links OKpython3 tests/bidi_controls_check.py-> no bidi controlsgit diff --check origin/main...HEAD-> cleandynamic_sampler()passlod_limits=false. Win2025 WARP Debugctest -R '^mesh_heap_sampler_draw_warp$'-> Failed (mutation killed). Reverted.--targets offscreen_check --regex '^(mesh_heap_sampler_draw_warp|startup_sampler_heap_warp|startup_sampler_lod_warp|startup_sampler_lod_dropped_warp)$': Debug 4/4 passed, Release /O2 4/4 passed.compute_store_aot_descriptor_load_format_warpunder VM load (file not touched by this PR).AI-assisted; commands listed were executed locally.