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

Closed
Andretuta wants to merge 1 commit from upstream-pr/162 into main
Andretuta commented 2026-11-24 02:32:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:32:20Z.


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464982180 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/162). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:32:20Z. --- > 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.
DadaCap commented 2026-11-28 10:33:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:33:47Z.


Thanks for the contribution! This PR was reviewed by the maintainers and is being closed as part of a large batch of closures.

Reason: superseded by main.

If this looks like a mistake, mention @DadaCap here at any time and it will be looked at again.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237977263 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/162#issuecomment-7237977263). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T10:33:47Z. --- Thanks for the contribution! This PR was reviewed by the maintainers and is being closed as part of a large batch of closures. Reason: superseded by main. If this looks like a mistake, mention @DadaCap here at any time and it will be looked at again. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

Pull request closed

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!162
No description provided.