feat(libSceAgcDriver): keep the HS offchip parameters as the console reports them #15868

Merged
zaryabzip merged 2 commits from upstream-pr/15868 into main 2026-11-09 21:26:43 +00:00
zaryabzip commented 2026-11-04 20:33:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by zaryabzip on 2026-11-04T20:33:52Z.


What

sceAgcDriverGetHsOffchipParam stops throwing, and sceAgcDriverSetHsOffchipParam stops ignoring its arguments. The two now share one stored pair, which behaves as a console title measured it in PS5_Vulkan's hardware findings, in the same paragraph as the tessellation factor ring. In a fresh title, Get read (0, 0). Set(granularity, buffering) kept the granularity in 2 bits and the buffering in 9, so a buffering of 1023 read back as 511.

main already follows that paragraph for the ring: sceAgcDriverGetTFRing reports the console's default (debt entry "Tessellation factor ring"). The parameters are the next sentence.

Call Here now main
Get before any Set 0, (0, 0) throws NotImplemented
Set(g, b), g <= 3, b <= 511 0; Get returns (g, b) 0, nothing kept
Set(g, 1023) 0; Get returns (g, 511) 0, nothing kept
Set with g > 3, or b above 511 other than 1023 throws: masked or clamped is not measured 0, nothing kept
Get with a null output throws std::invalid_argument, as sceAgcDriverGetTFRing does throws NotImplemented

Signature. Set was declared as three uint64_ts and ignored them, a form with no source. It now takes (uint16_t granularity, uint16_t buffering):

  • ps5-vulkan declares it that way and calls it with Get's two values;
  • the console round trip above passes the same pair.

Get's parameters are renamed to match. Nothing in the tree calls either function.

Effect. Nothing reads the pair. Tessellated draws run as Vulkan tessellation stages, as the ring's entry already says, so this only answers titles that query or set it. The homebrew PPSA99011 imports Get, per its existing debt entry. That entry moves next to the ring's, says what is now kept, and keeps the unmeasured parts. Get was counted as a stub, so libSceAgcDriver gains one function.

Test. agc_tessellation_factor_ring gains CheckHsOffchipParam:

  • Get reports (0, 0) first;
  • Set round-trips (2, 256) and (3, 511), and stores 1023 as 511, also read from another thread;
  • both null outputs are refused.

No row asks an unmeasured value to throw. The test can't build on main, because Set's declaration changes there. As a control, putting main's bodies back under the new signature (Get throwing, Set keeping nothing) makes the first row fail.

Overlap: git merge-tree merges this cleanly with main and with the other open pull requests that touch these six files and merge with main, almost all of them through the debt file. The one exception is EagleBearerYS's #6146. In libSceAgcDriver.md it deletes the "HTILE address of a depth array slice" line, right next to the sceAgcDriverGetHsOffchipParam line this PR moves to Functional. Both deletions are wanted, so whichever PR lands second keeps both.

Tested

  • WSL2 and Windows, by me at a3cf940700 (comment):
    • WSL2: Ubuntu 24.04.5, GCC 13.3.0, Release, merged onto main b611e634f7.
    • Windows: Windows 11 Home 25H2, WinLibs GCC 15.2.0 r7, Release, on the base 638187daec.
    • On both, agc_tessellation_factor_ring passes, and --repeat until-fail:3 passes every round. No agc_unsupported test is registered.
    • With main's bodies under the new signature (Set storing nothing, Get not implemented), it aborts with "sceAgcDriverGetHsOffchipParam not implemented".

Checked so far, on macOS (arm64, where no full build is possible):

  • The changed files pass an x86-64 clang++ -fsyntax-only.
  • tools/check_conventions.py --base main passes.
  • tools/progress.py --module libSceAgcDriver reports sceAgcDriverGetHsOffchipParam as newly implemented, with nothing else changed.

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, CPU-side state only
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5161185860 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15868). Originally posted by [zaryabzip](https://github.com/zaryabzip) on 2026-11-04T20:33:52Z. --- ### What `sceAgcDriverGetHsOffchipParam` stops throwing, and `sceAgcDriverSetHsOffchipParam` stops ignoring its arguments. The two now share one stored pair, which behaves as a console title measured it in [PS5_Vulkan's hardware findings](https://github.com/mihawk-99/PS5_Vulkan/blob/ace98a99460c95a8d2821a9e33935c7b71070f7f/docs/HARDWARE_FINDINGS.md#L3415-L3429), in the same paragraph as the tessellation factor ring. In a fresh title, `Get` read (0, 0). `Set(granularity, buffering)` kept the granularity in 2 bits and the buffering in 9, so a buffering of 1023 read back as 511. `main` already follows that paragraph for the ring: `sceAgcDriverGetTFRing` reports the console's default (debt entry "Tessellation factor ring"). The parameters are the next sentence. | Call | Here now | `main` | |---|---|---| | `Get` before any `Set` | 0, (0, 0) | throws `NotImplemented` | | `Set(g, b)`, `g <= 3`, `b <= 511` | 0; `Get` returns (g, b) | 0, nothing kept | | `Set(g, 1023)` | 0; `Get` returns (g, 511) | 0, nothing kept | | `Set` with `g > 3`, or `b` above 511 other than 1023 | throws: masked or clamped is not measured | 0, nothing kept | | `Get` with a null output | throws `std::invalid_argument`, as `sceAgcDriverGetTFRing` does | throws `NotImplemented` | **Signature.** `Set` was declared as three `uint64_t`s and ignored them, a form with no source. It now takes `(uint16_t granularity, uint16_t buffering)`: - [ps5-vulkan](https://github.com/mpereiraesaa/ps5-vulkan/blob/e6d3c3f82f3c8a574e28c174b15b287f9c0ecc6d/native/graphics_queue_ps5.c#L45-L56) declares it that way and calls it with `Get`'s two values; - the console round trip above passes the same pair. `Get`'s parameters are renamed to match. Nothing in the tree calls either function. **Effect.** Nothing reads the pair. Tessellated draws run as Vulkan tessellation stages, as the ring's entry already says, so this only answers titles that query or set it. The homebrew PPSA99011 imports `Get`, per its existing debt entry. That entry moves next to the ring's, says what is now kept, and keeps the unmeasured parts. `Get` was counted as a stub, so libSceAgcDriver gains one function. **Test.** `agc_tessellation_factor_ring` gains `CheckHsOffchipParam`: - `Get` reports (0, 0) first; - `Set` round-trips (2, 256) and (3, 511), and stores 1023 as 511, also read from another thread; - both null outputs are refused. No row asks an unmeasured value to throw. The test can't build on `main`, because `Set`'s declaration changes there. As a control, putting `main`'s bodies back under the new signature (`Get` throwing, `Set` keeping nothing) makes the first row fail. Overlap: `git merge-tree` merges this cleanly with `main` and with the other open pull requests that touch these six files and merge with `main`, almost all of them through the debt file. The one exception is EagleBearerYS's #6146. In `libSceAgcDriver.md` it deletes the "HTILE address of a depth array slice" line, right next to the `sceAgcDriverGetHsOffchipParam` line this PR moves to Functional. Both deletions are wanted, so whichever PR lands second keeps both. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - **WSL2 and Windows, by me** at `a3cf940700` ([comment](https://github.com/boykopovar/AnyPS5/pull/15868#issuecomment-6642539217)): - WSL2: Ubuntu 24.04.5, GCC 13.3.0, Release, merged onto `main` `b611e634f7`. - Windows: Windows 11 Home 25H2, WinLibs GCC 15.2.0 r7, Release, on the base `638187daec`. - On both, `agc_tessellation_factor_ring` passes, and `--repeat until-fail:3` passes every round. No `agc_unsupported` test is registered. - With `main`'s bodies under the new signature (`Set` storing nothing, `Get` not implemented), it aborts with "sceAgcDriverGetHsOffchipParam not implemented". Checked so far, on macOS (arm64, where no full build is possible): - The changed files pass an x86-64 `clang++ -fsyntax-only`. - `tools/check_conventions.py --base main` passes. - `tools/progress.py --module libSceAgcDriver` reports `sceAgcDriverGetHsOffchipParam` as newly implemented, with nothing else changed. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> n/a, CPU-side state only - [x] AI-assisted: <!-- yes / no --> yes (Claude Code)
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!15868
No description provided.