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

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

@⁠wetw0rks-c0ding on GitHub · 2026-11-24 21:24 UTC · original
wetw0rks-c0ding:mesh-compute-vs-pc-tail → main · +113 −13 · 3 files · 1 commits · open

Claimed in the coordination issue as: OLD-2528

What and why

When index.json's mesh_compute layout carries pc_tail_address_dwords, tools/mesh_compute_vs.py still emitted a 152-byte PushConstant block that does not fit 128-byte push-constant devices. It now reads the output-buffer address from the set-1 binding-0 Uniform block %pc_tail and omits PushConstant entirely; output is unchanged when that layout field is absent.

Tested

  • python3 -m pytest tests/test_mesh_compute_vs.py tests/test_mesh_compute.py -q -> 44 passed, 13 subtests
  • python -I scripts/check_no_game_data.py tools/mesh_compute_vs.py tests/test_mesh_compute_vs.py tests/test_mesh_compute.py -> clean
  • Environment: Linux (CachyOS), CPU-only tests, no GPU required

AI-assisted: Yes. This work was done with OpenCode agents.

**@⁠wetw0rks-c0ding** on GitHub · 2026-11-24 21:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1295) `wetw0rks-c0ding:mesh-compute-vs-pc-tail` → `main` · +113 −13 · 3 files · 1 commits · open Claimed in the coordination issue as: OLD-2528 ### What and why When `index.json`'s `mesh_compute` layout carries `pc_tail_address_dwords`, `tools/mesh_compute_vs.py` still emitted a 152-byte `PushConstant` block that does not fit 128-byte push-constant devices. It now reads the output-buffer address from the set-1 binding-0 `Uniform` block `%pc_tail` and omits `PushConstant` entirely; output is unchanged when that layout field is absent. ### Tested - `python3 -m pytest tests/test_mesh_compute_vs.py tests/test_mesh_compute.py -q` -> 44 passed, 13 subtests - `python -I scripts/check_no_game_data.py tools/mesh_compute_vs.py tests/test_mesh_compute_vs.py tests/test_mesh_compute.py` -> clean - Environment: Linux (CachyOS), CPU-only tests, no GPU required AI-assisted: Yes. This work was done with OpenCode agents.
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]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:46:24 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 14:54 UTC · original

Reviewed 5684a06: ran tests/test_mesh_compute_vs.py and tests/test_mesh_compute.py on the PR tree and on main with the PR's tests copied in - the new tests fail on main and pass on the PR, the rest are unchanged; probed that without pc_tail_address_dwords the emitted assembly is byte-identical to main over 10 layouts, and that the tail-mode shader matches rdna2spirv's %pc_tail block (set 1 binding 0, 6 dwords, offsets 0..20). I could not run spirv-as/val here, so the assemble-and-validate tests skipped - please run them where SPIRV-Tools exist. AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 14:54 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1295#issuecomment-7165990758) Reviewed 5684a06: ran tests/test_mesh_compute_vs.py and tests/test_mesh_compute.py on the PR tree and on main with the PR's tests copied in - the new tests fail on main and pass on the PR, the rest are unchanged; probed that without pc_tail_address_dwords the emitted assembly is byte-identical to main over 10 layouts, and that the tail-mode shader matches rdna2spirv's %pc_tail block (set 1 binding 0, 6 dwords, offsets 0..20). I could not run spirv-as/val here, so the assemble-and-validate tests skipped - please run them where SPIRV-Tools exist. AI-assisted review. **Recommendation:** Merge
Author
Owner

@⁠wavehs on GitHub · 2026-11-26 18:48 UTC · original

Related to #765 (whoalin1, 2026-11-24 13:35, earlier): same feature (read the output address from %pc_tail when --pc-tail-ubo is used), same three files, different validation.

The concrete difference is _pc_tail_dwords in tools/mesh_compute_vs.py:

  • #765 requires two distinct dwords and bounds each to 0..63 (PC_TAIL_MAX_DWORDS), so [4, 4], [64, 65] and [70000, 70001] are rejected, and it tests each in test_pc_tail_address_dwords_rejects_malformed_values.
  • This PR accepts any two non-negative ints, including duplicates and arbitrarily large values, and its test list drops those three cases.

When the layout index is wrong, a duplicate or out-of-range pair would emit an OpAccessChain outside the %pc_tail block instead of failing the tool, so #765 looks like the safer of the two. Not a duplicate in the "identical diff" sense, so I am not recommending a close outright — but the coordinator should pick one, and if this one lands the three missing negative cases should be added.

AI-assisted (review only).

**@⁠wavehs** on GitHub · 2026-11-26 18:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1295#issuecomment-7200865396) Related to **#765** (whoalin1, 2026-11-24 13:35, earlier): same feature (read the output address from `%pc_tail` when `--pc-tail-ubo` is used), same three files, different validation. The concrete difference is `_pc_tail_dwords` in `tools/mesh_compute_vs.py`: - #765 requires two **distinct** dwords and bounds each to `0..63` (`PC_TAIL_MAX_DWORDS`), so `[4, 4]`, `[64, 65]` and `[70000, 70001]` are rejected, and it tests each in `test_pc_tail_address_dwords_rejects_malformed_values`. - This PR accepts any two non-negative ints, including duplicates and arbitrarily large values, and its test list drops those three cases. When the layout index is wrong, a duplicate or out-of-range pair would emit an `OpAccessChain` outside the `%pc_tail` block instead of failing the tool, so #765 looks like the safer of the two. Not a duplicate in the "identical diff" sense, so I am not recommending a close outright — but the coordinator should pick one, and if this one lands the three missing negative cases should be added. AI-assisted (review only).
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/1295/head:github-bot/gh-1295'
git switch 'github-bot/gh-1295'

Merge

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