fix(agc): return the console results of the capture, shader instrumentation and occlusion query size calls #8296

Merged
hypermoist merged 2 commits from upstream-pr/8296 into main 2026-10-22 22:42:35 +00:00
hypermoist commented 2026-10-20 09:19:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-20T09:19:32Z.


What

Replaces seven NotImplemented stubs with what the firmware does. The behaviour was read from the decrypted libSceAgc.sprx and libSceAgcDriver.sprx:

Export NID Firmware body Now
sceAgcDriverRequestCaptureStart SAfhzJPcjuk mov eax, 0x8a6c1000; ret returns 0x8A6C1000
sceAgcDriverRequestCaptureStop FOwvmNlFLjM same same
sceAgcDriverTriggerCapture Xq5WmbwPTnQ same same
sceAgcSetShaderInstrumentation RTpj-tIlvZc stores edi in a global, returns 0 keeps the flags, returns 0
sceAgcGetShaderInstrumentation SwI6QxqwAC0 returns that global returns the kept flags
sceAgcDcbBeginOcclusionQueryGetSize ms1xVoZ-Vwc type == 1 ? 0x120 : type == 0 ? 0x10 : 0 same
sceAgcDcbEndOcclusionQueryGetSize P1CugZ99Uzc mov eax, 0x10; ret same

0x8A6C1000 is the code the driver already returns from its other unavailable debug calls (DEBUG_UNAVAILABLE in libSceAgcDriver/Unimplemented.cpp).

The firmware's sceAgcGetShaderInstrumentation also ORs in bit 0 and bit 31 from two developer registry keys (sceRegMgrNonSysGetInt), but only when libSceAgc's module init succeeded in loading system module 0x8000001f. With those keys unset, as on a retail console, the result is the stored flags. That is what this returns.

PRAGMATA (#8005) and the Horizon Call of the Mountain thread (#6214) list the capture imports among the calls that throw. Neither title was run with this change.

Tested

Linux (CachyOS, GCC, Release):

  • the new agc_instrumentation_query_size_tests checks the flag round trip and all three BeginOcclusionQueryGetSize cases plus EndOcclusionQueryGetSize;
  • agc_end_of_shader_action_size_tests, agc_context_state_size_tests and agc_commands pass.

No Vulkan path changes, so there was no validation-layer run.

pr_overlap shows no line conflicts. In libSceAgc/CMakeLists.txt, #6747's hunks (lines 193–200 and 213–220) and #5021's (68–74) are clear of the new block at line 256; #6044 moves every test block. #1060 edits lines 15–26 of libSceAgc/Unimplemented.cpp; this removes lines 43–51.

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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (no GPU or Vulkan code changes; the test is host-only)
  • AI-assisted: yes (Claude Code), reviewed by the contributor

🤖 Generated with Claude Code

https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4933682503 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8296). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-20T09:19:32Z. --- ### What Replaces seven `NotImplemented` stubs with what the firmware does. The behaviour was read from the decrypted `libSceAgc.sprx` and `libSceAgcDriver.sprx`: | Export | NID | Firmware body | Now | |---|---|---|---| | `sceAgcDriverRequestCaptureStart` | `SAfhzJPcjuk` | `mov eax, 0x8a6c1000; ret` | returns `0x8A6C1000` | | `sceAgcDriverRequestCaptureStop` | `FOwvmNlFLjM` | same | same | | `sceAgcDriverTriggerCapture` | `Xq5WmbwPTnQ` | same | same | | `sceAgcSetShaderInstrumentation` | `RTpj-tIlvZc` | stores `edi` in a global, returns 0 | keeps the flags, returns 0 | | `sceAgcGetShaderInstrumentation` | `SwI6QxqwAC0` | returns that global | returns the kept flags | | `sceAgcDcbBeginOcclusionQueryGetSize` | `ms1xVoZ-Vwc` | `type == 1 ? 0x120 : type == 0 ? 0x10 : 0` | same | | `sceAgcDcbEndOcclusionQueryGetSize` | `P1CugZ99Uzc` | `mov eax, 0x10; ret` | same | `0x8A6C1000` is the code the driver already returns from its other unavailable debug calls (`DEBUG_UNAVAILABLE` in `libSceAgcDriver/Unimplemented.cpp`). The firmware's `sceAgcGetShaderInstrumentation` also ORs in bit 0 and bit 31 from two developer registry keys (`sceRegMgrNonSysGetInt`), but only when libSceAgc's module init succeeded in loading system module `0x8000001f`. With those keys unset, as on a retail console, the result is the stored flags. That is what this returns. PRAGMATA (#8005) and the Horizon Call of the Mountain thread (#6214) list the capture imports among the calls that throw. Neither title was run with this change. ### Tested Linux (CachyOS, GCC, Release): - the new `agc_instrumentation_query_size_tests` checks the flag round trip and all three `BeginOcclusionQueryGetSize` cases plus `EndOcclusionQueryGetSize`; - `agc_end_of_shader_action_size_tests`, `agc_context_state_size_tests` and `agc_commands` pass. No Vulkan path changes, so there was no validation-layer run. `pr_overlap` shows no line conflicts. In `libSceAgc/CMakeLists.txt`, #6747's hunks (lines 193–200 and 213–220) and #5021's (68–74) are clear of the new block at line 256; #6044 moves every test block. #1060 edits lines 15–26 of `libSceAgc/Unimplemented.cpp`; this removes lines 43–51. ### 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (no GPU or Vulkan code changes; the test is host-only) - [x] AI-assisted: yes (Claude Code), reviewed by the contributor 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
github-actions[bot] commented 2026-10-20 09:20:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T09:20:18Z.


Progress report (6ef5a1c → b83fe20)

📈 System libraries: 42.39% (+0.06%, +7 implemented functions)

✅ 7 implemented
Library Name
libSceAgc sceAgcDcbBeginOcclusionQueryGetSize
libSceAgc sceAgcDcbEndOcclusionQueryGetSize
libSceAgc sceAgcGetShaderInstrumentation
libSceAgc sceAgcSetShaderInstrumentation
libSceAgcDriver sceAgcDriverRequestCaptureStart
libSceAgcDriver sceAgcDriverRequestCaptureStop
libSceAgcDriver sceAgcDriverTriggerCapture
⚪ 4 behaviourally empty (constant return or throw)
Library Name
libSceAgc sceAgcDcbEndOcclusionQueryGetSize
libSceAgcDriver sceAgcDriverRequestCaptureStart
libSceAgcDriver sceAgcDriverRequestCaptureStop
libSceAgcDriver sceAgcDriverTriggerCapture
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6287712969 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8296#issuecomment-6287712969). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T09:20:18Z. --- <!-- progress-report --> ### Progress report (6ef5a1c → b83fe20) 📈 **System libraries**: 42.39% (+0.06%, +7 implemented functions) <details> <summary>✅ 7 implemented</summary> | Library | Name | | - | - | | libSceAgc | `sceAgcDcbBeginOcclusionQueryGetSize` | | libSceAgc | `sceAgcDcbEndOcclusionQueryGetSize` | | libSceAgc | `sceAgcGetShaderInstrumentation` | | libSceAgc | `sceAgcSetShaderInstrumentation` | | libSceAgcDriver | `sceAgcDriverRequestCaptureStart` | | libSceAgcDriver | `sceAgcDriverRequestCaptureStop` | | libSceAgcDriver | `sceAgcDriverTriggerCapture` | </details> <details> <summary>⚪ 4 behaviourally empty (constant return or throw)</summary> | Library | Name | | - | - | | libSceAgc | `sceAgcDcbEndOcclusionQueryGetSize` | | libSceAgcDriver | `sceAgcDriverRequestCaptureStart` | | libSceAgcDriver | `sceAgcDriverRequestCaptureStop` | | libSceAgcDriver | `sceAgcDriverTriggerCapture` | </details>
github-actions[bot] commented 2026-10-20 09:32:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T09:32:00Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 8944 core/libs/prx/libSceAgc/Unimplemented.cpp L43-52

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 1060 core/libs/prx/libSceAgc/Unimplemented.cpp
PR 5021 core/libs/prx/libSceAgc/CMakeLists.txt
PR 6044 core/libs/prx/libSceAgc/CMakeLists.txt
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6287916364 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8296#issuecomment-6287916364). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T09:32:00Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 8944](https://www.github.com/boykopovar/AnyPS5/pull/8944) | `core/libs/prx/libSceAgc/Unimplemented.cpp` [L43-52](https://github.com/boykopovar/AnyPS5/blob/d6eafa54d0464258574fd2f71889754d05a5bc93/core/libs/prx/libSceAgc/Unimplemented.cpp#L43-L52) | | | 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 1060](https://www.github.com/boykopovar/AnyPS5/pull/1060) | `core/libs/prx/libSceAgc/Unimplemented.cpp` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceAgc/CMakeLists.txt` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libSceAgc/CMakeLists.txt` |
BunnyFl commented 2026-10-22 08:42:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-10-22T08:42:52Z.


Checked all seven against firmware 13.42's libSceAgc.sprx and libSceAgcDriver.sprx: they match, including that sceAgcGetShaderInstrumentation only adds its two extra bits from two registry values when those are set.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6336580780 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8296#issuecomment-6336580780). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-10-22T08:42:52Z. --- Checked all seven against firmware 13.42's `libSceAgc.sprx` and `libSceAgcDriver.sprx`: they match, including that `sceAgcGetShaderInstrumentation` only adds its two extra bits from two registry values when those are set. AI-assisted: yes (Claude Code)
hypermoist commented 2026-10-22 09:10:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hypermoist on 2026-10-22T09:10:19Z.


@BunnyFl thanks for confirming all seven against 13.42, including sceAgcGetShaderInstrumentation adding its two extra bits only when the registry values are set.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6337086354 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8296#issuecomment-6337086354). Originally posted by [hypermoist](https://github.com/hypermoist) on 2026-10-22T09:10:19Z. --- @BunnyFl thanks for confirming all seven against 13.42, including `sceAgcGetShaderInstrumentation` adding its two extra bits only when the registry values are set.
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!8296
No description provided.