spirv_metal_set0: synthesize uint, retype helper calls, expand decoration groups, and capture spirv-as stderr (SHADER-METAL-SET0-FIX) #946

Open
github-bot wants to merge 1 commit from github-bot/gh-946 into main AGit
Owner

@⁠hamdog0203 on GitHub · 2026-11-24 15:33 UTC · original
hamdog0203:fix/shader-metal-set0 → main · +447 −24 · 2 files · 1 commits · open

Summary

Fixes four SPIR-V / CLI edge cases in tools/spirv_metal_set0.py:

  • Synthesize a 32-bit unsigned integer type (OpTypeInt 32 0) before the first resized pointer type when a module with resized set-0 descriptor arrays does not already declare one (instead of exiting with SystemExit).
  • Propagate retyped set-0 descriptor-array pointer types transitively across OpCopyObject and OpFunctionCall into OpFunctionParameter and cloned OpTypeFunction declarations (without mutating function types shared with unresized foreign-set helpers), and fail closed on conflicting call sites or OpPhi/OpSelect pointer merges.
  • Expand OpDecorationGroup / OpGroupDecorate for both DescriptorSet 0 and Binding decorations, splitting shared Binding groups when they mix set-0 and non-set-0 targets.
  • Capture spirv-as stderr and pass explicit encoding="utf-8", errors="replace" for spirv-dis/spirv-as so cli() surfaces assembler errors and preserves UTF-8 OpNames on Windows code pages.

Verification

  • pytest tests/test_spirv_metal_set0.py -v (with Khronos SPIRV-Tools spirv-as, spirv-dis, spirv-val 1.4.363.1): 15/15 passed, 0 skipped.
  • Negative control against unpatched main (a289278): 6/7 new tests failed on main.
  • unittest tests/test_text_write_line_endings.py: 3/3 passed.
  • scripts/check_no_game_data.py: exit 0; LF-only, no BOM.

Claimed in the coordination issue as: SHADER-METAL-SET0-FIX (#14)
AI-assisted: yes
No game files

**@⁠hamdog0203** on GitHub · 2026-11-24 15:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/946) `hamdog0203:fix/shader-metal-set0` → `main` · +447 −24 · 2 files · 1 commits · open ## Summary Fixes four SPIR-V / CLI edge cases in `tools/spirv_metal_set0.py`: - Synthesize a 32-bit unsigned integer type (`OpTypeInt 32 0`) before the first resized pointer type when a module with resized set-0 descriptor arrays does not already declare one (instead of exiting with `SystemExit`). - Propagate retyped set-0 descriptor-array pointer types transitively across `OpCopyObject` and `OpFunctionCall` into `OpFunctionParameter` and cloned `OpTypeFunction` declarations (without mutating function types shared with unresized foreign-set helpers), and fail closed on conflicting call sites or `OpPhi`/`OpSelect` pointer merges. - Expand `OpDecorationGroup` / `OpGroupDecorate` for both `DescriptorSet 0` and `Binding` decorations, splitting shared `Binding` groups when they mix set-0 and non-set-0 targets. - Capture `spirv-as` stderr and pass explicit `encoding="utf-8", errors="replace"` for `spirv-dis`/`spirv-as` so `cli()` surfaces assembler errors and preserves UTF-8 `OpName`s on Windows code pages. ## Verification - `pytest tests/test_spirv_metal_set0.py -v` (with Khronos SPIRV-Tools `spirv-as`, `spirv-dis`, `spirv-val` 1.4.363.1): **15/15 passed, 0 skipped**. - Negative control against unpatched `main` (`a289278`): 6/7 new tests failed on `main`. - `unittest tests/test_text_write_line_endings.py`: **3/3 passed**. - `scripts/check_no_game_data.py`: exit 0; LF-only, no BOM. Claimed in the coordination issue as: SHADER-METAL-SET0-FIX (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) AI-assisted: yes No game files
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:29:50 +00:00
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-24 15:37 UTC · original · approved these changes

Verified on exact head 9c09a6749b246c3f86e9eba6dc4b6129444585cb. In a disposable Fedora 45 container with SPIRV-Tools installed, tests/test_spirv_metal_set0.py passed 15/15, including assembled and spirv-val-validated modules for synthetic uint insertion, nested helper parameter/call retyping, mixed decoration groups, and rejection of unsupported/conflicting pointer flows. tests/test_text_write_line_endings.py passed 3/3. Python compile, check_no_game_data.py, and git diff --check passed. The tests use synthetic SPIR-V only; no game data or GPU result is claimed.

**@⁠KernelSmoker** on GitHub · 2026-11-24 15:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/946#pullrequestreview-6042375420) · **approved these changes** Verified on exact head `9c09a6749b246c3f86e9eba6dc4b6129444585cb`. In a disposable Fedora 45 container with SPIRV-Tools installed, `tests/test_spirv_metal_set0.py` passed 15/15, including assembled and `spirv-val`-validated modules for synthetic uint insertion, nested helper parameter/call retyping, mixed decoration groups, and rejection of unsupported/conflicting pointer flows. `tests/test_text_write_line_endings.py` passed 3/3. Python compile, `check_no_game_data.py`, and `git diff --check` passed. The tests use synthetic SPIR-V only; no game data or GPU result is claimed.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/946/head:github-bot/gh-946'
git switch 'github-bot/gh-946'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-946'
git switch 'github-bot/gh-946'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-946'
git switch 'github-bot/gh-946'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-946'
git switch 'main'
git merge --squash 'github-bot/gh-946'
git switch 'main'
git merge --ff-only 'github-bot/gh-946'
git switch 'main'
git merge 'github-bot/gh-946'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.