Skip to content

shaders: translate the pipeline library's compute pipelines, which the executable creates with slot 67 (RT-5) - #7529

Open
gookie-dev wants to merge 1 commit into
ItsNotRexed:mainfrom
gookie-dev:build-library-compute-pipelines
Open

gookie-dev wants to merge 1 commit into
ItsNotRexed:mainfrom
gookie-dev:build-library-compute-pipelines

Conversation

@gookie-dev

@gookie-dev gookie-dev commented Nov 23, 2026 •

Copy link
Copy Markdown

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 with no 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 by fspx_code_sha256 and fspx_state_sha256 (docs/fspx.md). Nothing in the build produced them:

  • tools/shader_library.py writes each compute program's record state blob as fspx/<name>.state, so the translated index gets fspx_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 .state per program is complete and unambiguous.
  • make_game.py: the shaders stage gets library_shaders(), after the FSPX and BVH steps. It runs shader_library.py --stages cs --disasm --carve into <work>/shaders/library, then rdna2spirv.py into <work>/shaders/spirv/library with the stage's --wave64-emulate and fallback flags. It reuses the FSPX step's key-clash check, and has its own library_build.json for reuse (shaders.rpf, the tools, the translator, llvm-mc, the wave64 mode and the flags). It runs whole, like the FSPX step.
  • ShaderLibrary::load also reads <dir>/library/index.json (in the folder loop with fspx and bvh). Its entries, named library/<name>, are found by the same two keys and counted with the FSPX ones in fspx_size().
  • Docs: docs/shader_library.md (the .state output 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 .state contents, no .state for a graphics program, and both keys from shader_meta.
  • shader_library_test: library entries found by code and state key next to fspx/ and bvh/, another state refused, a broken or missing library/index.json leaving the others loaded.
  • tests/test_fspx_shaders_stage.py and tests/test_bvh_shaders_stage.py unchanged and passing; compileall clean.
  • Real data, my own copy (counts only): shader_library.py --stages cs wrote 2,684 .code, 2,684 .json and 2,684 .state. A 200-program slice through rdna2spirv.py --wave64-emulate gave 158 translated modules, all cs, all with both fspx_code_sha256 and fspx_state_sha256. That's about the 68.7% CS rate in docs/shader_library.md §5.
  • Not done here: a retail --run to slot 67. My local chain stops earlier, at XMemAllocatePhysicalPages. @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.py is red on main already (docs/dev-tools.md's anchor, claimed by @Unix-Epoch); this PR adds no failure.

AI-assisted: yes

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. Counts, sizes and file names only.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

…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).
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.

1 participant