feat(agc-driver): prepare shader variants registration did not predict #2917

Merged
XairRrR merged 1 commit from upstream-pr/2917 into main 2026-10-10 23:31:32 +00:00
XairRrR commented 2026-10-10 18:27:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-10T18:27:31Z.


What

PPSA05684 misses for its own pixel shaders, also after the fixed push slots of #2661 (main 197ffac9, the at-use path replaced by main's throw):
AGC driver: prepared shader artifact is missing for the requested static ABI: address=85899411712 stage=5 wave=64 pushOffset=128 pushCapacity=128
Before #2661 the same shaders missed with pushOffset=20 pushCapacity=108. With this branch the title prepares 6 such pixel shader variants at use in its first 7 minutes and goes on.

It links libSceAgc statically, so it builds the static ABI state itself and never calls the driver's sceAgcDriverResolve*Abi; registration cannot predict every state its draws use. This follows up the question in https://github.com/boykopovar/AnyPS5/pull/1902#issuecomment-6080349495.

SourceHandleFor and InvocationFor now prepare any missing variant at use, like #1836's deferred shaders and #1902's null pixel program: the artifact is logged once (Shader 0x... stage N has no artifact prepared at registration for the state of this draw or dispatch; preparing it at use) and kept with the snapshot. SourceHandleFor now also checks that the request refers to the registered code, as InvocationFor does. ARCHITECTURE.md describes the at-use path.

Tests: agc_driver_prepared_shaders and agc_driver_prepared_graphics now require an unpredicted dispatch or draw state to be prepared once and reused, and a dispatch registration did not predict to run (Registration); invalid requests still fail (misaligned push constants, code that is not the registered code, an invalid program).

Tested

  • Arch Linux (kernel 7.2.6), GCC 16.2.1, NVIDIA RTX 4070 Ti SUPER (driver 615.71.09), Release with BUILD_TESTING=ON.
  • Branch built alone; full ctest on main 57f96fd2: 697/698; the one failure, agc_driver_dcc_keys_first_write, fails the same way on plain main 57f96fd2. Conventions check passed.
  • Title: Uncharted: Legacy of Thieves Collection (PPSA05684), on its own bring-up branch.

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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4813482976 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2917). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-10-10T18:27:31Z. --- ### What PPSA05684 misses for its own pixel shaders, also after the fixed push slots of #2661 (main 197ffac9, the at-use path replaced by main's throw): `AGC driver: prepared shader artifact is missing for the requested static ABI: address=85899411712 stage=5 wave=64 pushOffset=128 pushCapacity=128` Before #2661 the same shaders missed with `pushOffset=20 pushCapacity=108`. With this branch the title prepares 6 such pixel shader variants at use in its first 7 minutes and goes on. It links libSceAgc statically, so it builds the static ABI state itself and never calls the driver's `sceAgcDriverResolve*Abi`; registration cannot predict every state its draws use. This follows up the question in https://github.com/boykopovar/AnyPS5/pull/1902#issuecomment-6080349495. `SourceHandleFor` and `InvocationFor` now prepare any missing variant at use, like #1836's deferred shaders and #1902's null pixel program: the artifact is logged once (`Shader 0x... stage N has no artifact prepared at registration for the state of this draw or dispatch; preparing it at use`) and kept with the snapshot. `SourceHandleFor` now also checks that the request refers to the registered code, as `InvocationFor` does. ARCHITECTURE.md describes the at-use path. Tests: `agc_driver_prepared_shaders` and `agc_driver_prepared_graphics` now require an unpredicted dispatch or draw state to be prepared once and reused, and a dispatch registration did not predict to run (`Registration`); invalid requests still fail (misaligned push constants, code that is not the registered code, an invalid program). ### Tested - Arch Linux (kernel 7.2.6), GCC 16.2.1, NVIDIA RTX 4070 Ti SUPER (driver 615.71.09), Release with `BUILD_TESTING=ON`. - Branch built alone; full ctest on main 57f96fd2: 697/698; the one failure, `agc_driver_dcc_keys_first_write`, fails the same way on plain main 57f96fd2. Conventions check passed. - Title: Uncharted: Legacy of Thieves Collection (PPSA05684), on its own bring-up branch. ### 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 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 - [x] AI-assisted: yes
tv7 commented 2026-10-10 18:51:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-10T18:51:09Z.


Tested on Marvel's Wolverine (PPSA03671), Windows 11, RTX 3070, GCC 15.2.0 UCRT Release.

Setup: main 1476f769 + #1940 + #757 + #2838 + this PR (1232fd6c) + #2922 for the longer message, plus local placeholders for 2 unnamed imports (Acm GTfJ64qFCPw, Pad zBsgF0q8DIM).

Without this PR (earlier run today: main b69270dd + #1940 + #757) the first presentation stopped at:
AGC driver: prepared shader artifact is missing for the requested static ABI: address=0x11d015f100 stage=5 (Fragment) wave=64 push 128/128

With this PR that shader is prepared at use and the run goes on:

Shader 0x11d015f100 stage 5 has no artifact prepared at registration for the state of this draw or dispatch; preparing it at use
Rect-list draw of shader 0x11d00c3300 has no rectangle for fragment shader 0x11d015f100; preparing it at draw
[videoout] presentation failed: AGC graphics: graphics interfaces disagree at location 0 (stage 0 output missing, stage 1 input vertex:f32x4; previous outputs:; parameter exports:; fragment parameters: 0<-0)

So the next stop is the rect-list pair: vertex 0x11d00c3300 exports no parameters, while the at-use fragment variant reads parameter 0. I have not checked yet whether the registered fragment variant had the same input, i.e. whether this comes from the at-use path or from the rectangle path itself. Still 0 frames presented. Happy to rerun a revision.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6100995733 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2917#issuecomment-6100995733). Originally posted by [tv7](https://github.com/tv7) on 2026-10-10T18:51:09Z. --- Tested on Marvel's Wolverine (PPSA03671), Windows 11, RTX 3070, GCC 15.2.0 UCRT Release. **Setup:** main 1476f769 + #1940 + #757 + #2838 + this PR (1232fd6c) + #2922 for the longer message, plus local placeholders for 2 unnamed imports (Acm `GTfJ64qFCPw`, Pad `zBsgF0q8DIM`). **Without this PR** (earlier run today: main b69270dd + #1940 + #757) the first presentation stopped at: `AGC driver: prepared shader artifact is missing for the requested static ABI: address=0x11d015f100 stage=5 (Fragment) wave=64 push 128/128` **With this PR** that shader is prepared at use and the run goes on: ``` Shader 0x11d015f100 stage 5 has no artifact prepared at registration for the state of this draw or dispatch; preparing it at use Rect-list draw of shader 0x11d00c3300 has no rectangle for fragment shader 0x11d015f100; preparing it at draw [videoout] presentation failed: AGC graphics: graphics interfaces disagree at location 0 (stage 0 output missing, stage 1 input vertex:f32x4; previous outputs:; parameter exports:; fragment parameters: 0<-0) ``` So the next stop is the rect-list pair: vertex 0x11d00c3300 exports no parameters, while the at-use fragment variant reads parameter 0. I have not checked yet whether the registered fragment variant had the same input, i.e. whether this comes from the at-use path or from the rectangle path itself. Still 0 frames presented. Happy to rerun a revision.
tv7 commented 2026-10-10 19:09:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by tv7 on 2026-10-10T19:09:27Z.


Follow-up: the stop after this PR is not from the at-use path. The registered variants of 0x11d015f100 read parameter 0 too, and the failing draw is an ordinary (non-rect) draw with vertex shader 0x11d00bd000, which exports no parameters. Details in #2975.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101159019 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2917#issuecomment-6101159019). Originally posted by [tv7](https://github.com/tv7) on 2026-10-10T19:09:27Z. --- Follow-up: the stop after this PR is not from the at-use path. The registered variants of 0x11d015f100 read parameter 0 too, and the failing draw is an ordinary (non-rect) draw with vertex shader 0x11d00bd000, which exports no parameters. Details in #2975.
adriadam10 commented 2026-10-10 23:31:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T23:31:29Z.


Checked on the PR merged onto current main: agc_driver_prepared_shaders* and agc_driver_prepared_graphics pass (also --repeat until-fail:20), five of them fail when the ShaderRegistry.cpp change is reverted, and the tests pin both the one-time preparation and the reuse of the artifact. The at-use path, the added registered-code check and the ARCHITECTURE.md entry look right; the confirmation on Wolverine from @tv7 covers a second title. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103339428 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2917#issuecomment-6103339428). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T23:31:29Z. --- Checked on the PR merged onto current main: `agc_driver_prepared_shaders*` and `agc_driver_prepared_graphics` pass (also `--repeat until-fail:20`), five of them fail when the `ShaderRegistry.cpp` change is reverted, and the tests pin both the one-time preparation and the reuse of the artifact. The at-use path, the added registered-code check and the ARCHITECTURE.md entry look right; the confirmation on Wolverine from @tv7 covers a second title. Merging once CI is green.
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!2917
No description provided.