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

Closed
Andretuta wants to merge 1 commit from upstream-pr/303 into main
Andretuta commented 2026-11-24 03:04:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T03:04:40Z.


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).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465299338 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/303). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T03:04:40Z. --- > 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).
aslan2142 commented 2026-11-24 19:50:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T19:50:11Z.


Thanks for carrying this over. We're going with #387 (https://github.com/ubiquitarianism/leonida/pull/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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7142657205 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/303#issuecomment-7142657205). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T19:50:11Z. --- Thanks for carrying this over. We're going with #387 (https://github.com/ubiquitarianism/leonida/pull/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

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!303
No description provided.