test: refuse a numeric read of a descriptor register #1762
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1769"
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-24T18:17:05Z.
What
Stage.S(the uint expression for scalar registern) answers for constants, uniform data and the two copy shapes, andrefuses everything else:
No check reached that raise. Two mutations, each reverted:
The second one matters most: falling through to
s<n>would emit a register name for something that is not a 32-bitvalue, which is the failure the raise exists to prevent.
Change
One case that builds the symbol state for a table pointer and for a descriptor and asserts the refusal, and that the
register is not added to
used_s:The
used_sassertion is deliberate: a refused read must not look like a use, or a later dead-code decision would keep aregister alive for a value that was never read.
Tested
Scope
One test file, no behaviour change. Related: in #1767 I noted this raise and the one at the end of
descriptoras bothunreached; I have since corrected that comment — the
descriptorone is reached bystartup_inline_sampler_check.py, soonly this one needed a case.
Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:34:09Z.
Review: COMMENTED
Reviewed head
a511dbb07322bc2c14929f201baf7331f1b0c7d6. No P1/P2 findings.The new
check_numeric_symbol_refusalcovers both('ptr', ...)and('desc', ...)registers. It asserts thatStage.S(8)raisesUnsupportedwith "numeric use of s8", and thatused_sstays empty. This matchesStage.Sintools/startup/gfx2hlsl.py. The test covers the refusal and the lack of side effects, so a refused read can no longer leave ans8declaration behind. It is test-only, and the comments describe behavior without outside material.Commands run locally on Linux in a clean worktree:
git diff --check origin/main...HEAD-> rc 0python -B tests/bidi_controls_check.py-> rc 0python -B tests/startup_translator_check.py-> rc 0 (0 failed)Mutations in
tools/startup/gfx2hlsl.py(each reverted withgit checkout -- .):'ptr'and'desc'to the allowed tuple inS(they are read ass8) -> the check FAILS (rc 1, 4 failures).self.used_s.add(n)before theraise-> the check FAILS (rc 1, 2 failures).Windows 2025 will be verified before any merge, once the overlap with the other PR touching
tests/startup_translator_check.pyis resolved. This is a review comment only, not an approval.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:29:05Z.
Review: COMMENTED
Review of head
a511dbb073(tests/startup_translator_check.py only; pure-Python fast path). No P1, no P2.Commands run locally:
Mutations of the logic in tools/startup/gfx2hlsl.py, each reverted with git checkout:
The new check kills both mutations the commit message names. Windows 2025 runs are not applicable (tests/**/*.py only).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:43:23Z.
Thanks for this test. #1767 has just merged and touches the same lines of tests/startup_translator_check.py, so this branch now conflicts with main. Could you rebase on main and keep both checks? Once the head changes I will re-run the review checks on the new commit.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:09:38Z.
Review: COMMENTED
Review of head
3e62f7167f3d0a2c32063db2b477b5f7a7d77871(tests/startup_translator_check.py only; pure-Python fast path). No P1, no P2.Scope.
git diff origin/main...HEADtouches one file:tests/startup_translator_check.py(+20 lines, newcheck_numeric_symbol_refusal, registered inmain). No C++, no CMakeLists.txt. The head moved since the earlier review (a511dbb0) by a merge of main (3e62f716); the PR diff itself is unchanged. GitHubBuild and test on Windows: pass;Run platform-independent Python checks on Linux: pass. Mergeable, state CLEAN.Commands run locally on this head:
git diff --check origin/main...HEAD: rc=0python3 tests/docs_links_check.py: rc=0 (18 Markdown files, 380 links)python3 tests/bidi_controls_check.py: rc=0 (1342 files)python3 tests/startup_translator_check.py: rc=0 (0 failed)Mutations in
Stage.Softools/startup/gfx2hlsl.py(each reverted withgit checkout -- ., tree clean after):s<n>and is marked used instead of raising: check fails, rc=1 (4 failed: read as s8 and marked used, for both shapes).used_s.add(n)before theraise Unsupported: check fails, rc=1 (2 failed: marked s8 as used, for both shapes).The new check protects real behaviour: a refused numeric read of a descriptor or buffer-pointer register raises and leaves no
s8declaration. Windows 2025 runs are not applicable (tests/**/*.py only). This is a review comment, not an approval.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T21:05:06Z.
Resolved the test overlap with #1767 on main. The root-descriptor key check and this branch's numeric pointer/descriptor refusal both run from startup_translator_check.py, which passed on Windows. No translator behaviour changes in this merge.