Skip to content

make_game: translate the retail executable's own 10 shaders; the shader library loads <shaders>/exe - #8303

Closed
ramenbellic wants to merge 1 commit into
ProjectLeonida:mainfrom
ramenbellic:feat/exe-embedded-shaders
Closed

ramenbellic wants to merge 1 commit into
ProjectLeonida:mainfrom
ramenbellic:feat/exe-embedded-shaders

Conversation

@ramenbellic

@ramenbellic ramenbellic commented Nov 23, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue: #8186 (comment) (new BUILD item)

Depends on: none (applies to main).

Problem

On the boot chain past stop 20 (#7154), graphics CreatePipelineState calls fail with [rt] d3d12: no translated vs for FSSM sha256 …. The retail executable carries 10 shader containers of its own (1 vertex shader, 9 pixel shaders; docs/embedded_shaders.md, "Retail executable"). The tools already handle them (PSV0 stage, FSSM unpack, disassembly, translation), but no build step runs them and no index the runtime reads holds them.

Change

  • make_game.py: exe_shaders(), called in the shaders stage after bvh_shaders(). It mirrors bvh_shaders(): pe_shader_containers.py --extract → fssm_unpack.py → shader_disasm.py → rdna2spirv.py into <work>/shaders/exe and <work>/shaders/spirv/exe, with exe_build.json for reuse. Without the executable in the game folder, it drops a stale index, logs one line and returns.
  • runtime/src/shader_library.h: load() also reads <dir>/exe/index.json. Entries are named exe/<name> and found by (stage, fssm_sha256) like the game's own shaders. exe_size() counts them.
  • Tests: tests/test_exe_shaders_stage.py (7 tests, synthetic PSV0 containers, no game files), shader_library_test (vs and ps entries found by stage and hash, a broken exe/index.json leaves the other indexes loaded), and shader_library_corpus_test (keeps exe_size() out of the RPF count).
  • docs/embedded_shaders.md: the build step and the measured counts.

Tested

  • python -I tests/test_exe_shaders_stage.py: 7 OK. test_bvh_shaders_stage.py, test_fspx_shaders_stage.py, test_pe_shader_containers.py: OK. compileall and make_game.py --help: OK.
  • shader_library_test (native build): OK.
  • Own 1.0.2.1 copy, outcomes only: the new step finds 10 containers, and 10/10 unpack, disassemble, translate and pass spirv-val. None of the 10 (stage, hash) keys is in the main 26,503-entry index.
  • Retail boot under Proton (wine 11), RTX 3070, on the boot chain past stop 20 (ramenbellic:boot/retail-stack): the runtime loads 26,586 shaders instead of 26,576. no translated vs lines go from 14 to 0, and failed CreatePipelineState calls from 16 to 2.
  • Not run: the full CMake/ctest suite and the Windows build. Some tests/test_make_game_* and test_docs_* files fail on main as well (the same 14 failures with and without this change).

GAME_EXE is a constant, like BVH_DLL and FSPX_DLL; it is marked with a shortcut: comment. #8251 edits the same doc section (byte counts), so one of the two may need a small rebase.

AI-assisted (Claude Code, implementation by a Claude subagent, reviewed and boot-tested in the parent session).

🤖 Generated with Claude Code

…ary loads <shaders>/exe

The shaders stage now runs exe_shaders() after the BVH builder step: the same
pe_shader_containers / fssm_unpack / shader_disasm / rdna2spirv recipe on
game_scarlett_master.exe, into <work>/shaders/exe and <work>/shaders/spirv/exe,
with exe_build.json for reuse. A package without the executable skips the step
and drops an index left by an earlier run.

ShaderLibrary::load() reads <dir>/exe/index.json when it is there; the entries
go into the table of the game's shaders, so graphics pipelines find them by
(stage, fssm_sha256). exe_size() counts them and the corpus test leaves them out.

Measured on 1.0.2.1 with --wave64-emulate: 10 containers, 10 unpacked,
10 translated, 10 spirv-val valid (1 vs, 9 ps).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013puXaEnm3gXuUo4XsSt4g4
@Kev-Ball

Copy link
Copy Markdown

I checked the previous coordination threads before starting hardware QA. #7746 already implements this same executable extraction stage and runtime index lookup. Its original claim was at 17:21 UTC, before the 18:12 UTC claim for this PR.

One implementation detail worth carrying across is #7746’s fix in bc5fc47b9. At 6c887b514, a cached empty translation index with matching settings makes bvh_programs() return a truthy tuple containing the extracted programs and a missing list of the same length. The warm path returns there. On a fresh build the same result is rejected. The earlier PR includes a regression test for this and a verified fix.

The paired Proton boot counts in this PR would also be useful on #7746 if reproduced against that head. AI-assisted QA.

@skorex

skorex commented Nov 23, 2026

Copy link
Copy Markdown

Duplicate of #7746

#7746 makes the same change and was opened earlier. Topic: translating the retail executable's 10 embedded shaders in make_game (exe_shaders,

/exe/index.json, exe_size()).

Suggest closing this PR in favour of #7746, and porting anything this one adds that #7746 lacks there.

@ramenbellic

Copy link
Copy Markdown
Author

Closing as a duplicate of #7746 (same step and runtime change, opened earlier). My boot test of #7746's own branch is on that PR: it clears the 14 no translated vs failures on Proton. Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants