rdna2spirv: mesh shader compressed exports unpack f16 pairs instead of failing (OLD-9921) #1203

Manually merged
github merged 4 commits from gh-pr/1203/head into gh-pr/1203/base 2026-11-26 09:42:46 +00:00
Owner

@⁠ambroseautomation on GitHub · 2026-11-24 20:11 UTC · original
ambroseautomation:carry/old-9921-ms-compressed-exports → main · +94 −37 · 3 files · 4 commits · merged 2026-11-25 03:16 UTC

Claimed in the coordination issue as: OLD-9921 (#14)

Depends on: #1197

What and why

Carries forward old-pr/9921 (draft #189, original commit author tedin7 preserved; indexed in #17), rebased cleanly onto current main.

Fixes mesh shader compressed exports (exp pos1/param ... compr) in tools/rdna2spirv.py so they unpack their f16 pairs instead of raising Unsupported("mesh compressed export"):

  • Extracts shared Gen.export_comps(a, ins) from Gen.export and reuses it in Gen.mesh_export for pos1+, pos0, and param* exports, unpacking each f16 pair register via OpExtInst %v2float %glsl UnpackHalf2x16 and preserving off slots as None.
  • Adds 4 unit tests in tests/test_translate.py: test_ms_compressed_pos1_clip_export_unpacks_f16_pairs, test_ms_compressed_pos1_clip_export_off_register_writes_nothing, test_ms_compressed_param_export_unpacks_f16_pairs, and test_ms_uncompressed_exports_do_not_unpack_halves.

Tested

  • Executed all 4 new tests/test_translate.py functions directly via rdna2spirv.translate and verified SPIR-V binary assembly via spirv_asm.assemble (no llvm-mc/spirv-val installed on host): 4/4 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_asm assembly on Windows 11 Pro 64-bit, Python 3.12.10)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (extends existing compressed export f16 unpacking to mesh stage)
**@⁠ambroseautomation** on GitHub · 2026-11-24 20:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1203) `ambroseautomation:carry/old-9921-ms-compressed-exports` → `main` · +94 −37 · 3 files · 4 commits · merged 2026-11-25 03:16 UTC Claimed in the coordination issue as: OLD-9921 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) Depends on: #1197 ### What and why Carries forward `old-pr/9921` (draft #189, original commit author `tedin7` preserved; indexed in #17), rebased cleanly onto current `main`. Fixes mesh shader compressed exports (`exp pos1/param ... compr`) in `tools/rdna2spirv.py` so they unpack their f16 pairs instead of raising `Unsupported("mesh compressed export")`: - Extracts shared `Gen.export_comps(a, ins)` from `Gen.export` and reuses it in `Gen.mesh_export` for `pos1+`, `pos0`, and `param*` exports, unpacking each f16 pair register via `OpExtInst %v2float %glsl UnpackHalf2x16` and preserving `off` slots as `None`. - Adds 4 unit tests in `tests/test_translate.py`: `test_ms_compressed_pos1_clip_export_unpacks_f16_pairs`, `test_ms_compressed_pos1_clip_export_off_register_writes_nothing`, `test_ms_compressed_param_export_unpacks_f16_pairs`, and `test_ms_uncompressed_exports_do_not_unpack_halves`. ### Tested - Executed all 4 new `tests/test_translate.py` functions directly via `rdna2spirv.translate` and verified SPIR-V binary assembly via `spirv_asm.assemble` (no `llvm-mc`/`spirv-val` installed on host): 4/4 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_asm` assembly on Windows 11 Pro 64-bit, Python 3.12.10) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (extends existing compressed export f16 unpacking to mesh stage)
Add the rule this pull request introduces to the "Mesh shaders" row of
docs/design.md: compressed exports unpack their two f16 pairs the way the
pixel-shader compressed export does (operands 1 and 3, UnpackHalf2x16), an
"off" register leaves its components unwritten, it was refused before, and
it is confirmed by the translator tests. None of the 9,282 mesh shaders of
the maintainer's shader corpus uses one, so the game's translation does not
change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The "Mesh shaders" row of docs/design.md changed on main (#802); the
compressed-export sentence is added to main's version of the row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- tools/rdna2spirv.py, mesh_export: #1197's misc-vector return for pos1
  (Layer/ViewportIndex) comes first, then this pull request's compressed
  components; both kept.
- docs/design.md, "Mesh shaders" row: main's row (with #1197's sentence)
  plus this pull request's compressed-export sentence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:42:44 +00:00
github manually merged commit 275cb01456 into gh-pr/1203/base 2026-11-26 09:42:46 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 03:16 UTC · original

Merged, after #1197 as the description asked. Thanks.

  • Claim: OLD-9921, valid, before this PR; the only claim for the item.
  • Added before merging:
    • the contract row for the rule, in the "Mesh shaders" row of docs/design.md;
    • two merges of main. The second resolves the one conflict with #1197 in mesh_export by keeping both: #1197's misc-vector return for pos1 first, then the compressed components.
  • On the maintainer's own shader corpus (counts only): none of the 9,282 mesh shaders uses a compressed export, so the game's translation does not change.
  • tests/test_translate.py on the merge: 705 pass; the 2 failures (cs_dpp_cmp.asm) are the same on main.
  • Checked on main 1cfc29af7 + 275cb0145: 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.py is clean on the 3 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-25 03:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1203#issuecomment-7151766535) Merged, after #1197 as the description asked. Thanks. - **Claim:** `OLD-9921`, valid, before this PR; the only claim for the item. - **Added before merging:** - the contract row for the rule, in the "Mesh shaders" row of `docs/design.md`; - two merges of `main`. The second resolves the one conflict with #1197 in `mesh_export` by keeping both: #1197's misc-vector return for `pos1` first, then the compressed components. - **On the maintainer's own shader corpus (counts only):** none of the 9,282 mesh shaders uses a compressed export, so the game's translation does not change. - **`tests/test_translate.py` on the merge:** 705 pass; the 2 failures (`cs_dpp_cmp.asm`) are the same on `main`. - **Checked on `main` `1cfc29af7` + `275cb0145`:** 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.py` is clean on the 3 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.