test: refuse a comparison sample whose sampler is not constant #1880
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!1880
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1880/head"
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?
@ChazY11 on GitHub · 2026-11-24 20:02 UTC · original
ChazY11:test/image-compare-const-sampler→main· +34 −0 · 1 files · 1 commits · merged 2026-11-24 20:13 UTCWhat
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
@tedin7 on GitHub · 2026-11-24 20:08 UTC · original · reviewed
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.