spirv_interface: validate outer array length, initializer ID, struct/member and stage decorations (SPIRV-INTERFACE-DECORATION-VALIDATION) #1542
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1542"
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 ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T03:57:46Z.
What changed
tools/spirv_interface.py:varying_type): callarray_count(args[1])before unwrapping the outerOpTypeArrayon GS inputs, MS outputs, and PSPerVertexKHRinputs so zero, negative, non-integer, or undefined length constants raiseInterfaceErrorinstead of passing silently.OpVariableinitializer ID validation (tools/spirv_interface.py:read_instruction): validate the optional 4th operand (Initializer) withrequire_id()when present.tools/spirv_interface.py:apply_decoration_groups): rejectOpMemberDecoratetargeting aDecorationGroupID.tools/spirv_interface.py:shape,declaration):InterfaceErrorif any member decoration index is>= len(members)on a top-level or nested interface struct.Patch/PassthroughNVon top-level and nested struct types themselves (not only on variables and members), and propagatePerPrimitiveEXTfrom a top-level interface struct type to its members.Index,PerPrimitiveEXT, andPerVertexKHR(tools/spirv_interface.py:address,declaration):Indexon variables/members outside fragment (ps) outputs.PerPrimitiveEXToutside mesh (ms) outputs and fragment (ps) inputs.PerVertexKHRcombined withPerPrimitiveEXTon the same varying, and rejectPerVertexKHRon struct types or members.tests/test_spirv_interface.py): added 5 synthetic binary SPIR-V regression tests (23 assertions) covering every check above.Claimed in the coordination issue as:
SPIRV-INTERFACE-DECORATION-VALIDATION(#14 reached GitHub's 2,500-comment cap with no successor coordination issue open yet; checked #14 and open PRs — 0 claims and 0 open PRs touchtools/spirv_interface.py)How it was tested
python3 -I -W error tests/test_spirv_interface.py: 48/48 passed (0 warnings).python3 -I tests/test_spirv_interface_extra.py: 3/3 passed.python3 -I tests/test_shader_link_check.py: 51/51 passed.python3 -I tests/test_text_write_line_endings.py: 3/3 passed.python3 -I scripts/check_no_game_data.py tools/spirv_interface.py tests/test_spirv_interface.py: passed.python3 -m compileall -q tools/spirv_interface.py tests/test_spirv_interface.py: passed.main:tools/spirv_interface.py: all 5 new tests fail (FAILED (failures=23)), all 43 baseline tests pass.Metadata
Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T03:58:00Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T04:20:06Z.
Tested
a0996d0b0on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), againstmainc7e82e26e(Python SPIR-V tool; no GPU):tests/test_spirv_interface.py: 48 passed, 108 subtests passed at this head.main: 23 failed, 46 passed, 87 subtests — the new array-length, initializer-ID, struct/member-decoration and stage-decoration checks are not there.AI-assisted; synthetic fixtures only, no game data.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T10:44:17Z.
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 19 PRs (their tests, the tests importing the changed modules, the docs tests) on main
3ca0707: no new failure, Linux / Python 3.13.AI-assisted (Claude Code, Claude Opus 5.5)