Skip to content

feat(agc): implement the occlusion query size queries - #2848

Closed
alfalfa-star wants to merge 2 commits into
boykopovar:mainfrom
alfalfa-star:feat/agc-occlusion-query-sizes
Closed

alfalfa-star wants to merge 2 commits into
boykopovar:mainfrom
alfalfa-star:feat/agc-occlusion-query-sizes

Conversation

@alfalfa-star

@alfalfa-star alfalfa-star commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What

Implements the two libSceAgc occlusion query size queries that still called NotImplemented_nid_no_patch:

  • sceAgcDcbBeginOcclusionQueryGetSize(type): 16 bytes for type 0. Every other type throws, type 1 included.
  • sceAgcDcbEndOcclusionQueryGetSize(): 16 bytes.

The builders are inline in the SDK and not exported, so these sizes can't be checked against a packet the library writes. Sources:

  • End, 16 bytes: OpenAGC, prosper (hle_agc_getsize.cpp) and SharpProspero all agree.
  • Begin: SharpProspero says the size depends on the query mode argument. OpenAGC gives 16 for type 0 and 288 for type 1 and reads the type as a byte. prosper returns 16 without reading an argument. OpenAGC's 288 for type 1 has no second source, so type 1 throws until a title uses it. For other types OpenAGC returns 0; here they throw.

All of this is recorded in TechnicalDebt.

Tested

Linux (Arch, GCC), Release build:

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 in TechnicalDebt
  • 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. Touches libSceAgc/tests/Commands.cpp like feat(agc): implement the DCB and ACB marker span builders #2847, so whichever merges second needs a rebase
  • AI-assisted: yes

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Progress report (af45296 → cb95447)

📈 System libraries: 85.52% (+0.06%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceAgc sceAgcDcbBeginOcclusionQueryGetSize
libSceAgc sceAgcDcbEndOcclusionQueryGetSize

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Same question as #2847: which title calls sceAgcDcbBeginOcclusionQueryGetSize on main?

@screamm

screamm commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Windows validation of the current head 81fc6ac4 merged onto main 262c0316.

Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including the libs target.

Validation run with Claude Code assistance.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 10, 2026

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the diff against the sources it cites. The end size (16) and type 0 (16) agree with OpenAGC and prosper. Three things before this can merge:

  • @oneandonlydean's question above is still open: which title calls sceAgcDcbBeginOcclusionQueryGetSize on main? A title ID and the log line where it stops are needed.
  • Stats.cpp:26: 288 for type 1 has a single source (OpenAGC's game_compat.c). prosper's console golden returns 16 without setting an argument, and SharpProspero declares the argument as uint queryMode, so neither confirms it. A value no title or second reference backs should throw like the other types; keep type 0 and the end size, and leave 288 in TechnicalDebt as unimplemented until a title shows type 1.
  • tests/Commands.cpp now conflicts with main (same spot as #2847's additions). Please rebase and rerun agc_commands; the type 1 check becomes an expectFailure case.

alfalfa-star and others added 2 commits October 11, 2026 11:35
sceAgcDcbBeginOcclusionQueryGetSize returns 16 bytes for query type 0
and 288 for type 1, and sceAgcDcbEndOcclusionQueryGetSize returns 16.
Other query types throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 288 bytes for type 1 come from OpenAGC alone; prosper's console
golden passes no type and SharpProspero declares the argument as a uint
queryMode. Type 1 now throws like the other unknown types until a title
uses it, and TechnicalDebt keeps the value as unconfirmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alfalfa-star
alfalfa-star force-pushed the feat/agc-occlusion-query-sizes branch from 81fc6ac to cb95447 Compare October 11, 2026 09:35
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 11, 2026

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the rebase and for making type 1 throw; those two points are done, and agc_commands fails without the change as it should.

One thing is still open, the same one @oneandonlydean asked above: which title calls sceAgcDcbBeginOcclusionQueryGetSize (or the End form) on main? A title ID and the log line where it stops are needed before merging. If none does yet, say so in the description and we can decide whether the three agreeing sources for 16/16 are enough.

@alfalfa-star

Copy link
Copy Markdown
Contributor Author

No title I can run reaches sceAgcDcbBeginOcclusionQueryGetSize on current main (90c152e):

I'm converting this to a draft until a title stops at it. Then I'll post the title ID and the log line and mark it ready.

Changed (rebased onto main, which resolves the tests/Commands.cpp conflict):

  • Type 1 now throws like the other unknown types; only type 0 returns 16. The 288 stays in TechnicalDebt as unconfirmed, with why: prosper passes no type and SharpProspero declares a uint queryMode.
  • agc_commands checks type 1 with expectFailure.

Tested: Linux, GCC, Release, RX 9070 XT (RADV): full ctest 813/813 (4 video_out_flip_* skipped) on main 90c152e merged with this branch, #2851 and #2853; tools/check_conventions.py passes.

AI-assisted: yes (Claude Code)

@alfalfa-star
alfalfa-star marked this pull request as draft October 11, 2026 09:45
RINNECODER added a commit to RINNECODER/AnyPS5 that referenced this pull request Oct 11, 2026
…l bridge (#373)

* Apply upstream open AGC PRs for the remaining stubbed imports

Ports upstream boykopovar/AnyPS5 open PRs into core/libs/prx (libs and
their tests only; docs excluded):
- boykopovar#2847 DCB/ACB marker span builders
- boykopovar#2848 occlusion query size queries
- boykopovar#2849 submit validation reported as unavailable
- boykopovar#2850 disabled shader instrumentation accepted
- boykopovar#2851 GPU capture reported as unavailable, shader debugging status
- boykopovar#1060 sceAgcAcquireMemSetEngine

Conflicts between the PRs (Unimplemented.cpp stubs and shared test
files) were resolved by keeping every change from both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Port libSceAgcDriver leaf imports and remaining libSceAgc rows to the Metal bridge

Binds the 35 libSceAgcDriver imports and 17 libSceAgc imports through
SceAgcImports without dereferencing guest pointers on the host:

- Driver leaf exports (resource registration, capture, submit
  validation, equeue queries) run the upstream bodies through prx bridge
  descriptors (upstream-prx/AgcDriver.cpp); the 7-argument registrations
  read user data from the caller stack.
- ACB flip and rendering wait emit the Metal driver packets, as the DCB
  rows do.
- Marker spans, occlusion sizes, shader instrumentation, AcquireMemSetEngine
  and branch _0300 patchers reuse upstream encoders on host copies.
- GetRegisterDefaults2(+Internal) publish the upstream tables in a guest
  window above the gate table; Create/UpdatePrimState run on host copies
  of the stage type and special registers.

New CTest anyps5_cpu_agc_driver_leaf is in NATIVE_REQUIRED_TESTS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 11, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants