rdna2spirv: a mesh shader exp pos1 writes Layer and ViewportIndex per primitive #162

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

@⁠Andretuta on GitHub · 2026-11-24 02:32 UTC · original
ubiquitarianism:old-pr/9893 → main · +97 −25 · 2 files · 1 commits · draft

Carried over from old PR 9893 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9893, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
tedin7: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

What

A mesh shader that exports the misc vector at exp pos1 (z[10:0] = Layer, z[19:16] = ViewportIndex) now writes Layer and ViewportIndex as per-primitive mesh outputs (PerPrimitiveEXT members of the primitive block). Before, the pos1 export was staged as if it were an ordinary position and the Layer/ViewportIndex values were lost. The VS/NGG path shares the new export_misc_pos1 helper, so its output is unchanged. ShaderLayer/ShaderViewportIndex capabilities are skipped for mesh shaders (the builtins are part of MeshShadingEXT).

Why

Shaders that render into layered targets or multiple viewports through the mesh path would draw everything into layer 0 / viewport 0, breaking 3D rendering for those draws.

Tested

  • python3 -m pytest tests/test_translate.py: 666 passed (113 s), including 3 new tests: layer+viewport per primitive, layer only (no viewport member), and no misc outputs keeps the plain primitive block.
  • Negative control: with tools/rdna2spirv.py taken from origin/main, 2 of the 3 new tests fail (the third guards that nothing changes without misc outputs, and passes on both).
  • Not run: GPU/lavapipe validation of the emitted module (pods are off); the tests assert on the generated SPIR-V.

Rebased cleanly on current main (the cherry-pick applied without conflicts). Our earlier PR for this was not opened before the org migration, so there is nothing to supersede.

**@⁠Andretuta** on GitHub · 2026-11-24 02:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/162) `ubiquitarianism:old-pr/9893` → `main` · +97 −25 · 2 files · 1 commits · draft > Carried over from **old PR 9893** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9893`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `tedin7`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): ## What A mesh shader that exports the misc vector at `exp pos1` (z[10:0] = Layer, z[19:16] = ViewportIndex) now writes Layer and ViewportIndex as per-primitive mesh outputs (`PerPrimitiveEXT` members of the primitive block). Before, the pos1 export was staged as if it were an ordinary position and the Layer/ViewportIndex values were lost. The VS/NGG path shares the new `export_misc_pos1` helper, so its output is unchanged. `ShaderLayer`/`ShaderViewportIndex` capabilities are skipped for mesh shaders (the builtins are part of MeshShadingEXT). ## Why Shaders that render into layered targets or multiple viewports through the mesh path would draw everything into layer 0 / viewport 0, breaking 3D rendering for those draws. ## Tested - `python3 -m pytest tests/test_translate.py`: 666 passed (113 s), including 3 new tests: layer+viewport per primitive, layer only (no viewport member), and no misc outputs keeps the plain primitive block. - Negative control: with `tools/rdna2spirv.py` taken from origin/main, 2 of the 3 new tests fail (the third guards that nothing changes without misc outputs, and passes on both). - Not run: GPU/lavapipe validation of the emitted module (pods are off); the tests assert on the generated SPIR-V. Rebased cleanly on current main (the cherry-pick applied without conflicts). Our earlier PR for this was not opened before the org migration, so there is nothing to supersede.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:46:59 +00:00
This pull request has changes conflicting with the target branch.
  • tools/rdna2spirv.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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