make_game: extract and translate the retail executable's 10 embedded shaders (exe stage) #303

Closed
github-bot wants to merge 1 commit from gh-pr/303/head into gh-pr/303/base
Owner

@⁠Andretuta on GitHub · 2026-11-24 03:04 UTC · original
ubiquitarianism:old-pr/10036 → main · +480 −2 · 4 files · 1 commits · closed without merging

Carried over from old PR 10036 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10036, 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):

@ItsNotRexed: an exe PR, as you asked.

Rebased cleanly on current main; supersedes #7746 and #8303 closed during org migration (Python half only).

What

  • make_game.py: new exe_shaders() step in the shaders stage, after bvh_shaders(). It extracts the 10 DXBC containers embedded in game_scarlett_master.exe (1 VS + 9 PS) into /shaders/exe, unpacks and disassembles the FSSM programs, translates them into /shaders/spirv/exe, and writes exe/index.json plus exe_build.json (inputs, so a second run is skipped). It skips cleanly, and drops stale output, when there is no executable.
  • docs/embedded_shaders.md: section 2 describes the step.
  • tests/test_exe_shaders_stage.py: 11 tests on synthetic PSV0 containers, no game data, including a run of the real tools.
  • tests/test_bvh_shaders_stage.py: the fake FSPX index in the stage-order test now carries fspx_code_sha256, which fspx_cache_complete requires. That test already failed on main.

Why

The retail boot has an untranslated vertex shader that is one of the executable's 10 embedded shaders. Nothing in the build produced them.

Not in this PR

The runtime change (ShaderLibrary::load reading /exe) is C++ and is not included; docs say so.

Tested

  • python3 -I -m pytest tests/test_exe_shaders_stage.py tests/test_bvh_shaders_stage.py tests/test_make_game*.py: 447 passed, 4 skipped.
  • docs link, path and repeated-line tests: 23 passed with the exe tests.
  • Negative control: on origin/main, test_exe_shaders_stage.py gives 11 failed; test_bvh_shaders_stage.py gives 1 failed (fixed here).
**@⁠Andretuta** on GitHub · 2026-11-24 03:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/303) `ubiquitarianism:old-pr/10036` → `main` · +480 −2 · 4 files · 1 commits · closed without merging > Carried over from **old PR 10036** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10036`, 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): `@ItsNotRexed`: an exe PR, as you asked. Rebased cleanly on current main; supersedes `#7746` and `#8303` closed during org migration (Python half only). ## What - make_game.py: new `exe_shaders()` step in the `shaders` stage, after `bvh_shaders()`. It extracts the 10 DXBC containers embedded in game_scarlett_master.exe (1 VS + 9 PS) into <work>/shaders/exe, unpacks and disassembles the FSSM programs, translates them into <work>/shaders/spirv/exe, and writes exe/index.json plus exe_build.json (inputs, so a second run is skipped). It skips cleanly, and drops stale output, when there is no executable. - docs/embedded_shaders.md: section 2 describes the step. - tests/test_exe_shaders_stage.py: 11 tests on synthetic PSV0 containers, no game data, including a run of the real tools. - tests/test_bvh_shaders_stage.py: the fake FSPX index in the stage-order test now carries fspx_code_sha256, which fspx_cache_complete requires. That test already failed on main. ## Why The retail boot has an untranslated vertex shader that is one of the executable's 10 embedded shaders. Nothing in the build produced them. ## Not in this PR The runtime change (ShaderLibrary::load reading <shaders>/exe) is C++ and is not included; docs say so. ## Tested - python3 -I -m pytest tests/test_exe_shaders_stage.py tests/test_bvh_shaders_stage.py tests/test_make_game*.py: 447 passed, 4 skipped. - docs link, path and repeated-line tests: 23 passed with the exe tests. - Negative control: on origin/main, test_exe_shaders_stage.py gives 11 failed; test_bvh_shaders_stage.py gives 1 failed (fixed here).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:52:38 +00:00
github-bot closed this pull request 2026-11-26 08:52:38 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-24 19:50 UTC · original

Thanks for carrying this over. We're going with #387 (#387) for the executable's embedded shaders, so I'm closing this one.

  • #387 has the same exe_shaders() build step and also adds the runtime half: ShaderLibrary::load reads <shaders>/exe/index.json, with a shader_library_test case. Without that half the translated modules aren't used.
  • This branch now conflicts with main in make_game.py (library_shaders()) and tests/test_bvh_shaders_stage.py, whose fix is already on main.
  • Your stricter reuse check (len(programs[1]) < len(programs[0])) and test_empty_cached_index_is_rebuilt are worth keeping. Both are worth adding to #387, with credit to old PR 10036.
  • tedin7: if you'd like to follow up on the same reuse guard in bvh_shaders(), please post it in the coordination issue.

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

**@⁠aslan2142** on GitHub · 2026-11-24 19:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/303#issuecomment-7142657205) Thanks for carrying this over. We're going with #387 (https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/387) for the executable's embedded shaders, so I'm closing this one. - #387 has the same `exe_shaders()` build step and also adds the runtime half: `ShaderLibrary::load` reads `<shaders>/exe/index.json`, with a `shader_library_test` case. Without that half the translated modules aren't used. - This branch now conflicts with `main` in `make_game.py` (`library_shaders()`) and `tests/test_bvh_shaders_stage.py`, whose fix is already on `main`. - Your stricter reuse check (`len(programs[1]) < len(programs[0])`) and `test_empty_cached_index_is_rebuilt` are worth keeping. Both are worth adding to #387, with credit to old PR 10036. - `tedin7`: if you'd like to follow up on the same reuse guard in `bvh_shaders()`, please post it in the coordination issue. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.