shader: allow several samples of one bound texture in pixel_aot #1695
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1702"
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 henriazz10 on 2026-11-24T17:24:51Z.
Change
Refs #730. Per the latest comment,
tools/pixel_aot.pyrequires the number of samples to equal the number of bound textures. With one shadow map, that rules out multi-tap PCF. This PR relaxes only that rule.lower()now records which bound textures were sampled. The final check requires every bound texture (tex, plustex1with a second descriptor) to be sampled at least once, instead ofsamples == len(bindings). A texture may therefore take more than one sample.--no-texturestill requires zero samples.Expected one gather for the declared view.Verification
Commit
a4a0b1c7, rebased ontocb6f71d4. The GPU draws and the LLVM 15 run below were measured with the same change on80f413a7. Between the two bases, only other sections ofdocs/experiments.mdchanged among the touched files, and both control scripts were re-run ona4a0b1c7. Windows 11 build 26300, VS 2019 Build Tools 16.11 (MSVC 14.29), DXC 1.8.2502.11, Python 3.12, D3D12 debug layer enabled.offscreen_checkwas built frommain; this PR does not change it.pixel_compare_sample_check.py drawpixel_aot_check.py draw-coredebug_errors=0debug_errors=0No capability skips. Both control modes (no arguments) exit 0.
The LLVM 15 round trip ran in Ubuntu 22.04 with
llvm-1515.0.7 from apt, as in the Linux CI job:These run the new PCF program (gfx1030) and the two new gfx1013 multi-tap fixtures.
Evidence
tests/pixel_compare_sample_check.py.image_sample_c_lztap and animage_sample_c_lz_otap at(1, -2)from the same depth texture and exports their mean.pixel_mismatch, and do on both adapters:pixel_aot_compare_sample_{warp,hardware}CTest entries, soCMakeLists.txtdoes not change.tests/pixel_aot_check.py.image_sample_lzdraw is part ofdraw-coreand checks all 64 pixels. A one-tap expectation must mismatch at (8, 0).image_sample_c_lztwo-tap translation control and a dual-texture program that samplestextwice andtex1once.--no-texture;tools/pixel_aot.pyreverted tomain, both control scripts fail on the new fixtures withUnexpected sample count or missing color export.docs/experiments.mdrecords the rule change next to the comparison-sample section.Checklist
docs/experiments.md).AI-assisted (Gemini CLI wrote the translator change and the
pixel_aot_check.pyfixtures; Claude Code, Claude Opus 5.5, added the PCF draw, the docs, rebased and ran the checks). The measurements above come from the machine described in Verification.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:30:17Z.
Review: COMMENTED
Review of head
a4a0b1c761128c408dee85fa2d4b133b277fd05f. Verdict: 0 P1, 0 P2 for the translator change; the draw-level claims are unverified here.Linux limits. Linux x86_64,
llvm-mc-19/ libLLVM-19 (CI pins 15), Python 3.14. No Windows, no DXC, no GPU: I could NOT runcheck_multitap_sample_drawordraw_pcf, so the PCF average, the one-tap controls and the mutant-offset controls are not executed by me, and neither is any pixel result.The change.
tools/pixel_aot.pyreplacessamples != len(bindings)withsampled_textures != set(bindings.values()) or (not bindings and samples): every bound texture must be sampled at least once instead of exactly once. Sample, get_lod, comparison and gather all record the texture. I read this as correct: a texture that is bound but never sampled is still refused, and the gather/comparison/plain mixing rules are unchanged.What I ran
pixel_aot_check._check_controls_inline(the function holding the new asserts): passes in 2.6 s, 102 MB.python3 -B tests/pixel_compare_sample_check.py(controls): passes.... binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so: passes, three comparison forms plus the PCF fixture assemble and decode back to the sameimage_*lines.pixel_aot_checkfixtures (twoimage_sample_lztaps; twoimage_sample_c_lztaps) assembled withllvm-mc-19 -mcpu=gfx1030 -mattr=+wavefrontsize64and decoded back with the in-tree decoder: identical text.check_binary()as a whole stops earlier, atcheck_f16_cvt_int16_binary(an0xfff0literal encoding differs under LLVM 19); that fixture is unrelated to this PR and I did not checkmain.s_waitcnt vmcnt(1)that read both results are refused (Sample used before vmcnt wait); reading only the first tap aftervmcnt(1)is accepted; no wait at all is refused. RDNA2 returns sample results in order, so the second behavior is right.git diff --checkclean;docs_links_checkandbidi_controls_checkpass. The diff has one non-ASCII character (×indocs/experiments.md).tools/pixel_aot.py(inline controls + compare controls, restored withgit checkout -- .):sampled_textures != set(bindings.values())->not sampled_textures(any one sample is enough): FAILED (the dual-texture "second texture never sampled" control)."tex": FAILED (PCF and multi-tap fixtures refused).or (not bindings and samples)removed: PASSED, not caught. I believe the clause is unreachable, since a sample with no bound texture is refused earlier (offset not in bindings); it is harmless but untested.Notes
draw_pcfand the multi-tap draw only prove anything on a GPU run; please run them on Windows (pixel_compare_sample_check.py draw,check_render) before relying on the PCF numbers.0x3e01decodes to x=+1, y=-2, matching theint2(1, -2)the check asserts.Not approving (comment only).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:43:12Z.
Review: COMMENTED
Verified head
6dbe718da5840b5b6fae6cb97554af487348cd8c(docs/experiments.md,tests/pixel_aot_check.py,tests/pixel_compare_sample_check.py,tools/pixel_aot.py; 0 P1, 0 P2).Linux checks
git diff --check origin/main...HEAD: clean.python3 tests/docs_links_check.py: pass (17 Markdown files, 364 links).python3 tests/bidi_controls_check.py: pass (1288 files).python3 -B tests/pixel_compare_sample_check.py: pass.python3 -B tests/pixel_compare_sample_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so: pass (all 3 comparison forms + two-tap PCF fixture assembled and decoded).pixel_aot_check._check_controls_inline: pass (multi-tapimage_sample_lz, multi-tapimage_sample_c_lz, dual-texture multi-tap, unsampled second-texture refusal, gather mixing refusals).tools/pixel_aot.py(each tested and reverted withgit checkout -- .):sampled_textures != set(bindings.values())->(bindings and not sampled_textures): FAIL inpixel_aot_check._check_controls_inline(dual-texture unsampled-second control).sampled_textures.add("tex")in comparison sample path: FAIL intests/pixel_compare_sample_check.py(Unexpected sample count or missing color export).Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)
tests/pixel_compare_sample_check.py: pass (3.26s).--preset dev): buildoffscreen_checkok (3.34s),ctest --preset dev -R '^(pixel_aot_warp|pixel_aot_compare_sample_warp)$': 2/2 passed (pixel_aot_compare_sample_warp10.76s,pixel_aot_warp13.51s)./O2(--preset release): buildoffscreen_checkok (0.97s),ctest --preset release -R '^(pixel_aot_warp|pixel_aot_compare_sample_warp)$': 2/2 passed (pixel_aot_compare_sample_warp10.87s,pixel_aot_warp13.35s).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by henriazz10 on 2026-11-24T17:40:42Z.
Thanks for the review and the mutation runs.
or (not bindings and samples): removed in6dbe718d. It was redundant as well as unreachable: with no binding, any recorded sample already makessampled_texturesdiffer from the empty set. Both control scripts still pass after the change.80f413a7with the same translator change. The results are in the Verification table. The debug layer was enabled, and no run was skipped for a missing capability.pixel_compare_sample_check.py draw(includingdraw_pcf): exit 0 on WARP and on an RTX 5080 (driver 32.0.16.1692), withdebug_errors=0. The PCF matched the averaged CPU reference for point and bilinear sampling, at 8×8 and 16×16. The controls failed at their first mismatching pixel:pixel_aot_check.py draw-core(includingcheck_multitap_sample_draw): exit 0 on both adapters. The one-tap expectation mismatched at (8, 0).check_f16_cvt_int16_binaryunder LLVM 19: I ranpixel_aot_check.py binaryonly with LLVM 15.0.7, as pinned by CI, where it exits 0. I have not looked at the LLVM 190xfff0difference, and it is outside this PR.AI-assisted (Claude Code).