startup: accept 2D gather samplers that differ only in fields a fixed-mip gather cannot observe #2179
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2187"
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 rasptum on 2026-11-25T03:19:39Z.
Refs #1802
The
image_gather4_lzlowering intools/startup/gfx2hlsl.py(2D, fixed mip, landed in #1927) validates the constant sampler against one exact profile: clamp to the last texel in X and Y, bilinear XY, point mip filtering, and no LOD fields. This change keeps that profile. It stops refusing three sampler fields that a fixed-mip 2D gather cannot observe, one commit each:CLAMP_Z(SQ_IMG_SAMP_WORD0 bits 8:6). A 2D view has no third coordinate.XY_MAG_FILTER/XY_MIN_FILTER(WORD2 bits 21:20 and 23:22, value 0). These are checked as bilinear.MIP_POINT_PRECLAMP(WORD2 bit 28). It acts only on mip selection, and the_lzgather reads mip zero.Source for all three: the Direct3D 11.3 functional spec, 22.4.2 gather4. It says gather4 "Gathers the four texels that would be used in a bi-linear filtering operation", "Only the addressing modes of the sampler are used", and "the top level of any mip pyramid is used".
FILTER_MIN_MAG_MIP_POINT,tests/pixel_aot_vs.hlsl) and reads the bilinear footprint. The level-zero comparison path already acceptsMIP_POINT_PRECLAMPfor the same reason (pixel_aot.comparison_sampler_state).Still refused:
Tests (
tests/startup_image_gather_lz_check.py, hand-assembled words as before):CLAMP_Z1 to 7; point magnification, minification and both;MIP_POINT_PRECLAMP; and their combinations. Each translation carries the title's words into the manifest, and every form listed above stays refused.CLAMP_Zset, with point XY plusCLAMP_Z, and with all three fields set. Each reads the same four texels as the reference; the existing mutant draw still fails.Effect, measured locally by aggregate count only: in one local shader-request cache, all three pipelines that refused at this sampler check get past it. One now translates fully. The other two reach later refusals:
s_bfm_b64, which open PRs cover, and a descriptor operand.Test:
Result at
3f30a943(on56b801be):startup_image_2d_array_hardwareandstartup_image_sample_a16_hardwarehit the 120 s timeout under--parallel 4. Both pass when run serially (50 s and 27 s), and so doesstartup_image_gather_lz_hardware. This change touches neither test's path.docs_links_check,bidi_controls_check,form_coverage_checkandstartup_translator_checkpass.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:21:34Z.
Review: COMMENTED
Review of head
3f30a943116ceeca8479cc8e54e8d45c870708c9.Verdict: no P1, no P2. Looks correct for what it claims.
What I checked
gather_2d_profile_words(tools/startup/gfx2hlsl.py): clears CLAMP_Z (WORD0 bits 8:6) and MIP_POINT_PRECLAMP (WORD2 bit 28), and turns point XY mag/min (value 0) into bilinear (value 1) beforecheck_gather_sampler. Aniso (2, 3), bits 29-31, WORD1/WORD3 and the X/Y address modes stay checked.GATHER_RESOURCESintools/pixel_aot.py) usesLoadtaps, so it does not depend on the sampler filter. This matches the claimed semantics.Commands run locally on the PR head
python3 tests/startup_image_gather_lz_check.py-> pass ("Four fixed-mip gather channels and unsupported encodings checked")python3 tests/docs_links_check.py-> pass (18 files, 401 links)python3 tests/bidi_controls_check.py-> passgit diff --check origin/main...HEAD-> clean!= 3instead of== 0in the filter check -> passes, but this is an equivalent mutant (0 becomes 1, 1 stays, 2 becomes 3 and is still refused).CI at review time: Linux python checks pass; Windows build/test and fixtures jobs were still pending. I did not run Win2025 (not needed for this change by itself; the D3D12 draw cases added in
draw()need the Windows job to go green).Nits (non-blocking)
gather_2d_profile_wordsdoc says a point filter "reads the same four texels". This is taken from the D3D11.3 spec. It is not shown that the console hardware gather ignores the filter in the same way. A one-line note that this is the spec rule would make the limit clear.tests/startup_image_gather_lz_check.py: the three negative controls monkeypatchG.gather_2d_profile_words. They work, but they are the "old behaviour is refused" kind. The direct refusals right next to them already cover the kept fields.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:41:26Z.
Review: COMMENTED
Re-review of head
767773388dbfb009db0d65bb310de44c2d03101f(3 new commits since the previously reviewed3f30a943).Scope read:
tools/startup/gfx2hlsl.py(gather_2d_profile_words, one call site),tests/startup_image_gather_lz_check.py,docs/experiments.md. Title is neutral, PR is mergeable, CI checks listed as pass (Linux Python, Windows build and test, gfx1013 fixtures).Logic
check_gather_sampler. The bound static sampler keeps the title's own words (manifest asserts check this). Matches the D3D11.3 gather4 text it cites.Commands run locally on this head
python3 -B tests/startup_image_gather_lz_check.py-> rc 0, "Four fixed-mip gather channels and unsupported encodings checked". The D3D12 draw part did not run on Linux, and I did not queue a Windows run. The CI Windows job passed.python3 tests/docs_links_check.py-> 18 files, 401 links OKpython3 tests/bidi_controls_check.py-> OKgit diff --check origin/main...HEAD-> cleanMutations (each reverted with
git checkout -- .)Findings
tests/startup_image_gather_lz_check.pynegative controls monkeypatchG.gather_2d_profile_words. That works because the call site looks the name up at call time. It would break silently if the call site ever bound the function early. Low risk.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-25T03:34:45Z.
Thanks. The
gather_2d_profile_wordsdocstring and the docs/experiments.md paragraph now say that "a point filter reads the same four texels" is the D3D11.3 rule (22.4.2 gather4) and has not been measured on console hardware; the three monkeypatched negative controls stay as they are, since removing each relaxation from the translator itself (local mutants) also fails them.Comment and docs only;
startup_image_gather_lz_check,docs_links_checkandbidi_controls_checkpass. AI-assisted (Claude Code).Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-25T05:42:06Z.
Review: APPROVED
Verified head
76777338on Windows x64 (Python 3.12). The point-filter andCLAMP_Z/MIP_POINT_PRECLAMPrelaxation is clearly scoped and documented as derived from the D3D11.3 gather spec.python -B tests/startup_image_gather_lz_check.py-> passed (Four fixed-mip gather channels and unsupported encodings checked)python -B tests/docs_links_check.py-> passed (18 Markdown files, 401 links)Verdict: Approved at
76777338.