mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:30:53 +01:00
[PR #194] [MERGED] runtime: build.py shader rules depend on every translator module (OLD-3752) #246
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#246
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/194
Author: @ItsMrDubey
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism
Base:
main← Head:cmake-spirv-translator-deps📝 Commits (1)
bc887c4runtime: the build.py shader rules rebuild when any translator module changes📊 Changes
3 files changed (+142 additions, -23 deletions)
View changed files
📝
runtime/CMakeLists.txt(+10 -23)➕
runtime/cmake/translator_deps.cmake(+31 -0)➕
tests/test_cmake_translator_deps.py(+101 -0)📄 Description
Claimed in the coordination issue as: OLD-3752 (BUILD-1064) (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7119646964)
What and why
Old #3752: the eight
add_custom_commandrules inruntime/CMakeLists.txtthat runruntime/test/shaders/build.py(M1.5, bindless, M2, M2 formats, M3, M4, buffer UAV and the four subgroup cases, 11 Ninja edges) listed onlybuild.py,compute_fixture.py(bindless didn't list even that),tools/rdna2spirv.pyand their.asmfiles. If you edited a module the translator imports (tools/spirv_asm.py,spirv_asm_tables.py,shader_ir.py,mc_command.py,spirv_opt.py,wave64_halves.py, ...), nothing was rebuilt, and the tests kept running the old SPIR-V.Fix:
runtime/cmake/translator_deps.cmakesetsLEONIDA_TRANSLATOR_DEPSonce. It holds build.py and compute_fixture.py, the tools scripts build.py runs (rdna2spirv.py, plusvk_subgroup_info.py, whose answer selects--bary-fallback), everything those scripts import transitively withintools/(function-level imports included), andtools/gfx10_formats.json, which rdna2spirv.py reads. CMakeLists.txt includes the file afterinclude(CTest), and every build.py rule now hasDEPENDS ${LEONIDA_TRANSLATOR_DEPS}followed by its.asmfiles. I used an explicit list because the repo doesn't glob sources.tests/test_cmake_translator_deps.py(new) fails if any of these drift:.pyentries must equal the import closure of build.py plus the tools scripts it names, computed withast, likeTranslationSourcesTestdoes formake_game.TRANSLATION_SOURCES.pyentries ofTRANSLATION_SOURCEScmake -Pmust resolve the list to files that exist (skipped without cmake)Tested
Windows 11, Python 3.11.9, CMake 4.4.5 (pip), Ninja 1.13.2, MSVC 14.29, no GPU needed.
python -I tests/test_cmake_translator_deps.py: 5 tests OK (cmake on PATH). On origin/main's CMakeLists, 1 test fails and 3 error. Ifspirv_asm_tables.pyis removed from the list, the closure and stale-helper tests fail.python -I tests/test_cmake_vulkan_missing.py: OK.python -I tests/test_shader_stage_resume.py TranslationSourcesTest: OK.python -I scripts/check_no_game_data.pyon all three files: clean.Real configure and Ninja build in a separate build dir. This machine has no llvm-mc, Vulkan SDK or full 10.0.26100 SDK, so I configured with:
vulkan/vulkan.hasVulkan_INCLUDE_DIRLEONIDA_SPIRV_AS/_VALpathsGTA6RT_SDK_HAS_ROOT_SIGNATURE_1_2=1presetPython3_EXECUTABLEset to a shim that hands build.py invocations to a stub that writes the same output files (everything else goes to the real Python).The CMake rules and the Ninja graph are the real ones; only the translation step is stubbed. I built
generated/bindless_shaders/spirv/vs_ids.spv(the edge with no compiled order-only deps), checked thatninja -nreports "no work to do", then touched each tools file and ranninja -nagain:ninja -t queryon all 11 translator outputs: 1 tools input each before (rdna2spirv.py), 20 after (19 modules + gfx10_formats.json).AI-assisted: yes
Checklist
docs/design.md.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.