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

Open
github-bot wants to merge 1 commit from github-bot/gh-387 into main AGit
Owner

@⁠Mumogg on GitHub · 2026-11-24 04:22 UTC · original
Mumogg:exe-shaders → main · +558 −19 · 6 files · 1 commits · open

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

**@⁠Mumogg** on GitHub · 2026-11-24 04:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/387) `Mumogg:exe-shaders` → `main` · +558 −19 · 6 files · 1 commits · open 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
(cherry picked from commit ab03d8dd12)

Adapted to main by Mumogg: the exe folder is loaded after main's library folder, shaders() calls exe_shaders
after library_shaders, and the test's fake FSPX index carries fspx_code_sha256, which fspx_cache_complete now
needs (as the newer copy of this test in old PR 10036 does).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:57:07 +00:00
Author
Owner

@⁠Snooozs on GitHub · 2026-11-24 17:21 UTC · original

This still merges cleanly, but its own test is red on current main (a merge without a textual conflict). Merged onto main 32950551e:

python -I tests/test_exe_shaders_stage.py
Ran 10 tests ... FAILED (errors=1)   test_exe_runs_after_bvh_and_alone_when_only_the_exe_changes
make_game.py:1369 native_pso_hashes -> tools/native_pso_hashes.py:49 json.decoder.JSONDecodeError
ERROR: shaders: could not index native graphics pipelines: Expecting value: line 1 column 1 (char 0)

The PR head alone passes (10 OK). main's shaders() now runs native_pso_hashes, which reads <spirv>/index.json, and this test's fake_translate writes an empty file there. tests/test_bvh_shaders_stage.py already writes a valid index in the same place. The same line here makes all 10 pass on the merged tree:

             def fake_translate(disasm, spirv, jobs, emulate=False, fallbacks=()):
                 ran.append("translate")
-                write("", spirv, "index.json")
+                write('{"shader": {"stage": "vs"}}', spirv, "index.json")

On the merged tree shader_library_test (rebuilt), tests/test_bvh_shaders_stage.py (13) and tests/test_make_game_preflight.py (98, 2 skipped) pass.

Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo, CPython 3.12.10, no game files, so the real executable step was not run. AI-assisted (Claude Code): I read the code diff and ran this on that machine.

**@⁠Snooozs** on GitHub · 2026-11-24 17:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/387#issuecomment-7139063166) This still merges cleanly, but its own test is red on current `main` (a merge without a textual conflict). Merged onto `main` 32950551e: ``` python -I tests/test_exe_shaders_stage.py Ran 10 tests ... FAILED (errors=1) test_exe_runs_after_bvh_and_alone_when_only_the_exe_changes make_game.py:1369 native_pso_hashes -> tools/native_pso_hashes.py:49 json.decoder.JSONDecodeError ERROR: shaders: could not index native graphics pipelines: Expecting value: line 1 column 1 (char 0) ``` The PR head alone passes (10 OK). `main`'s `shaders()` now runs `native_pso_hashes`, which reads `<spirv>/index.json`, and this test's `fake_translate` writes an empty file there. `tests/test_bvh_shaders_stage.py` already writes a valid index in the same place. The same line here makes all 10 pass on the merged tree: ```diff def fake_translate(disasm, spirv, jobs, emulate=False, fallbacks=()): ran.append("translate") - write("", spirv, "index.json") + write('{"shader": {"stage": "vs"}}', spirv, "index.json") ``` On the merged tree `shader_library_test` (rebuilt), `tests/test_bvh_shaders_stage.py` (13) and `tests/test_make_game_preflight.py` (98, 2 skipped) pass. Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo, CPython 3.12.10, no game files, so the real executable step was not run. AI-assisted (Claude Code): I read the code diff and ran this on that machine.
Author
Owner

@⁠slauko on GitHub · 2026-11-25 07:49 UTC · original

Retail Wine data point: the executable's VS is missing, three PSOs fail, the boot continues

Build: main 42537e7b6 + the SDL3 artifact line (head f81cf9092), Wine 11.17, RTX 3080 Ti (595.112.07), retail 1.0.2.1, 26,555-program corpus (no exe/index.json).

The boot asks for FSSM sha256 01ac7810dcabd62afcd904b231e90d9a031a51808a700e3349290bec5f0d426f (VS), and three CreatePipelineState calls fail with no translated vs; the title continues to 129,459 D3D12 calls and 1,472 presents, so this is not the fatal stop on this run, but the frame-content gap is there. The exe_shaders stage in this PR is what supplies it.

The PR is currently CONFLICTING; a rebase plus a run with the stage would let a Wine boot confirm the frame side. Counts and call shapes only, no game data. AI-assisted.

**@⁠slauko** on GitHub · 2026-11-25 07:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/387#issuecomment-7156292864) **Retail Wine data point: the executable's VS is missing, three PSOs fail, the boot continues** Build: `main` `42537e7b6` + the SDL3 artifact line (head `f81cf9092`), Wine 11.17, RTX 3080 Ti (595.112.07), retail 1.0.2.1, 26,555-program corpus (no `exe/index.json`). The boot asks for `FSSM sha256 01ac7810dcabd62afcd904b231e90d9a031a51808a700e3349290bec5f0d426f` (VS), and three `CreatePipelineState` calls fail with `no translated vs`; the title continues to **129,459 D3D12 calls and 1,472 presents**, so this is not the fatal stop on this run, but the frame-content gap is there. The `exe_shaders` stage in this PR is what supplies it. The PR is currently CONFLICTING; a rebase plus a run with the stage would let a Wine boot confirm the frame side. Counts and call shapes only, no game data. AI-assisted.
Author
Owner

@⁠slauko on GitHub · 2026-11-25 08:55 UTC · original

Frame-content data point under Wine: the first-run account-selection page renders its labels, but the artwork/background is black

Build: main 42537e7b6 + the SDL3 artifact line + #1558 (Wine 11.17, RTX 3080 Ti / NVIDIA 595.112.07, retail 1.0.2.1, 26,555-program corpus without exe/index.json).

The boot reaches the first-run account-selection page after ~300 s (29,354 presents, no exception): the page's labels and navigation arrows render, the background/artwork area is black. The log has 20 no translated vs lines for the executable's embedded VS and several CreatePipelineState failures. The exe_shaders stage in this PR is the missing half; it is not fatal (the page is usable with input), but it is a visible frame gap.

The PR is CONFLICTING; a rebase plus this stage would let a Wine boot confirm the artwork. Counts and call shapes only, no game data. AI-assisted.

**@⁠slauko** on GitHub · 2026-11-25 08:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/387#issuecomment-7157647768) **Frame-content data point under Wine: the first-run account-selection page renders its labels, but the artwork/background is black** Build: `main` `42537e7b6` + the SDL3 artifact line + #1558 (Wine 11.17, RTX 3080 Ti / NVIDIA 595.112.07, retail 1.0.2.1, 26,555-program corpus without `exe/index.json`). The boot reaches the first-run account-selection page after ~300 s (29,354 presents, no exception): the page's labels and navigation arrows render, the background/artwork area is black. The log has 20 `no translated vs` lines for the executable's embedded VS and several `CreatePipelineState` failures. The `exe_shaders` stage in this PR is the missing half; it is not fatal (the page is usable with input), but it is a visible frame gap. The PR is CONFLICTING; a rebase plus this stage would let a Wine boot confirm the artwork. Counts and call shapes only, no game data. AI-assisted.
Author
Owner

@⁠plamea on GitHub · 2026-11-26 14:55 UTC · original

Windows / RTX 3050 Laptop GPU data point for the embedded executable shaders

I ran the standalone make_game.exe_shaders() step on main at fbf100b1b with the 1.0.2.1 executable and wave64 emulation enabled. All 12 embedded programs (1 VS, 11 PS, including both packed PS) translated and passed spirv-val. vk_pipeline_check created 12/12 modules and 12/12 test pipelines with zero failures or skips on an NVIDIA GeForce RTX 3050 Laptop GPU, driver 621.24, on Windows 11. The checker used driver subgroups of 32. The checker binary came from my preceding local build based on a73a57e13.

python -I tests/test_exe_shaders_stage.py passed 11/11 on fbf100b1b. This covers the standalone translation step and the checker's Vulkan pipelines. Retail frame output remains unverified on this host.

AI-assisted (Codex).

**@⁠plamea** on GitHub · 2026-11-26 14:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/387#issuecomment-7195520921) **Windows / RTX 3050 Laptop GPU data point for the embedded executable shaders** I ran the standalone `make_game.exe_shaders()` step on `main` at `fbf100b1b` with the 1.0.2.1 executable and wave64 emulation enabled. All 12 embedded programs (1 VS, 11 PS, including both packed PS) translated and passed `spirv-val`. `vk_pipeline_check` created 12/12 modules and 12/12 test pipelines with zero failures or skips on an NVIDIA GeForce RTX 3050 Laptop GPU, driver 621.24, on Windows 11. The checker used driver subgroups of 32. The checker binary came from my preceding local build based on `a73a57e13`. `python -I tests/test_exe_shaders_stage.py` passed 11/11 on `fbf100b1b`. This covers the standalone translation step and the checker's Vulkan pipelines. Retail frame output remains unverified on this host. AI-assisted (Codex).
This pull request has changes conflicting with the target branch.
  • docs/embedded_shaders.md
  • make_game.py
  • runtime/src/shader_library.h
  • runtime/test/shader_library_corpus_test.cpp
  • runtime/test/shader_library_test.cpp
  • tests/test_exe_shaders_stage.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/387/head:github-bot/gh-387'
git switch 'github-bot/gh-387'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-387'
git switch 'github-bot/gh-387'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-387'
git switch 'github-bot/gh-387'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-387'
git switch 'main'
git merge --squash 'github-bot/gh-387'
git switch 'main'
git merge --ff-only 'github-bot/gh-387'
git switch 'main'
git merge 'github-bot/gh-387'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.