Skip to content

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

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
hypermoist:fix/agc-capture-instrumentation-query-sizes
Oct 22, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
hypermoist:fix/agc-capture-instrumentation-query-sizes

Conversation

@hypermoist

Copy link
Copy Markdown
Contributor

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

…tation and occlusion query size calls

sceAgcDriverRequestCaptureStart, sceAgcDriverRequestCaptureStop and
sceAgcDriverTriggerCapture return 0x8A6C1000 without doing anything.
sceAgcSetShaderInstrumentation keeps the flags and returns 0, and
sceAgcGetShaderInstrumentation returns them.
sceAgcDcbBeginOcclusionQueryGetSize is 0x10 for type 0, 0x120 for type 1
and 0 otherwise; sceAgcDcbEndOcclusionQueryGetSize is 0x10.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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

…trumentation-query-sizes

# Conflicts:
#	core/libs/prx/libSceAgc/DcbDraw/src/Stats.cpp
#	core/libs/prx/libSceAgc/Unimplemented.cpp
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 22, 2026
@BunnyFl

BunnyFl commented Oct 22, 2026

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor Author

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

@oneandonlydean oneandonlydean self-assigned this Oct 22, 2026
@oneandonlydean
oneandonlydean merged commit bd1d399 into boykopovar:main Oct 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants