feat(libSceAgcVsh): implement exports through shared libSceAgc sources #13940
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13940"
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 akkadbakkad89 on 2026-10-31T13:15:01Z.
What
Implements
libSceAgcVshby compiling the verifiedlibSceAgcimplementation sources into the module, replacing the 150 throwing stubs added in #11971.Evidence basis (firmware 4.03
libSceAgcVsh.sprxvslibSceAgc.sprx, per-export body comparison through the modules' NID symtabs):int 0x41, 0x2b bytes). 22 of them live in implementation files alongside exports the module does serve, so the working bodies link in — a console traps when they are called through Vsh, which no running title can depend on; the divergence is recorded in the debt file.sceAgcInit,sceAgcGetRegisterDefaults2[Internal],sceAgcAcbAcquireMemGetSize,sceAgcCreateShader,sceAgcCbReleaseMem,sceAgcDcbAcquireMem,sceAgcLinkShaders) were decoded to the same contract; the apparentLinkShaders0x3a0/0x3a4difference is a branch-displacement target, not a struct size.sceAgcAcbAtomicGdslinks the realAcb/src/Control.cppimplementation compiled into the module (its firmware Vsh body is the trap; recorded in the debt file, which keeps it with the other trap-bodied exports wired to working bodies).sceAgcSuspendPointAndCheckStatusstays aNotImplemented_nid_no_patchstub, matching its firmware trap body (no verified signature).The unversioned
sceAgcGetFusedShaderSize(nQT5kYLv0cg, exported by both modules) comes from #8314's firmware-exact body in the sharedMisc/src/ShaderFusion.cpp: it validates aGsFront/GsBackorHsFront/HsBackhalf pair and returnsback->num_sh_registers * 8bytes aligned to 4,0x8a6c0008(GRAPHICS5_ERROR_INVALID_SHADER_HALVES) on a mismatched pair — the pre-geometry ABI the_0080variant extends. The Vsh body was decoded independently here and matches; thetestUnversionedSizeblock in the fusion test pins the contract (also that the size ignores the front half's register list).Result: 288 exports, 211 of the 225 firmware-export NIDs resolve to implementations; the remaining 14 are 9 body-less symbols, 3 unnamed real bodies and 2 unnamed traps (recorded in
docs/dev/debt/libSceAgcVsh.md).Tested
Windows 11, MinGW build.
libSceAgcVsh.prxlinks and its export table was diffed NID-by-NID against the firmware module's (211/225, no duplicate NIDs;cduV1f0dcGQresolves through the compiled-insceAgcAcbAtomicGds, the retained stub resolvesb+fis+WZ3Ig).testUnversionedSizecovers the GS/HS pair validation, register-list size/alignment, front-count invariance, and the swapped/mismatched-half rejections of the plain fused-size export.ctest -Rthe 22 export-level AGC tests (agc_initializationthroughagc_gs_prim_payload_tests) plusagc_shader_fusionunderANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationonmainand on this change: all pass on both sides; loader output confirmsVK_LAYER_KHRONOS_validationinserted (nowas not found but was requested), and neither log containsVUID-lines.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)sceAgcGetFusedShaderSizeandsceAgcAcbAtomicGdsbodies are compiled into this module through the shared sources, so stacking on it keeps a single definition of each NID. Supersedes the throwing declarations of #11971 for the 149 exports now implemented; the stub export it added forsceAgcSuspendPointAndCheckStatusremains hereGenerated with Devin
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T13:22:55Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The new library debt file has four entries that do not link to a
core/path, so the repository convention check rejects them.What I ran
Reviewed head
da820c49e59348589b8c65a3ec5a01a5a203afeaagainst basecd087bd12c258cf6dbb82e203bafd20d9fe2596c; the individual merge preview is clean. Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0. No build or CTest was run.Results
Conventions output
Findings
Blocking
The four bullets on lines 6–9 of
docs/dev/debt/libSceAgcVsh.mdhave no link to acore/path. The convention checker therefore classifies them as general debt that belongs indocs/dev/TechnicalDebt.md, and the hosted conventions check fails. Add a relevantcore/libs/prx/libSceAgcVsh/...link to each entry, or move entries that are not specific to this library into the index.Non-blocking
The precheck's ABI and test-quality helper invocations could not run from its isolated checkout because those local helper scripts are not part of the PR. I ran the ABI audit from this workspace; it reports 148 removed stub declarations, which this PR explicitly replaces with shared implementations, so it does not independently establish the resulting runtime export table. The test-quality heuristic's source-registration warning is not conclusive; the CMake target includes
tests/Recorder.cpp.Not verified
I did not build the module, run CTest, or independently reproduce the firmware body comparison or the author-reported Windows test results. The Windows hosted check was still in progress; Linux and specialized jobs were skipped.
To get this to a good state
Link or relocate the four debt entries, then rerun the conventions check. I will rerun the same no-build checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T09:48:26Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The unversioned
sceAgcGetFusedShaderSizeimplementation overlaps #8314, and combining the two current heads produces duplicate definitions with different behavior.What I ran
Reviewed PR head
530320f90cd53b00a1b6a55148543cc6e97f06e2against PR basecd087bd12c258cf6dbb82e203bafd20d9fe2596c; the PR merges cleanly onto currentmain1f2c1da1fbc2e455b921616cdacb5a714d7fe7ba. The pairwise preview with #8314 also merges textually cleanly, but the resulting source has duplicate definitions. Environment: Linux x86_64, Python 3.11.2, Git 2.39.5; no compiler was used.The precheck's isolated checkout lacked the workspace-only ABI and test-quality helper scripts; I therefore ran those helpers directly above. Hosted CI was refreshed on this exact head.
Results
passed_with_warnings; the lexical audit flags removed_nid_no_patchnames that this PR replaces with implementations; it does not verify the linked export table or binary ABI.ShaderFusion.cppas possibly unregistered; source inspection confirmedagc_shader_fusion_testsandagc_shader_fusionare explicitly registered incore/libs/prx/libSceAgc/CMakeLists.txt.main1f2c1da1fbc2e455b921616cdacb5a714d7fe7ba.sceAgcGetFusedShaderSize; see blocking finding.main, and nine skipped; I did not reproduce that build or run.Selected raw output
Conventions:
Test-quality heuristic:
Pairwise merged source:
Findings
Blocking
#8314 also defines the unversioned export in
core/libs/prx/libSceAgc/Misc/src/ShaderFusion.cpp. In the combined tree, this PR's body returnsback->num_sh_registers * 8and writes all ofm_align; #8314's body forwards to_0080and writes only the low dword ofm_align. The clean textual merge therefore leaves duplicate C++ definitions and competing firmware behavior. The current checklist saysDepends on: none, while the repository requires authors of overlapping exports to agree on landing order and declare the dependency. Please coordinate with #8314's author, settle which behavior and single definition should remain, and update this PR's dependency declaration accordingly.Non-blocking
The only convention output is a debt-entry length warning. The automated test-quality warning is a false positive; the test is registered in CMake.
Sources
mainNot verified
I did not configure or build AnyPS5, run CTest, verify the linked export table, reproduce the firmware disassembly comparison, or test on a PS5 console. Linux and specialized hosted CI jobs were skipped. The NVIDIA build and tests are author-provided evidence, not a local run.
To get this to a good state
Coordinate with #8314's author, retain one agreed implementation of the shared export, update
Depends onto reflect the agreed landing order, and push a new head. I will rerun these no-build checks and review the updated integration preview.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T09:48:57Z.
Review: COMMENTED
Re-checked — new head, no blocking findings
The four debt-file entries that failed the conventions check now link to
core/paths at530320f90c, and the change sinceda820c49e5adds only a test assertion and debt text.What I ran
530320f90cd53b00a1b6a55148543cc6e97f06e2, previous reviewed headda820c49e59348589b8c65a3ec5a01a5a203afea. Basecd087bd12c258cf6dbb82e203bafd20d9fe2596c. The live check reports the PR as mergeable; no separate merged-preview was built for this comment./marc/AnyPS5:The precheck's ABI and test-quality helpers failed because the head tree has no
tools/directory, so both were run by hand as above.Results
530320f90c(precheck), with one warning:docs/dev/debt/libSceAgcVsh.md:10is 1276 characters (debt-length)passed_with_warnings: 155 symbols and 148 lexicalexport-removedfindings. These match the PR's stated move of the stub declarations to shared implementations. The audit cannot confirm the runtime export table.possible-unregistered-cpp-testonShaderFusion.cpp. False positive:core/libs/prx/libSceAgc/CMakeLists.txtline 307 registerstests/ShaderFusion.cppasagc_shader_fusion_tests. The heuristic searched for the full repository path.530320f90cconventions,windows,library-portability,eligibility,labelsandreportsucceeded.linux,relinker,relinker-asan,write-watchandregister-contextwere skipped.Delta since da820c49e5, unedited git diff output (test and debt file)
Findings
Blocking: none.
Non-blocking:
docs/dev/debt/libSceAgcVsh.mdis over the 1000-character debt-entry limit. The conventions result is a warning, not an error. Shortening that entry would clear it.sceAgcGetFusedShaderSize_0080and the unversioned size to differ for a GsFront/GsBack pair. The test'sHalvesconstructor setsGsFrontat line 103, so the assertion does reach the geometry branch. I did not run it. The hosted Windows success does not show which tests that job ran.Sources
github.com/boykopovar/AnyPS5@530320f90c/core/libs/prx/libSceAgc/tests/ShaderFusion.cpp (L103)github.com/boykopovar/AnyPS5@530320f90c/core/libs/prx/libSceAgc/tests/ShaderFusion.cpp (L329)github.com/boykopovar/AnyPS5@530320f90c/core/libs/prx/libSceAgc/Misc/src/ShaderFusion.cpp (L372-L378)github.com/boykopovar/AnyPS5@530320f90c/core/libs/prx/libSceAgc/CMakeLists.txt (L307)Not verified
ShaderFusionassertion and the rest of that test file were not run at this head.Export.cpp,CMakeLists.txtand the 48 shared files linked intolibSceAgcVshwere not re-read line by line in this pass. The delta sinceda820c49e5does not touch them. This comment is a re-check of the conventions result, the hosted results and that delta, not a full review of the implementation.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-01T11:47:17Z.
Review: CHANGES_REQUESTED
Checked the source list against
libSceAgc's, the new test (it pinssize != _0080and the dwordm_alignstore) and the earlier reviewers' points; those are addressed. One thing blocks the merge:sceAgcGetFusedShaderSizeis also defined by #8314 (Misc/src/ShaderFusion.cpp, forwarding to_0080), andDepends onstill says none. Whichever lands second leaves two definitions and breaks the build. Your decode of the 4.03 body (no call,back->num_sh_registers * 8, dwordm_align) says this PR's body is the firmware-exact one, so please agree with the #8314 author on a single definition (e.g. #8314 lands first and this PR replaces its body, or #8314 drops its alias) and list #8314 inDepends on.sceAgcAcbAtomicGds(cduV1f0dcGQ) inAcb/src/Control.cpp, which this module compiles in.core/libs/prx/libSceAgcVsh/Export.cpp:4still exportscduV1f0dcGQas a stub, so once #8314 is in the NID is exported twice (the Windows patcher rejects that). Decide which one the module keeps and update the stub and the debt entry for it.Rebase on top of #8314 once settled; the rest looks fine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T19:59:04Z.
Review: APPROVED
Reviewed — looks good
I reviewed head
b289ddc966ec47a1dec1f0487e90099a332ed814against basef2d874c1fdccf781c0fa5d86619bb5dd8894b958; I found no blocking issue, and the required hosted checks completed successfully.What I ran
Environment: Linux x86_64, Python 3.11.2, Git 2.39.5. I did not configure or build locally. The exact PR head and base were unchanged at the end. The PR and its declared dependency #8314 each preview cleanly against current
main; the stack check confirms #8314's exact head is included in #13940.The isolated precheck could not invoke the workspace-only ABI and test-quality helpers because those scripts are not in the PR snapshot. I ran both against the exact base/head from the review workspace and inspected their findings. I also read all 15 changed files, the current diff, dependency discussion, and hosted check conclusions.
Results
Selected unedited check output
Precheck conventions output:
Precheck ABI helper stderr (the helper was then run separately from the workspace):
Precheck test-quality helper stderr (the helper was then run separately from the workspace):
Hosted check conclusions on the reviewed head:
Negative control
Not run: no safe no-build negative-control mechanism exists for these C++ tests; proving the new assertions fail requires building and running a modified test target.
Findings
Blocking
None found in the reviewed diff.
Non-blocking
The firmware body comparisons, Windows PRX export-table comparison, and GPU test results are described by the author; I did not independently reproduce them. The ABI audit is lexical and cannot verify the linked runtime export table. The debt entry at
docs/dev/debt/libSceAgcVsh.md:10exceeds the convention's preferred length, but the hosted conventions check reports it as a warning.Sources
Not verified
I did not run a local build, CTest, the linked PRX export-table comparison, firmware disassembly comparison, or console tests. Linux and specialized hosted jobs were skipped. The GPU and firmware results in the PR description are author-reported evidence, not my runs.
To get this to a good state
No blocking change is needed for this review. If a new head changes the implementation, I will rerun the relevant no-build checks and review that head.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-06T13:29:55Z.
Review: CHANGES_REQUESTED
Re-checked head
8bf5e05: the source list, the new test and the CI results are fine, but the point from the last review is still open, and the branch does not match the earlier comment.e79f6c1606/f2c1bf584aare not ancestors; the PR is 3 commits on top ofmain), yet it still definessceAgcGetFusedShaderSizeinMisc/src/ShaderFusion.cpp:415and #8314 defines it too. Whichever lands second leaves two definitions. Please rebase onto #8314's head so the PR really stacks on it, drop the duplicate body here and keep only the extra test assertions.core/libs/prx/libSceAgcVsh/Export.cpp:9still exportscduV1f0dcGQ(sceAgcAcbAtomicGds) as a stub while the module compilesAcb/src/Control.cpp, where #8314 adds the real one. Once #8314 is in, the NID is exported twice and the Windows patcher rejects that. Drop the stub (and update thesceAgcAcbAtomicGdsline indocs/dev/debt/libSceAgcVsh.md, which says the real implementation is deliberately disabled), or decide the module keeps the stub and keep it out of the compiled sources.