rdna2spirv: mesh shader pos1 misc export writes Layer and ViewportIndex per primitive (OLD-9893) #1197
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1197"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by ambroseautomation on 2026-11-24T20:01:27Z.
Claimed in the coordination issue as: OLD-9893 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142685828)
What and why
Carries forward
old-pr/9893(draft #162, original commit authortedin7preserved; indexed in #17), rebased cleanly onto currentmain.Implements per-primitive
LayerandViewportIndexmesh shader outputs fromexp pos1misc vector exports intools/rdna2spirv.py:OSG1declaresSV_RenderTargetArrayIndex(Layer) and/orSV_ViewportArrayIndex(ViewportIndex), decodesz[10:0](Layer) and(z >> 16) & 0xF(ViewportIndex) fromexp pos1into%ms_layer/%ms_viewportand writes them into per-primitive members of%ms_cull_blk(BuiltIn Layer,BuiltIn ViewportIndex,PerPrimitiveEXT), emittingOpCapability ShaderLayer/OpCapability ShaderViewportIndexand reportingshaderOutputLayer/shaderOutputViewportIndexin shader metadata.tests/test_translate.py:test_ms_misc_pos1_exports_layer_and_viewport_per_primitive,test_ms_misc_pos1_layer_only_has_no_viewport_member, andtest_ms_without_misc_outputs_keeps_plain_primitive_block.Tested
tests/test_translate.pyfunctions directly viardna2spirv.translateand verified SPIR-V binary assembly viaspirv_asm.assemble(nollvm-mc/spirv-valinstalled on host): 3/3 PASS.python -I scripts/run_semantic_tests.py tests/semantic: 470 files, 6,168 tests, 0 files failed.python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/test_translate.py: exit 0 (no game data).GPUs tested: n/a (CPU SPIR-V interpreter semantic suite + in-process
spirv_asmassembly on Windows 11 Pro 64-bit, Python 3.12.10)AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (extends existing mesh shaderpos1export lowering)Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:07:52Z.
Recommendation: [MERGE]
Reasoning: Carries #162: mesh shaders decode
LayerandViewportIndexfrom theexp pos1misc export and write them as per-primitive outputs whenOSG1declares them. Focused translator change with a translate test. No independent GPU run yet, but the change only takes effect when the outputs are declared. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict withmain. Merge once the queued checks are green.Impact level: 4/10
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T03:12:47Z.
Merged, after merging
maininto it. Thanks.OLD-9893, valid, before this PR; the only claim for the item.docs/design.md. It states one open point as a hypothesis: each lane writes the primitive with its own index, which is exact when the value is the same for all vertices of a primitive; whether the hardware takes the provoking vertex's value instead is not measured.pos1writesLayerorViewportIndexunder this translation, so the game's mesh shaders only gain three unused declarations each.OLD-9921) depends on this; its one conflict with it, inmesh_export, is resolved next by keeping both: the misc-vector return first, then the compressed components.mainb07b9ecb0+e950f8582: the semantic suite passes (487 files, 6,279 tests, 0 files failed);test_translate (pytest; 2 failing as on main)pass; the 14 docs and writer tests pass;check_no_game_data.pyis clean on the 3 changed files.AI-assisted (Claude Code, Claude Opus 5.5).