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

Closed
alfalfa-star wants to merge 2 commits from upstream-pr/2848 into main
alfalfa-star commented 2026-10-10 16:36:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-10T16:36:53Z.


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:

  • agc_commands: new testOcclusionQuerySizes checks type 0, the end size, and that types 1, 2 and 0xff throw.
  • Full ctest on main 90c152e8 merged with this branch, #2851 and #2853: 813/813 passed (4 skipped for lack of a display).
  • tools/check_conventions.py --base upstream/main passed.

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 #2847, so whichever merges second needs a rebase
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4812781323 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2848). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-10T16:36:53Z. --- ### 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](https://github.com/OpenAGC/OpenAGC/blob/main/src/game_compat.c), [prosper](https://github.com/mattias800/prosper) (`hle_agc_getsize.cpp`) and [SharpProspero](https://github.com/SvenGDK/SharpProspero/blob/main/src/SharpProspero/Interop/Agc/SceAgc.cs) 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: - `agc_commands`: new `testOcclusionQuerySizes` checks type 0, the end size, and that types 1, 2 and 0xff throw. - Full `ctest` on `main` 90c152e8 merged with this branch, #2851 and #2853: 813/813 passed (4 skipped for lack of a display). - `tools/check_conventions.py --base upstream/main` passed. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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. Touches `libSceAgc/tests/Commands.cpp` like #2847, so whichever merges second needs a rebase - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-10 16:38:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T16:38:11Z.


Progress report (af45296 → cb95447)

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

✅ 2 implemented
Library Name
libSceAgc sceAgcDcbBeginOcclusionQueryGetSize
libSceAgc sceAgcDcbEndOcclusionQueryGetSize
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6099782398 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2848#issuecomment-6099782398). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T16:38:11Z. --- <!-- progress-report --> ### Progress report (af45296 → cb95447) 📈 **System libraries**: 85.52% (+0.06%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceAgc | `sceAgcDcbBeginOcclusionQueryGetSize` | | libSceAgc | `sceAgcDcbEndOcclusionQueryGetSize` | </details>
oneandonlydean commented 2026-10-10 19:18:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T19:18:00Z.


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

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101235808 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2848#issuecomment-6101235808). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T19:18:00Z. --- Same question as #2847: which title calls `sceAgcDcbBeginOcclusionQueryGetSize` on main?
screamm commented 2026-10-10 22:41:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T22:41:46Z.


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.

  • ctest -j8 -E "^agc_driver_|^video_out_flip" passes 462/462, including the agc_command unit tests this change extends.
  • The GPU execution tests (agc_driver_*) were not run; on this host two of them fail on unchanged main for unrelated reasons (#2755/#2777 family).

Validation run with Claude Code assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6102961287 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2848#issuecomment-6102961287). Originally posted by [screamm](https://github.com/screamm) on 2026-10-10T22:41:46Z. --- 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. - `ctest -j8 -E "^agc_driver_|^video_out_flip"` passes 462/462, including the `agc_command` unit tests this change extends. - The GPU execution tests (`agc_driver_*`) were not run; on this host two of them fail on unchanged `main` for unrelated reasons (#2755/#2777 family). Validation run with Claude Code assistance.
adriadam10 commented 2026-10-11 00:08:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T00:08:55Z.

Review: CHANGES_REQUESTED


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.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5481281071 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2848#pullrequestreview-5481281071). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T00:08:55Z. **Review:** CHANGES_REQUESTED --- 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.
adriadam10 commented 2026-10-11 09:39:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T09:39:53Z.

Review: CHANGES_REQUESTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5482785424 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2848#pullrequestreview-5482785424). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T09:39:53Z. **Review:** CHANGES_REQUESTED --- 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 commented 2026-10-11 09:45:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-11T09:45:11Z.


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

  • LEGO Horizon Adventures (PPSA14632) aborts after about 35 s at color views of several array slices are unsupported (#2102). My local test branch gets past that and other stops; there it played 385 s with scripted input, through New Game and a save, without calling sceAgcDcbBeginOcclusionQueryGetSize.
  • Kena: Bridge of Spirits (PPSA01802) crashes in game code after about 60 s, with no not implemented line before it.

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 90c152e8 merged with this branch, #2851 and #2853; tools/check_conventions.py passes.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107712722 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2848#issuecomment-6107712722). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-11T09:45:11Z. --- No title I can run reaches `sceAgcDcbBeginOcclusionQueryGetSize` on current `main` (90c152e8): - LEGO Horizon Adventures (PPSA14632) aborts after about 35 s at `color views of several array slices are unsupported` (#2102). My local test branch gets past that and other stops; there it played 385 s with scripted input, through New Game and a save, without calling `sceAgcDcbBeginOcclusionQueryGetSize`. - Kena: Bridge of Spirits (PPSA01802) crashes in game code after about 60 s, with no `not implemented` line before it. 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` 90c152e8 merged with this branch, #2851 and #2853; `tools/check_conventions.py` passes. AI-assisted: yes (Claude Code)
oneandonlydean commented 2026-10-14 02:40:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:40:04Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159670455 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2848#issuecomment-6159670455). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:40:04Z. --- 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.

Pull request closed

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!2848
No description provided.