spirv_gs_to_compute: derived input/output pointers keep the capture's storage class (OLD-4126) #177

Manually merged
github merged 1 commit from gh-pr/177/head into gh-pr/177/base 2026-11-26 08:47:36 +00:00
Owner

@⁠ItsMrDubey on GitHub · 2026-11-24 02:36 UTC · original
ItsMrDubey:geometry-capture-storage-class → main · +58 −0 · 2 files · 1 commits · merged 2026-11-24 03:28 UTC

Claimed in the coordination issue as: OLD-4126 (#14)

What and why

Old #4126: the geometry capture pass (tools/spirv_gs_to_compute.py) rewrites an access chain on a GS input to point into the input buffer (StorageBuffer), and one on a GS output to point at the matching private variable. A pointer derived from that result — another OpAccessChain / OpInBoundsAccessChain / OpPtrAccessChain, or an OpCopyObject — was passed through unchanged, so it still had its old Input / Output pointer type over a base in another storage class, which makes an invalid module.

The rewrite now tracks every pointer it moved to the input buffer or to a private output variable, and gives anything derived from one the same storage class (%gsc_ptr_sb_* / %gsc_ptr_pv_*, for vec4 and float pointees, the only types those hold). A derived pointer to any other type now raises Unsupported instead of being given the wrong type.

Tested

Windows 11, Python 3.11.9, no GPU needed. spirv-as / spirv-val are not on PATH here, so the tests that need them were skipped (25); the new test also runs spirv-val on both modules when those tools are present.

  • Repro on origin/main with a hand-built GS (%pc = OpCopyObject %ptr_in_v4 %p, %py = OpInBoundsAccessChain %ptr_in_float %pc %u1, %oc = OpCopyObject %ptr_out_float %ox): output kept %ptr_in_v4 / %ptr_in_float / %ptr_out_float.
  • python -m pytest -q tests/test_spirv_gs_to_compute.py tests/test_spirv_gs_to_compute_bounds.py: before the fix 1 failed (new test), 4 passed, 25 skipped; after it 12 passed, 25 skipped.
  • python -I scripts/run_semantic_tests.py tests/semantic: 463 files, 6075 tests, 4 files failed: test_exec_computed, test_image_atomics_guard, test_sopc_validation, test_unary_f16_validation (the same four fail on main on this machine; unrelated to this tool).
  • python -I scripts/check_no_game_data.py on both changed files: clean.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • No new translator rule, so nothing to add to the contract table of docs/design.md (capture-pass rewrite only).
**@⁠ItsMrDubey** on GitHub · 2026-11-24 02:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/177) `ItsMrDubey:geometry-capture-storage-class` → `main` · +58 −0 · 2 files · 1 commits · merged 2026-11-24 03:28 UTC Claimed in the coordination issue as: OLD-4126 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Old #4126: the geometry capture pass (`tools/spirv_gs_to_compute.py`) rewrites an access chain on a GS input to point into the input buffer (`StorageBuffer`), and one on a GS output to point at the matching private variable. A pointer derived from that result — another `OpAccessChain` / `OpInBoundsAccessChain` / `OpPtrAccessChain`, or an `OpCopyObject` — was passed through unchanged, so it still had its old `Input` / `Output` pointer type over a base in another storage class, which makes an invalid module. The rewrite now tracks every pointer it moved to the input buffer or to a private output variable, and gives anything derived from one the same storage class (`%gsc_ptr_sb_*` / `%gsc_ptr_pv_*`, for vec4 and float pointees, the only types those hold). A derived pointer to any other type now raises `Unsupported` instead of being given the wrong type. ### Tested Windows 11, Python 3.11.9, no GPU needed. spirv-as / spirv-val are not on PATH here, so the tests that need them were skipped (25); the new test also runs spirv-val on both modules when those tools are present. - Repro on origin/main with a hand-built GS (`%pc = OpCopyObject %ptr_in_v4 %p`, `%py = OpInBoundsAccessChain %ptr_in_float %pc %u1`, `%oc = OpCopyObject %ptr_out_float %ox`): output kept `%ptr_in_v4` / `%ptr_in_float` / `%ptr_out_float`. - `python -m pytest -q tests/test_spirv_gs_to_compute.py tests/test_spirv_gs_to_compute_bounds.py`: before the fix 1 failed (new test), 4 passed, 25 skipped; after it 12 passed, 25 skipped. - `python -I scripts/run_semantic_tests.py tests/semantic`: 463 files, 6075 tests, 4 files failed: test_exec_computed, test_image_atomics_guard, test_sopc_validation, test_unary_f16_validation (the same four fail on main on this machine; unrelated to this tool). - `python -I scripts/check_no_game_data.py` on both changed files: clean. AI-assisted: yes ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] No new translator rule, so nothing to add to the contract table of `docs/design.md` (capture-pass rewrite only).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:47:33 +00:00
github manually merged commit 2f9fd8ff83 into gh-pr/177/base 2026-11-26 08:47:36 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.