feat(tools): add an offline shader archive tool that publishes prebuilt packs #5793

Closed
SaloQT wants to merge 4 commits from upstream-pr/5793 into main
SaloQT commented 2026-10-14 11:13:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SaloQT on 2026-10-14T11:13:42Z.


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/.ucas pairs, 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 *.pack file (the format #5792 loads) plus a manifest.
  • Two small recompiler commits first: an uncached compile entry point so tools do not write through the disk cache, and encoded entry-key helpers so the tool builds entries in the cache's exact on-disk format.
  • Remaining decoder limits (other Oodle codecs, other entropy modes, checksums) throw typed errors and are listed in 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_cache and shader_cache_file_read pass. 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

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #5792 (merged)
  • Unblocks: none
  • GPUs tested: offline CPU recompile only; n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4857004423 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5793). Originally posted by [SaloQT](https://github.com/SaloQT) on 2026-10-14T11:13:42Z. --- ### 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`/`.ucas` pairs, 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 `*.pack` file (the format #5792 loads) plus a manifest. - Two small recompiler commits first: an uncached compile entry point so tools do not write through the disk cache, and encoded entry-key helpers so the tool builds entries in the cache's exact on-disk format. - Remaining decoder limits (other Oodle codecs, other entropy modes, checksums) throw typed errors and are listed in `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_cache` and `shader_cache_file_read` pass. 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 - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #5792 (merged) - [x] Unblocks: none - [x] GPUs tested: offline CPU recompile only; n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-14 11:14:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T11:14:11Z.


Thank you for your contribution! Authors with no pull requests merged into main can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6167062207 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5793#issuecomment-6167062207). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T11:14:11Z. --- Thank you for your contribution! Authors with no pull requests merged into `main` can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.
SaloQT commented 2026-10-14 19:45:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SaloQT on 2026-10-14T19:45:46Z.


Reopened as #6032: this PR could not be reopened after the branch was force-pushed, so the same rebased branch (onto merged #5792) is now #6032 with an updated description.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6176897621 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5793#issuecomment-6176897621). Originally posted by [SaloQT](https://github.com/SaloQT) on 2026-10-14T19:45:46Z. --- Reopened as #6032: this PR could not be reopened after the branch was force-pushed, so the same rebased branch (onto merged #5792) is now #6032 with an updated description.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5793
No description provided.