Repository navigation
shaders: translate the pipeline library's compute pipelines, which the executable creates with slot 67 (RT-5) - #7529
gookie-dev wants to merge 1 commit into
Conversation
…e executable creates with slot 67 (RT-5) The retail executable calls Xbox device slot 67 (DeserializeComputePipelineStateX) itself during boot, and every call fails with "no translated compute shader": the build only translates the FidelityFX DLL's 29 FSPX programs. The programs come from the pipeline library in shaders.rpf (docs/shader_library.md), which the title reads through DirectStorage zlib requests: a compute record's state blob, blob, program and layout blob are FSPX kinds 0, 1, 6 and 7, the four pairs of the slot-67 description. - tools/shader_library.py writes each compute program's record state blob as fspx/<name>.state, so the index gets fspx_state_sha256 (slot 67 always passes kind 0). In 1.0.2.1 each of the 2,684 compute programs has one. - make_game.py's shaders stage gets library_shaders(): shader_library.py --stages cs --disasm --carve into <work>/shaders/library, rdna2spirv.py into <work>/shaders/spirv/library, with the stage's wave64 and fallback flags, the FSPX step's key-clash check and its own library_build.json for reuse. - ShaderLibrary::load also reads <dir>/library/index.json; its entries are found by the same two keys. Tests: test_library_shaders_stage.py (tool calls, reuse, invalidation, empty index, key clash), test_shader_library.py (.state contents and both keys), shader_library_test (library entries found by code and state key, a broken or missing index leaves the others).
|
Independent Windows + MSVC/Python review and test of Setup: Windows 11 Pro ( Tests run (synthetic only):
Code notes:
AI-assisted review and test. |
|
Confirmed the earlier stale-output note with a synthetic reproducer on b93ffa5, Windows x64 CPython 3.12.10. I used the existing LibraryStage mocks to build a translated index, then reused the same work directory with a separate empty game directory. library_shaders ran no tools and left both library/index.json and library_build.json byte-identical. The stock 6 stage tests and 10 shader-library tests pass; the existing missing-archive test starts with an empty work directory, so it does not cover this reuse case. A follow-up regression can seed the old output before invoking the stage without the archive. AI-assisted testing; no game files. |
|
I confirmed the minimal fix locally on b93ffa5: call drop(translated, settings_file) in the missing-archive branch of library_shaders, matching bvh_shaders. The new synthetic regression populates a work directory, switches to an empty game directory, and asserts no tool calls and no old index or build marker. It failed on the unmodified PR, then passed with the one-line fix. Windows CPython 3.12.10: library stage 7/7, shader library 10/10, FSPX stage 22/22. AI-assisted testing; no game data. |
|
Hit counts from a retail boot integration run, as you asked. Linux, Wine 11.21, clang-cl + xwin, GTX 1650 Mobile, own 1.0.2.1 copy. The tree is
So the lookup works with both keys on the retail payloads. What's left at slot 67 here is translator coverage, mostly AI-assisted (Claude Code). Counts and tool reason names only; no game files, hashes or addresses. |
|
Tested b93ffa5 with my own 1.0.2.1 copy on Arch Linux (kernel 6.18), Python 3.14.10, llvm-mc 23.1.5, SPIRV-Tools v2026.4, NVIDIA GeForce GTX 1660 (Turing, subgroups 32..32, driver 620.73.04): the step works end to end, with full-corpus counts and a retail hit count below.
Retail run (Wine 11.22, Not run: the PR's unit tests and AI-assisted run (Claude). Counts only; nothing from the game leaves this machine. |
Adapt the translator change from ItsNotRexed#7165 to ItsNotRexed#7529 while preserving the FSSM/FSPX dispatch metadata lookup. AI-assisted integration and verification.
|
Tested b93ffa5 on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass. Ran the test files this PR adds or changes, from a clean checkout of the PR head: AI-assisted (Claude Code). |
|
Independent retail check, Windows 11 x64 / MSVC 19.44 / RTX 5070 Ti (621.24). Ran the library-only stage at |
|
Independent Windows / RTX 2060 check for #7529. I compared b93ffa5 as-is with a local integration of the translator hunk from #7165, preserving #7529's shared FSSM/FSPX dispatch-state lookup. Same 2,684 compute-library programs, LLVM MC 23.1.5, SPIRV-Tools 2026.4, Python assembler and --wave64-emulate.
The integration is a comparison fixture. #6446 is the active TG_SIZE_EN implementation and additionally covers the first-wave bit. Integration source: hah346@95c2aab. AI-assisted. Counts and original source changes only. |
|
Retail A/B on the same local Wine 11.22 / RTX 5070 Ti (NVIDIA 620.73.04) runtime, offline, Xbox Series 1.0.2.1.
Both stage unit suites pass (6 and 11 tests). Counts and outcomes only. AI-assisted (Codex). |
|
checked: A38 #7529b93ffa5 | base: direct parent Result: 16/16 Python tests and the native library test passed. With identical synthetic compute code in two different dispatch states, the parent loaded no library FSPX entries. The PR emits two modules, selects the LocalSize 64 or 128 module through the state-aware lookup, rejects an unseen state, and reports the code-only lookup as ambiguous. Both selected modules passed external Vulkan 1.2 validation and ran on the RTX. All 192 output words matched expected results and all 96 guard words stayed intact. A second unchanged build preserved the index. Synthetic inputs only. agent: yes |
|
checked: #7529 | with: merge of PR head onto main, then
AI-assisted. |
|
✅ Automated security review: CLEAN (commit
Scope: static analysis of added diff lines only; no code was executed. Please review findings manually. |
|
tried: local boot-chain stack with a #7529-style library index already built (1,776 programs, every entry carries fspx_state_sha256) | for: the library programs the title still requests at boot | base: main@867d922f0 + local PresentX/graphics stack | on: Windows 11, RTX 5080, 32.0.16.1714 | result: slot 67 still fails on 814 distinct library programs (828 calls in a 30 s run, 900 in 180 s); the state key is not the gap, every translated entry has it. Re-disassembling the 814 with the pure-Python decoder and retranslating gave 0/814 (same classes). An env-gated bypass of the listing round-trip check ("the blob holds ..., LLVM printed ... (a field the disassembler dropped)") translated 23/814 (all 23 pass spirv-val); adding those 23 to the local library index cut slot-67 failures from 828 to 301 in the same 30 s run, so the missing programs are reused across states | next: the remaining 791 need translator coverage, dominated by |
|
Retail check of On: Windows 11 Pro 26300, RX 9070 XT (AMD 26.11.2), Ryzen 7 9700X, MSVC 19.44 RelWithDebInfo, Library step ( Retail run, 60 s each, the same stack before and after merging this PR and adding the translated
The accepted programs create their compute pipelines on the AMD driver without a failure. The frame loop does not dispatch compute yet at this point (0 No game data. AI-assisted: yes |
|
checked: A/B of the 23 trust-translated library programs, same build and flags | with: two 30 s |
…px_gfx for slot 57 Completes the WIP commit before it. The executable creates its graphics pipelines with Xbox device slot 57 (DeserializeGraphicsPipelineStateX, ItsNotRexed#8890) and passes each record's programs as bare kind-6 bytes; the runtime looks them up by sha256(program bytes) in <shaders>/fspx_gfx/index.json, which nothing generated. - make_game.py's shaders stage gets library_graphics_shaders() after ItsNotRexed#7529's compute step: shader_library.py --stages ps,vs,ms --disasm --carve into <work>/shaders/library_gfx, then rdna2spirv.py with one --shard per job (translate()) into <work>/shaders/spirv/fspx_gfx, with the stage's --wave64-emulate and fallback flags. - Each index entry keeps stage and fspx_code_sha256 (the program's table bytes, what slot 57 passes) and gets "spv", which ShaderLibrary reads under the folder prefix as fspx_gfx/<name>.spv. No fspx_state_sha256: slot 57 passes no kind 0, so two programs with the same bytes and different modules fail the step. - The carve is required (pixel and mesh programs need their source container's signatures). The step reruns whole when shaders.rpf, the tools, llvm-mc, the wave64 mode, the flags or the stages change (fspx_gfx_build.json, written last), and prints the translated count per stage on every run. Tests: tests/test_library_gfx_shaders_stage.py (tool calls, index format, reuse, invalidation, stale outputs and shard plan, empty result, key clash, and the code key on a hand-built library through the real shader_library.py). Measured on the 1.0.2.1 package: 14,159 of 18,837 programs translate (docs/shader_library.md). AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
checked: #7529b93ffa5 | on: Arch Linux, Wine 11.18, RX 7900 XT / RADV Mesa 26.2.3, clang-cl 23.1.6 + xwin | result: controlled library-loader comparison reduces slot-67 failures from 42 calls / 39 distinct code keys to 11 calls / 8 keys. The same worker-thread title breakpoint remains. Runtime base: our frozen c3o diagnostic stack, with its linked full ancestry and limitations. c3p adds ONLY this PR's shader_library.h and shader_library_test.cpp changes, which apply cleanly. Pipeline source is frozen main dde82f2 plus the full PR patch. No translator-rule changes, rebase, or other runtime changes. The compute-library step wrote 2,684 programs; 1,773 translated and all 1,773 passed spirv-val. 911 remain untranslated. LLVM 23.1.6, SPIRV-Tools v2026.3, wave64 emulation enabled, no fallback flags. The translator digest and llvm-mc signature match our original pipeline's corresponding provenance. The new index has both code and state keys on every entry. All 31 requested code keys found by the unpack-only probe translated; the other eight were absent from the extracted compute library and from the already unpacked FidelityFX DLL programs. This does not establish their source. Both bounded offline runs use the SAME finalized overlay: unchanged main/FSPX/BVH modules plus the new library/ sub-index. Every indexed module exists. Control c3o ignores library/ and reproduces the original 42 failures / 39 keys. c3p has no failure on calls 1-31, then failures on calls 32-42; those remaining misses are exactly the eight keys absent from the extracted compute library. The handler numbers every call and logs every failed HRESULT, so the first 31 now return success. The lookup checks the state key as well as the code key. No ambiguous lookup was reported. Both runs: init exit 0, runtime exit 3. The 2,334 traced D3D12 calls retain the same outcome counts: 1,645 ok, 93 called, 586 unsupported, seven failed (six CreatePipelineState and one Close), two ignored, one console-only. Slot-67 successes are not separate trace events. The same worker-thread title breakpoint occurs before the other thread logs presentation-window initialization. Clearing these 31 calls alone is insufficient to clear that stop; no rendered-frame or compute-dispatch correctness claim. Validation: 16 Python tests pass. The selected 51-test runtime invocation has 45 passed, five unchanged baseline failures, one corpus skip without its environment. The corpus test was then executed separately and passes against both the frozen library and the overlay (26,503 main entries reached; overlay auxiliary counts 1,794 FSPX including library, plus 52 BVH). Shader-library checks pass. Baseline failures remain the two known Wine environment cases, two Wine WARP device-creation failures, and the pre-existing mesh Close check. Existing slot-74 and XG stand-ins still limit the integration stack. No game data or raw logs attached. AI-assisted testing (Claude), review/reporting (Codex). |
|
checked: port of main@6312c057f's rdna2spirv + six new cases | with: the 814 library programs the title requests at boot retranslated, spirv-val on every module, two 30 s runs | on: Windows 11, RTX 5080, 32.0.16.1714 | result: 0 -> 742/814 translated. Cases added: TG_SIZE_EN uses the dispatch state's size (64); |
|
checked: #7529 | with: applied the diff on main 6312c05, ran tests/test_shader_library.py (10 tests OK), tests/test_library_shaders_stage.py (6 tests OK), built and ran shader_library_test (PASS: SHA-256, inflate stored/fixed/dynamic, JSON, FSSM extraction, FSPX programs and index lookup) | on: Windows 11, MSVC 14.44, RX 9060 XT | result: PASS Code read: shader_library.py now emits each compute record's state blob as fspx/.state so the translated index carries fspx_state_sha256, which slot 67's kind-0 lookup requires; make_game.py adds the library_shaders() stage after FSPX/BVH with its own library_build.json reuse key; ShaderLibrary::load reads library/index.json in the same folder loop and counts entries with the FSPX ones in fspx_size(). The docs updates match. AI-assisted check. |
…ary's compute pipelines, which the executable creates with slot 67 (RT-5) Squashed from ProjectLeonida#7529 by gookie-dev, head b93ffa5 (security scan PASS). Applied as the PR's own diff (gh pr diff); head b93ffa5 matches the watcher's Haiku scan. Taken for the slot-67 gap: the retail boot's untranslated compute programs live in shaders.rpf's pipeline library, which the shaders stage did not carve before.
…game_scarlett_master.exe embedded shaders Squashed from ItsNotRexed#7746 by Faterek, head bc5fc47 (security scan PASS). Applied as the PR's own diff (gh pr diff); head bc5fc47; prescan flags (cleanup unlinks, test subprocesses) read by Haiku: PASS, and make_game's drop() removes only the files named. Taken for the slot-86 gap: the retail boot's untranslated vertex shader is the executable's one embedded VS (its FSSM hash is in none of the 26,503 carved containers and matches one of the exe's 10). Conflicts with ItsNotRexed#7529: the shaders stage runs library_shaders() then exe_shaders(); ShaderLibrary::load reads fspx, bvh, library and exe, each folder keeping its own key and count; both PRs' shader_library_test sections kept. Fixed after the apply: the library section of shader_library_test is closed before the exe section starts.
|
Tested
Not run here: the PR's unit tests (already covered above) and a retail boot to slot 67. AI-assisted (Claude Code). Counts and the translator's reason names only; no game files, shader names or hashes. |
Claimed in the coordination issue as: #7049 (comment) (the open half of @Pipodi's slot 67 finding)
Depends on: none.
What and why
The retail executable calls Xbox device slot 67 (
DeserializeComputePipelineStateX) itself during boot. Every call fails withno translated compute shader(@Pipodi's finding, #6982), because the build only translates the FidelityFX DLL's 29 FSPX programs.The programs come from the pipeline library in
shaders.rpf(docs/shader_library.md). It's stored as 64 KiB zlib streams at 16-byte-aligned offsets, the form a DirectStorage zlib request reads (#7180). A compute record's state blob, blob, program and layout blob are FSPX kinds 0, 1, 6 and 7. Those are the four pointer/size pairs of the slot-67 description, and the runtime already looks such programs up byfspx_code_sha256andfspx_state_sha256(docs/fspx.md). Nothing in the build produced them:tools/shader_library.pywrites each compute program's record state blob asfspx/<name>.state, so the translated index getsfspx_state_sha256. Slot 67 always passes kind 0, and without that key the lookup refuses the call. Measured on my 1.0.2.1 copy: 2,693 compute records over 2,684 programs, and every program has exactly one state blob, so one.stateper program is complete and unambiguous.make_game.py: theshadersstage getslibrary_shaders(), after the FSPX and BVH steps. It runsshader_library.py --stages cs --disasm --carveinto<work>/shaders/library, thenrdna2spirv.pyinto<work>/shaders/spirv/librarywith the stage's--wave64-emulateand fallback flags. It reuses the FSPX step's key-clash check, and has its ownlibrary_build.jsonfor reuse (shaders.rpf, the tools, the translator,llvm-mc, the wave64 mode and the flags). It runs whole, like the FSPX step.ShaderLibrary::loadalso reads<dir>/library/index.json(in the folder loop withfspxandbvh). Its entries, namedlibrary/<name>, are found by the same two keys and counted with the FSPX ones infspx_size().docs/shader_library.md(the.stateoutput and the build step),docs/fspx.md(build and run-time lookup).Graphics pipelines (device slot 57, the current stop) are not touched.
Tested
Windows 11 (26300), MSVC 14.52 (VS 2026), RelWithDebInfo, NVIDIA RTX 3060 (driver 610.88), Vulkan SDK 1.4.363, llvm-mc 21.1.8 (AMDGPU).
tests/test_library_shaders_stage.py(new, 6 tests): the tool calls and their arguments, reuse, re-translation when the archive,llvm-mc, the wave64 mode, the flags or the translator change, an empty index re-translated with stale modules dropped, a key clash failing with no index left, and no archive skipping the step.tests/test_shader_library.py(10): plus the compute.statecontents, no.statefor a graphics program, and both keys fromshader_meta.shader_library_test: library entries found by code and state key next tofspx/andbvh/, another state refused, a broken or missinglibrary/index.jsonleaving the others loaded.tests/test_fspx_shaders_stage.pyandtests/test_bvh_shaders_stage.pyunchanged and passing;compileallclean.shader_library.py --stages cswrote 2,684.code, 2,684.jsonand 2,684.state. A 200-program slice throughrdna2spirv.py --wave64-emulategave 158 translated modules, allcs, all with bothfspx_code_sha256andfspx_state_sha256. That's about the 68.7% CS rate indocs/shader_library.md§5.--runto slot 67. My local chain stops earlier, atXMemAllocatePhysicalPages. @Pipodi, @KkelebekK, your boot-integration runs reach slot 67, if you can check the hit count with this step's output.tests/test_docs_links.pyis red onmainalready (docs/dev-tools.md's anchor, claimed by @Unix-Epoch); this PR adds no failure.AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (n/a: no translator change)