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

Merged
whoalin1 merged 2 commits from upstream-pr/765 into main 2026-11-28 14:27:50 +00:00
whoalin1 commented 2026-11-24 13:35:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-24T13:35:05Z.


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

Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7133003627

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).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5473167379 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/765). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-24T13:35:05Z. --- Restores my open PR from the original repository (OLD-2528), rebased onto current `main` (`2d73c242f`). Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7133003627 ### 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).
PierreEbele commented 2026-11-24 19:34:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-24T19:34:36Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7142294857 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/765#issuecomment-7142294857). Originally posted by [PierreEbele](https://github.com/PierreEbele) on 2026-11-24T19:34:36Z. --- 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.
whoalin1 commented 2026-11-24 19:36:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-24T19:36:49Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7142346434 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/765#issuecomment-7142346434). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-24T19:36:49Z. --- 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 commented 2026-11-25 20:59:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-25T20:59:38Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7174464750 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/765#issuecomment-7174464750). Originally posted by [whoalin1](https://github.com/whoalin1) on 2026-11-25T20:59:38Z. --- 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.
MoonEyes commented 2026-11-28 14:27:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:27:47Z.


Red/green: classified READY by cloud-1 (red on main 09c153948, green on head merged with main); head 4bbeddd5ab unchanged since 2026-11-25, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7240688230 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/765#issuecomment-7240688230). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T14:27:47Z. --- Red/green: classified READY by cloud-1 (red on main 09c153948, green on head merged with main); head 4bbeddd5ab33 unchanged since 2026-11-25, before that run. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!765
No description provided.