[PR #387] make_game, runtime: the executable's embedded shaders are translated and loaded, again (RT-EXE-SHADERS) #439

Open
opened 2026-11-26 20:17:53 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/387
Author: @Mumogg
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: exe-shaders


📝 Commits (1)

  • 54bcd56 make_game, runtime: translate and load game_scarlett_master.exe embedded shaders

📊 Changes

6 files changed (+558 additions, -19 deletions)

View changed files

📝 docs/embedded_shaders.md (+20 -8)
📝 make_game.py (+84 -1)
📝 runtime/src/shader_library.h (+14 -6)
📝 runtime/test/shader_library_corpus_test.cpp (+4 -4)
📝 runtime/test/shader_library_test.cpp (+60 -0)
➕ tests/test_exe_shaders_stage.py (+376 -0)

📄 Description

Claimed in #14 as RT-EXE-SHADERS. Independent of my other open pull requests: it is based on main alone.

What and why

The retail executable carries a few shaders of its own (FSSM programs in DXIL containers, docs/embedded_shaders.md). At startup the title creates six pipelines from them. On main nothing translates them and the runtime's shader library does not look for them, so each creation fails with no translated vs for FSSM sha256 ....

Commit ab03d8dd1 by Faterek (-x, authorship kept; an ancestor of main whose content is not in the tree) does both halves:

  • make_game.py: an exe_shaders step in the shaders stage carves, unpacks, disassembles and translates the executable's containers into <work>/shaders/spirv/exe, after the BVH builder's.
  • runtime/src/shader_library.h: load() also reads <dir>/exe/index.json; its entries are named exe/<name>, found by fssm_sha256 like the game's own shaders, and counted by exe_size().

Adapted to main, as the commit message says: the exe folder is loaded after main's library folder (#19), shaders() calls exe_shaders after library_shaders, and the test's fake FSPX index carries fspx_code_sha256, which fspx_cache_complete needs now.

Overlap with #303: that draft carries tedin7's later version of the build half (old PR 10036) with its own tests/test_exe_shaders_stage.py. It does not have the runtime half. The two cannot both land as they are: if #303 is preferred for make_game.py, I will cut this down to the shader_library.h change and its tests. I took the one fix this copy of the test needed from that newer copy.

Measured

Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off. The boot run is on main ece4ba5b3 with my stacked pull requests up to #385 and with #142, #219 and #328, because the pipelines are only reached that far in; the work folder already held the translated exe folder (13 files) from an earlier build of the same step.

--run ID3D12Device2::CreatePipelineState
without this 6 failed
with this 6 ok

The run then goes on as before, to command-queue slot 35 being refused.

Tests, all without game files:

  • python -I tests/test_exe_shaders_stage.py: 10 tests, OK. tests/test_library_shaders_stage.py and tests/test_bvh_shaders_stage.py: OK. python -m compileall -q make_game.py tools tests: clean.
  • shader_library_test under Wine: passes, with the commit's exe folder case (entries found by FSSM hash, the main index first when both hold a program, a broken or missing exe/index.json leaves the others loaded).

Not run here: the exe_shaders step itself against my copy on this tree (the measurement above uses the folder an earlier build made), MSVC, Windows.

AI-assisted (Claude Code); built and run on the machine above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/387 **Author:** [@Mumogg](https://github.com/Mumogg) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `exe-shaders` --- ### 📝 Commits (1) - [`54bcd56`](https://github.com/ubiquitarianism/leonida/commit/54bcd56900723e3cf3e46d87dd14d90a5a0845bd) make_game, runtime: translate and load game_scarlett_master.exe embedded shaders ### 📊 Changes **6 files changed** (+558 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `docs/embedded_shaders.md` (+20 -8) 📝 `make_game.py` (+84 -1) 📝 `runtime/src/shader_library.h` (+14 -6) 📝 `runtime/test/shader_library_corpus_test.cpp` (+4 -4) 📝 `runtime/test/shader_library_test.cpp` (+60 -0) ➕ `tests/test_exe_shaders_stage.py` (+376 -0) </details> ### 📄 Description Claimed in #14 as `RT-EXE-SHADERS`. Independent of my other open pull requests: it is based on `main` alone. ### What and why The retail executable carries a few shaders of its own (FSSM programs in DXIL containers, `docs/embedded_shaders.md`). At startup the title creates six pipelines from them. On `main` nothing translates them and the runtime's shader library does not look for them, so each creation fails with `no translated vs for FSSM sha256 ...`. Commit `ab03d8dd1` by Faterek (`-x`, authorship kept; an ancestor of `main` whose content is not in the tree) does both halves: - `make_game.py`: an `exe_shaders` step in the shaders stage carves, unpacks, disassembles and translates the executable's containers into `<work>/shaders/spirv/exe`, after the BVH builder's. - `runtime/src/shader_library.h`: `load()` also reads `<dir>/exe/index.json`; its entries are named `exe/<name>`, found by `fssm_sha256` like the game's own shaders, and counted by `exe_size()`. Adapted to `main`, as the commit message says: the `exe` folder is loaded after `main`'s `library` folder (#19), `shaders()` calls `exe_shaders` after `library_shaders`, and the test's fake FSPX index carries `fspx_code_sha256`, which `fspx_cache_complete` needs now. **Overlap with #303**: that draft carries tedin7's later version of the build half (old PR 10036) with its own `tests/test_exe_shaders_stage.py`. It does not have the runtime half. The two cannot both land as they are: if #303 is preferred for `make_game.py`, I will cut this down to the `shader_library.h` change and its tests. I took the one fix this copy of the test needed from that newer copy. ### Measured Linux (Nobara 44, kernel 7.3), Wine 11.21 staging, RTX 5070 Ti (driver 615.78.08), clang-cl 22.1.8 + xwin SDK 10.0.26100, own 1.0.2.1 copy, network off. The boot run is on `main` `ece4ba5b3` with my stacked pull requests up to #385 and with #142, #219 and #328, because the pipelines are only reached that far in; the work folder already held the translated `exe` folder (13 files) from an earlier build of the same step. | `--run` | `ID3D12Device2::CreatePipelineState` | |---|---| | without this | 6 failed | | with this | 6 ok | The run then goes on as before, to command-queue slot 35 being refused. Tests, all without game files: - `python -I tests/test_exe_shaders_stage.py`: 10 tests, OK. `tests/test_library_shaders_stage.py` and `tests/test_bvh_shaders_stage.py`: OK. `python -m compileall -q make_game.py tools tests`: clean. - `shader_library_test` under Wine: passes, with the commit's `exe` folder case (entries found by FSSM hash, the main index first when both hold a program, a broken or missing `exe/index.json` leaves the others loaded). Not run here: the `exe_shaders` step itself against my copy on this tree (the measurement above uses the folder an earlier build made), MSVC, Windows. AI-assisted (Claude Code); built and run on the machine above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#439
No description provided.