mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:30:53 +01:00
[PR #1073] [CLOSED] rdna2spirv: compact SPIR-V modules on request (SHADER-COMPACT-SPIRV) #1109
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1109
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1073
Author: @Moriz82
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:split/shader-compact-spirv📝 Commits (1)
363fed0rdna2spirv: compact SPIR-V modules on request (SHADER-COMPACT-SPIRV)📊 Changes
2 files changed (+4 additions, -0 deletions)
View changed files
📝
docs/design.md(+1 -0)📝
tests/test_make_game_translator_flags.py(+3 -0)📄 Description
Rebased onto
bfef489cat363fed0f. Main already exposes SPIR-V compaction. This diff adds the contract row and tests that the build command forwards the flag. The two focused suites ran 49 cases with five Windows-only skips.Claimed in the coordination issue as: SHADER-COMPACT-SPIRV (claim).
Part of the split of #984 into small pull requests.
Depends on: none
Overlaps: #984 is the parent integration. #544 changes the existing Python optimizer. The two options can run independently. A merge-tree check against #1068 also completed without conflicts.
What and why
The translator and shader build rejected
--compact-spirvon Linux. To try smaller modules, a developer had to run the optimizer separately and validate the result again. This adds the option to both entry points. It runs local load elimination, redundancy elimination and dead-code elimination on the assembled staging file before the normal validation and publication step. It preserves stage interfaces, descriptor bindings and specialization constants. Compaction is off by default. Only an opted-in build needsspirv-opt.A hand-written pixel program produced a 4,076-byte module by default and a 908-byte module with compaction. Both the Python assembler and
spirv-asproduced those sizes. All four outputs passed Vulkan 1.2 validation and had matching shader index metadata. This is a synthetic size comparison.Tested
Ran the compiler tests on Linux and cross-built the Windows runtime.
Applied only the two test additions to pristine main
32950551e, then ran the same commands on this child:python3 -I tests/test_native_tool_paths.py AssembleSpirv.test_compact_binary_before_publishcompactkeyword.python3 -I tests/test_make_game_translator_flags.py MainWiringTest.test_compact_spirv_reaches_the_shaders_stage--compact-spirv.python3 -I tests/test_native_tool_paths.pypython3 -I tests/test_make_game_translator_flags.pypython3 -I tests/test_run_gpu_tests_python_assembler.pypython3 -I scripts/run_semantic_tests.py tests/semantic -j 2python3 -I -m compileall -q make_game.py tools testspython3 -I <file>orpython3 -I -m pytest -q <file>tests/test_imhex_patterns.py. The same 6 of its 9 tests failed. Zero new failing files.python3 -I scripts/check_no_game_data.pycmake -S runtime -B runtime/build/bootandcmake --build runtime/build/boot --target gta6rt -j6On a second synthetic module,
spirv-disretained the location, descriptor set, binding and specialization ID after compaction, and the dead add disappeared. An optimizer failure took the existing rejection path and left zero stale modules or staging files. Withspirv-optabsent, the default CLI succeeded and the compact CLI reported the missing tool with exit code 2.GPUs tested: none. The tests ran on the CPU. Native Windows, Wine, AMD GPU and Intel GPU runs were not performed.
AI-assisted: yes
Checklist
32950551e. Merged cleanly in a temporary checkout of the newer3aa975421. The native tool paths, build flag and build destination suites ran 56 cases there, with 51 passes and five Windows-only skips.docs/design.md.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.