test: refuse a comparison sample whose sampler is not constant #1873
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1880"
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 ChazY11 on 2026-11-24T20:02:20Z.
What
Last case from #1877.
image_comparetakes the comparison function and the filter from the sampler's four words, so asampler it cannot resolve is refused:
Replacing that
raisewithpassleft the four image checks green.Change
check_compare_sampler_constant()instartup_inline_sampler_check.py, on a bare stage:The second call is the control: with
s[4:7]in the symbol table as constants,const_wordsreturns four words and the guardis passed.
Tested
Negative controls, each reverted:
The second is the one that keeps "all four words must be constant" under test: with
all, a sampler with one unresolvedword would be accepted and the case fails.
Scope
One test file, one new function called from
controls(). This closes the three sites in #1877 (the other two are #1878 and#1879).
Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:08:17Z.
Review: COMMENTED
Peer review of head
9bba6a77d7efb1f0b12fa048e85905d1a468d0e6(PRODUCTION_REVIEW_ONLY, technical comment only).No P1 and no P2 found. The new check guards real behavior and fails when the guard is broken.
The change adds one function,
check_compare_sampler_constant, to tests/startup_inline_sampler_check.py (+34 lines), called at the start ofcontrols(). I read it againstimage_comparein tools/startup/gfx2hlsl.py. The refusal it targets (words is None-> "image_sample_c with a sampler that is not constant", line ~888) is decided from the symbol table after the dim, dmask, operand-count and sampler-heap checks, so a bareStagewith an empty symbol table reaches it, and four constant words (s4..s7) pass it. No other test in the tree pins this refusal: the string appears in no other file under tests/.Mutations of
tools/startup/gfx2hlsl.py, one at a time, each run againsttests/startup_inline_sampler_check.pyand then restored withgit checkout -- .(the tree is clean afterwards):words = (0, 0, 0, 0)instead of the raise): rc=1 ("Comparison sampling requires CLAMP_LAST_TEXEL in X and Y" escapes where the exact refusal text is asserted).if words is not None: raise ...): rc=1 (TypeError, the guard no longer reaches the constant-words path).Minor, non-blocking:
AttributeErroras "got past the guard" (the bare stage has no pipeline). It would also pass if a different attribute error came from earlier inimage_compare; the assertion that the refusal text is absent is what carries the check.def controls(); the file uses two elsewhere.Commands run (Linux; this PR is Python-only, so no Windows run is needed):
git diff --check <merge-base>...HEAD: cleantests/docs_links_check.py: passtests/bidi_controls_check.py: passtests/startup_inline_sampler_check.py: passmainhas no content conflicts (git merge-tree).AI-assisted; commands listed were executed locally.