spirv_interface: validate outer array length, initializer ID, struct/member and stage decorations (SPIRV-INTERFACE-DECORATION-VALIDATION) #1542
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1542
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/spirv-interface-decoration-validation"
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?
Pull request successfully merged and closed
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
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.
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)