feat(tools): add an offline shader archive tool that publishes prebuilt packs #6032
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6032"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by SaloQT on 2026-10-14T19:45:06Z.
What
An offline tool that extracts shader programs from a game's archives, recompiles them ahead of time, and publishes the results as a prebuilt shader pack for the loader in #5792 (merged).
tools/shader-archive(new): reads Unreal IoStore v8.utoc/.ucaspairs, decodes the Oodle Mermaid quanta those archives use with its own clean-room decoder (no vendored Oodle), scans shader libraries, and builds shader variants fully offline through the existing recompiler. Output is published atomically as a*.packfile (the format #5792 loads) plus a manifest.docs/dev/TechnicalDebt.md; the tool fails on archives it cannot decode instead of guessing.Scope, honestly: extraction covers Unreal IoStore v8 only today; other engines' archives (Insomniac, RAGE) need their own readers. Keys are exact, so statically built variants only hit when the runtime request matches exactly — the verified end-to-end numbers are for replayed captured requests, and a real-game hit-rate measurement with a statically built pack is still open (also in TechnicalDebt). The tool also writes
pipeline-cache.bin, but nothing loads it at runtime yet; whether offline pipeline compiles remove driver compile cost is unmeasured, so this PR claims no pipeline-compile saving.Tested
Windows 11: rebuilt on current main;
shader_archive,agc_shader_disk_cacheandshader_cache_file_readpass. Full real-archive run: 4,803/4,803 IoStore groups decoded byte-identical to the licensed-SDK reference, 80,794 shader hashes matching. Offline build + publish + probe against captured requests: 10/10 exact-key hits. Not tested on Linux locally (no Linux box here); CI covers it.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T09:17:34Z.
Review: CHANGES_REQUESTED
Thanks for the work. I'm requesting changes because, as the description says, the runtime benefit hasn't been shown yet, and the PR is too big to merge on trust.
[shader-prebuilt]hits/misses from a real run with a pack built bybuild --paksonly, along with load time with and without the pack. Without that number we can't merge 4k lines.pipeline-cache.binisn't loaded). Please state the expected saving at load time, measured.CompileShaderUncached, the encoded entry-key helpers) go in their own PR, with tests. The tool goes in a follow-up that depends on it. Mesh shader-object binaries,pipeline-cache.binand theAPS5_PIPELINE_SALTbenchmarking path aren't used by the emulator, so leave them out until something consumes them.docs/dev/ShaderArchive.mdmentions "the Rust extractor", itsshaders.jsonl/groups/*.binand "the Rust tool's static-target profile". None of these are in the tree. Please drop them or point to what users are supposed to run.shader_archiveand one extract/build on Linux, or say it's untested there in TechnicalDebt.ShaderDiskCache.hppoverlaps with #5509 and #6243 (see the overlap comment). Rebase once those settle.Imported from boykopovar/AnyPS5. Originally posted by SaloQT on 2026-10-15T09:44:55Z.
Thanks for the thorough review. This push covers the mechanical points; the measurement and the split are the next round and I am not claiming they are done.
Done in this push:
shaders.jsonl/groups/*.bin, and its static-target profile are gone fromdocs/dev/ShaderArchive.md).pipeline-cache.binwriting, theAPS5_PIPELINE_SALTbenchmarking path, and the mesh shader-object creation/binary dump. GPU validation now only builds pipelines.ShaderDiskCache.hppoverlap is resolved for now; I will rebase again if #5509/#6243 move it.Still open, in your order:
build --paksonly, plus load time with/without the pack — not measured yet; agreed this is the number that matters.Imported from boykopovar/AnyPS5. Originally posted by SaloQT on 2026-10-15T09:51:49Z.
Split as requested: the two recompiler commits (uncached compile entry point, encoded entry-key helpers) now have their own PR with tests (linked below once opened). This tool PR will return as the follow-up on top of it, with the real-run hit-rate measurement. Closing this one because of the one-open-PR limit; the branch
feat/shader-archive-toolkeeps the trimmed tool at its current head.Imported from boykopovar/AnyPS5. Originally posted by SaloQT on 2026-10-15T09:52:05Z.
The split recompiler PR is #6296.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:13:40Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
CMakeLists.txtdocs/dev/TechnicalDebt.mddocs/dev/TechnicalDebt.mddocs/dev/TechnicalDebt.mddocs/dev/TechnicalDebt.mddocs/dev/TechnicalDebt.mdCMakeLists.txtdocs/dev/TechnicalDebt.mddocs/dev/TechnicalDebt.mdcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppCMakeLists.txtdocs/dev/TechnicalDebt.mdCMakeLists.txtcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.cppCMakeLists.txtcore/shader/recompiler/Recompiler.cppdocs/dev/TechnicalDebt.mdcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/Optimization/include/Optimization/ResourceProgram.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppCMakeLists.txtcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppCMakeLists.txtdocs/dev/TechnicalDebt.mdCMakeLists.txtCMakeLists.txtcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Optimization/include/Optimization/ResourceProgram.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppCMakeLists.txtcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppCMakeLists.txtcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Optimization/include/Optimization/ResourceProgram.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/Recompiler.cppCMakeLists.txtCMakeLists.txtdocs/dev/TechnicalDebt.mdcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Optimization/include/Optimization/ResourceProgram.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppCMakeLists.txtcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppCMakeLists.txtcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppCMakeLists.txtcore/shader/recompiler/Optimization/include/Optimization/ResourceProgram.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppCMakeLists.txtcore/shader/recompiler/ShaderDiskCache.cppCMakeLists.txtcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppCMakeLists.txtcore/shader/recompiler/ShaderDiskCache.cppCMakeLists.txtCMakeLists.txtcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/Recompiler.cppCMakeLists.txtImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T21:15:26Z.
Review: CHANGES_REQUESTED
Thanks for the update. Checking this head against the points of the previous review:
[shader-prebuilt]hits/misses from a run with a pack built bybuild --paksonly, with load time with and without the pack.b280f00899andc5af57b355(the uncached compile entry point and the entry-key helpers), which are what #6296 adds. Once #6296 lands, drop them here and rebase so this PR contains only the tool; until then it duplicates and will conflict with it.shader_archivehas not run on Linux; the Windows run is the author's. Please runshader_archiveon Linux or keep the "untested on Linux" note in TechnicalDebt accurate.Happy to review again once #6296 is merged and the hit-rate number is posted.
Pull request closed