Repository navigation
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
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)