feat(agc): replay prepared shader capture and materialization offline #5959

Merged
fdfawef324 merged 2 commits from upstream-pr/5959 into main 2026-10-16 19:54:18 +00:00
fdfawef324 commented 2026-10-14 17:09:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-14T17:09:05Z.


What

agc_shader_replay --prepare can succeed before the runtime descriptor capture and specialization that fail inside the game. Add --materialize to run the complete prepared-shader path on a saved request: prepare, match the invocation, capture its recorded inputs, then materialize the result. Failure output identifies the phase, and later requests still run. The new mode avoids a redundant preliminary resource-analysis pass.

On the original base e34c47921, an actual private capture reproduced the game's runtime image descriptor refusal in 0.266 seconds, versus reaching that refusal at 214.1 seconds in the game. On current main the same request passes that check, and the tool stops at the next capture-phase refusal (unsupported buffer descriptor type) in 0.43 seconds. This measures iteration time for those faults; it does not measure a game-startup or FPS improvement. No game data or shader payload is included.

Tested

  • Rebased onto current main 38d245448 without conflicts. Windows Server 2025, MinGW GCC 15.2, CMake and Ninja Release with BUILD_TESTING=ON: agc_shader_replay, agc_shader_replay_requests_tests and their dependencies built at the rebased head.
  • ctest -R agc_shader_replay passes both tests (0.29 s and 0.44 s) with ANYPS5_NO_SHADER_CACHE=1: legacy preparation succeeds on an active invalid descriptor; full replay rejects it at capture; an inactive invalid descriptor materializes; a valid later request still runs after a failure; and the new mode accepts the existing maintenance8 override.
  • A control that skips runtime capture/materialization falsely succeeds on the invalid request, and agc_shader_replay_tool fails against it.
  • Conventions, tools/check_test_registration.py and git diff --check pass. Not run: full driver build, GPU execution, Linux, SPIRV-Tools configuration, or a title with this tool change.

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; silent stubs are listed in library technical debt
  • No notes, investigation files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: CPU reproduction of prepared capture/materialization failures
  • GPUs tested: none for this CPU tool change. Host: NVIDIA GeForce RTX 3060 12 GB, driver 591.86 (32.0.15.9186), Vulkan 1.4.325, Windows Server 2025 10.0.26100
  • AI-assisted: yes

Co-Authored-By: Codex [email protected]

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4861546313 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5959). Originally posted by [fdfawef324](https://github.com/fdfawef324) on 2026-10-14T17:09:05Z. --- ### What `agc_shader_replay --prepare` can succeed before the runtime descriptor capture and specialization that fail inside the game. Add `--materialize` to run the complete prepared-shader path on a saved request: prepare, match the invocation, capture its recorded inputs, then materialize the result. Failure output identifies the phase, and later requests still run. The new mode avoids a redundant preliminary resource-analysis pass. On the original base `e34c47921`, an actual private capture reproduced the game's runtime image descriptor refusal in 0.266 seconds, versus reaching that refusal at 214.1 seconds in the game. On current `main` the same request passes that check, and the tool stops at the next capture-phase refusal (unsupported buffer descriptor type) in 0.43 seconds. This measures iteration time for those faults; it does not measure a game-startup or FPS improvement. No game data or shader payload is included. ### Tested - Rebased onto current `main` `38d245448` without conflicts. Windows Server 2025, MinGW GCC 15.2, CMake and Ninja Release with `BUILD_TESTING=ON`: `agc_shader_replay`, `agc_shader_replay_requests_tests` and their dependencies built at the rebased head. - `ctest -R agc_shader_replay` passes both tests (0.29 s and 0.44 s) with `ANYPS5_NO_SHADER_CACHE=1`: legacy preparation succeeds on an active invalid descriptor; full replay rejects it at capture; an inactive invalid descriptor materializes; a valid later request still runs after a failure; and the new mode accepts the existing maintenance8 override. - A control that skips runtime capture/materialization falsely succeeds on the invalid request, and `agc_shader_replay_tool` fails against it. - Conventions, `tools/check_test_registration.py` and `git diff --check` pass. Not run: full driver build, GPU execution, Linux, SPIRV-Tools configuration, or a title with this tool change. ### 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 - [x] Unimplemented paths throw; silent stubs are listed in library technical debt - [x] No notes, investigation files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: CPU reproduction of prepared capture/materialization failures - [x] GPUs tested: none for this CPU tool change. Host: NVIDIA GeForce RTX 3060 12 GB, driver 591.86 (32.0.15.9186), Vulkan 1.4.325, Windows Server 2025 10.0.26100 - [x] AI-assisted: yes Co-Authored-By: Codex <[email protected]>
fdfawef324 commented 2026-10-15 11:54:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-15T11:54:47Z.


Rebased onto main 38d245448 (was e34c47921, 554 commits behind) without conflicts; the commit is unchanged apart from its base. At the new head ee8460a1f, agc_shader_replay and agc_shader_replay_requests_tests build through CMake/Ninja Release (MinGW GCC 15.2) and ctest -R agc_shader_replay passes 2/2. The capture-skipping control still fails agc_shader_replay_tool. The description's Tested section and timing note now describe this head.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191437492 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5959#issuecomment-6191437492). Originally posted by [fdfawef324](https://github.com/fdfawef324) on 2026-10-15T11:54:47Z. --- Rebased onto `main` `38d245448` (was `e34c47921`, 554 commits behind) without conflicts; the commit is unchanged apart from its base. At the new head `ee8460a1f`, `agc_shader_replay` and `agc_shader_replay_requests_tests` build through CMake/Ninja Release (MinGW GCC 15.2) and `ctest -R agc_shader_replay` passes 2/2. The capture-skipping control still fails `agc_shader_replay_tool`. The description's Tested section and timing note now describe this head. AI-assisted: yes
github-actions[bot] commented 2026-10-15 12:12:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:12:19Z.


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.

Pull request Shared files not compared
PR 1341 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 4048 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp
PR 4339 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 4650 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 4891 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5426 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5431 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5480 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5499 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6044 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6208 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6215 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6373 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6451 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6499 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6503 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6678 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6683 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6718 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6763 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6869 core/libs/prx/libSceAgcDriver/CMakeLists.txt
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191752424 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5959#issuecomment-6191752424). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:12:19Z. --- <!-- pr-overlap --> 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. | Pull request | Shared files not compared | |---|---| | [PR 1341](https://www.github.com/boykopovar/AnyPS5/pull/1341) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 1368](https://www.github.com/boykopovar/AnyPS5/pull/1368) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 1896](https://www.github.com/boykopovar/AnyPS5/pull/1896) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 4048](https://www.github.com/boykopovar/AnyPS5/pull/4048) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt`<br>`core/libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp` | | [PR 4339](https://www.github.com/boykopovar/AnyPS5/pull/4339) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 4650](https://www.github.com/boykopovar/AnyPS5/pull/4650) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 4891](https://www.github.com/boykopovar/AnyPS5/pull/4891) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5371](https://www.github.com/boykopovar/AnyPS5/pull/5371) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5426](https://www.github.com/boykopovar/AnyPS5/pull/5426) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5431](https://www.github.com/boykopovar/AnyPS5/pull/5431) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5480](https://www.github.com/boykopovar/AnyPS5/pull/5480) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6208](https://www.github.com/boykopovar/AnyPS5/pull/6208) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6215](https://www.github.com/boykopovar/AnyPS5/pull/6215) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6373](https://www.github.com/boykopovar/AnyPS5/pull/6373) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6451](https://www.github.com/boykopovar/AnyPS5/pull/6451) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6499](https://www.github.com/boykopovar/AnyPS5/pull/6499) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6503](https://www.github.com/boykopovar/AnyPS5/pull/6503) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6678](https://www.github.com/boykopovar/AnyPS5/pull/6678) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6683](https://www.github.com/boykopovar/AnyPS5/pull/6683) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6718](https://www.github.com/boykopovar/AnyPS5/pull/6718) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6763](https://www.github.com/boykopovar/AnyPS5/pull/6763) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6808](https://www.github.com/boykopovar/AnyPS5/pull/6808) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` | | [PR 6869](https://www.github.com/boykopovar/AnyPS5/pull/6869) | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` |
adriadam10 commented 2026-10-16 12:23:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T12:23:04Z.


Checked on Linux (build + ctest of the AgcDriver scope): both new tests pass. On main, agc_shader_replay doesn't compile with SPIRV-Tools ON (SpirvTools::Disassemble called with a SharedSpirv), and this PR puts the target into ctest, so I added a one-line commit fixing it (result.spirv.data(), result.spirv.size()), rebased onto current main. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6215415744 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5959#issuecomment-6215415744). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T12:23:04Z. --- Checked on Linux (build + ctest of the AgcDriver scope): both new tests pass. On main, `agc_shader_replay` doesn't compile with SPIRV-Tools ON (`SpirvTools::Disassemble` called with a `SharedSpirv`), and this PR puts the target into ctest, so I added a one-line commit fixing it (`result.spirv.data(), result.spirv.size()`), rebased onto current main. Merging once CI is green.
adriadam10 commented 2026-10-16 18:38:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T18:38:43Z.


Rebased onto current main (clean) and re-ran build + ctest of the AgcDriver scope: both new tests pass. The earlier Windows guest_shader_link timeout was a flake unrelated to this diff; the full Build on this head is green. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222281724 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5959#issuecomment-6222281724). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T18:38:43Z. --- Rebased onto current main (clean) and re-ran build + ctest of the AgcDriver scope: both new tests pass. The earlier Windows `guest_shader_link` timeout was a flake unrelated to this diff; the full Build on this head is green. Merging.
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!5959
No description provided.