OLD-2528: mesh_compute_vs: read output address from %pc_tail when pc_tail_address_dwords is set #765

Open
github-bot wants to merge 2 commits from github-bot/gh-765 into main AGit
Owner

@⁠whoalin1 on GitHub · 2026-11-24 13:35 UTC · original
whoalin1:mesh-compute-vs-pc-tail → main · +118 −13 · 3 files · 2 commits · open

Restores my open PR from the original repository (OLD-2528), rebased onto current main (2d73c242f).

Claim: #14

Summary

  • When index.json's mesh_compute layout carries pc_tail_address_dwords (as emitted by rdna2spirv.py --mesh-compute --pc-tail-ubo), tools/mesh_compute_vs.py reads the output-buffer address from the set-1 binding-0 Uniform block %pc_tail (%PcTail) instead of a 152-byte PushConstant block, omitting PushConstant completely so the vertex shader fits 128-byte push-constant devices.
  • Without pc_tail_address_dwords, the emitted SPIR-V assembly is byte-identical to before.
  • Adds unit tests in tests/test_mesh_compute_vs.py and tests/test_mesh_compute.py.

Verification (rebased on 2d73c242f)

  • py -3.14 -m compileall -q tools/mesh_compute_vs.py tests/test_mesh_compute.py tests/test_mesh_compute_vs.py — clean
  • LLVM_MC="wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc" py -3.14 -m pytest tests/test_mesh_compute_vs.py tests/test_mesh_compute.py -q -p no:cacheprovider — 44 passed, 13 subtests passed
  • py -3.14 -I tests/test_text_write_line_endings.py — 3 passed

AI-assisted (Gemini 4 Neon).

**@⁠whoalin1** on GitHub · 2026-11-24 13:35 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/765) `whoalin1:mesh-compute-vs-pc-tail` → `main` · +118 −13 · 3 files · 2 commits · open Restores my open PR from the original repository (OLD-2528), rebased onto current `main` (`2d73c242f`). Claim: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 ### Summary - When `index.json`'s `mesh_compute` layout carries `pc_tail_address_dwords` (as emitted by `rdna2spirv.py --mesh-compute --pc-tail-ubo`), `tools/mesh_compute_vs.py` reads the output-buffer address from the set-1 binding-0 `Uniform` block `%pc_tail` (`%PcTail`) instead of a 152-byte `PushConstant` block, omitting `PushConstant` completely so the vertex shader fits 128-byte push-constant devices. - Without `pc_tail_address_dwords`, the emitted SPIR-V assembly is byte-identical to before. - Adds unit tests in `tests/test_mesh_compute_vs.py` and `tests/test_mesh_compute.py`. ### Verification (rebased on `2d73c242f`) - `py -3.14 -m compileall -q tools/mesh_compute_vs.py tests/test_mesh_compute.py tests/test_mesh_compute_vs.py` — clean - `LLVM_MC="wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc" py -3.14 -m pytest tests/test_mesh_compute_vs.py tests/test_mesh_compute.py -q -p no:cacheprovider` — **44 passed, 13 subtests passed** - `py -3.14 -I tests/test_text_write_line_endings.py` — **3 passed** AI-assisted (Gemini 4 Neon).
When index.json's mesh_compute layout carries pc_tail_address_dwords (as
produced by rdna2spirv.py --mesh-compute --pc-tail-ubo), emit the vertex
shader's output-buffer address loads from the set-1 binding-0 Uniform block
%pc_tail (%PcTail) instead of a 152-byte PushConstant block, omitting
PushConstant completely so the vertex shader fits 128-byte push-constant
devices. Without pc_tail_address_dwords, the emitted SPIR-V assembly is
byte-identical to before.

Co-Authored-By: Gemini 4 Neon <[email protected]>
Co-Authored-By: Gemini 4 Neon <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:20:17 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-24 19:34 UTC · original

Reviewed cbc75b95: ran python3 -I tests/test_mesh_compute_vs.py -v (13 passed, 3 skipped—spirv-as/spirv-val unavailable on this host; pytest also unavailable for tests/test_mesh_compute.py), py_compile, check_no_game_data.py, and a probe comparing origin/main vs PR. Output without pc_tail_address_dwords is byte-identical, and the %pc_tail / %PcTail (set 1, binding 0) interface matches rdna2spirv.py --pc-tail-ubo with PushConstant omitted. Minor nit: _pc_tail_dwords accepts duplicate ([4, 4]) or unboundedly large indices ([70000, 70001] emits a 70,002-member OpTypeStruct). No blocking bugs found. AI-assisted review.

**@⁠PierreEbele** on GitHub · 2026-11-24 19:34 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/765#issuecomment-7142294857) Reviewed cbc75b95: ran `python3 -I tests/test_mesh_compute_vs.py -v` (13 passed, 3 skipped—`spirv-as`/`spirv-val` unavailable on this host; `pytest` also unavailable for `tests/test_mesh_compute.py`), `py_compile`, `check_no_game_data.py`, and a probe comparing `origin/main` vs PR. Output without `pc_tail_address_dwords` is byte-identical, and the `%pc_tail` / `%PcTail` (set 1, binding 0) interface matches `rdna2spirv.py --pc-tail-ubo` with `PushConstant` omitted. Minor nit: `_pc_tail_dwords` accepts duplicate (`[4, 4]`) or unboundedly large indices (`[70000, 70001]` emits a 70,002-member `OpTypeStruct`). No blocking bugs found. AI-assisted review.
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-24 19:36 UTC · original

Thanks for the review and catch, @⁠PierreEbele! Hardened _pc_tail_dwords in 783ac2a4d to reject duplicate indices (lo == hi) and indices >= PC_TAIL_MAX_DWORDS (64), with unit tests covering [4, 4], [64, 65], and [70000, 70001] (test_mesh_compute_vs.py + test_mesh_compute.py: 44 passed, 16 subtests passed with llvm-mc and spirv-as/spirv-val).

**@⁠whoalin1** on GitHub · 2026-11-24 19:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/765#issuecomment-7142346434) Thanks for the review and catch, @⁠PierreEbele! Hardened `_pc_tail_dwords` in `783ac2a4d` to reject duplicate indices (`lo == hi`) and indices `>= PC_TAIL_MAX_DWORDS` (64), with unit tests covering `[4, 4]`, `[64, 65]`, and `[70000, 70001]` (`test_mesh_compute_vs.py` + `test_mesh_compute.py`: 44 passed, 16 subtests passed with `llvm-mc` and `spirv-as`/`spirv-val`).
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-25 20:59 UTC · original

Rebased cleanly onto current main (db1a22d29) as 4bbeddd5a; no conflicts. The branch is unchanged: mesh_compute_vs reads the output address from %pc_tail and rejects duplicate/out-of-range pc_tail_address_dwords indices. AI-assisted with Devin.

**@⁠whoalin1** on GitHub · 2026-11-25 20:59 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/765#issuecomment-7174464750) Rebased cleanly onto current main (`db1a22d29`) as `4bbeddd5a`; no conflicts. The branch is unchanged: mesh_compute_vs reads the output address from `%pc_tail` and rejects duplicate/out-of-range `pc_tail_address_dwords` indices. AI-assisted with Devin.
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/765/head:github-bot/gh-765'
git switch 'github-bot/gh-765'

Merge

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