fix(agc): defer registered compute shaders without specials to dispatch #2627

Merged
oneandonlydean merged 1 commit from upstream-pr/2627 into main 2026-10-10 08:53:29 +00:00
oneandonlydean commented 2026-10-10 08:29:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T08:29:49Z.


Carrying @AlxcBTW's fix for #2580 while PR intake is paused. The change is theirs (from AlxcBTW/AnyPS5:fix/agc-compute-without-specials-v2, d5655a45, the version rebased onto the deferred preparation in PlanRegistered).

What

A registered compute shader whose header has no specials is still validated at registration, then deferred like the other shaders that can't be prepared there. It is prepared at its first dispatch, with the wave size from the initiator's CS_W32_EN, which Dispatch.cpp already reads.

Why

PPSA99005 (ps5-opengl showcase) stops when it registers its compute shaders:

AGC driver: shader metadata is outside the registered header

A registered compute shader takes its wave size from its header's specials (dispatch_modifier), and registration read them without a null check. ps5-opengl writes the specials pointer only for linked graphics stages and passes the compute wave size in the dispatch initiator instead (sceAgcCbDispatch(..., m->compute_wave_size == 32 ? 0x8000 : 0)).

Tested

  • The author's runs on Windows 11: agc_driver_prepared_shaders covers a header without specials deferred to dispatch and run as wave32 and wave64, while a header with specials and no artifact still throws. Without the change, registration throws.
  • With the change the showcase gets past registration and reaches ready GL=4.6 (Core Profile) Mesa 26.2.0 (the chain is in #2026).
  • tools/check_conventions.py passes, and the branch merges cleanly with current main.

Fixes #2580

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:4809899698 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2627). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T08:29:49Z. --- Carrying @AlxcBTW's fix for #2580 while PR intake is paused. The change is theirs (from `AlxcBTW/AnyPS5:fix/agc-compute-without-specials-v2`, d5655a45, the version rebased onto the deferred preparation in `PlanRegistered`). ### What A registered compute shader whose header has no specials is still validated at registration, then deferred like the other shaders that can't be prepared there. It is prepared at its first dispatch, with the wave size from the initiator's `CS_W32_EN`, which `Dispatch.cpp` already reads. ### Why PPSA99005 (ps5-opengl showcase) stops when it registers its compute shaders: ``` AGC driver: shader metadata is outside the registered header ``` A registered compute shader takes its wave size from its header's specials (`dispatch_modifier`), and registration read them without a null check. ps5-opengl writes the specials pointer only for linked graphics stages and passes the compute wave size in the dispatch initiator instead (`sceAgcCbDispatch(..., m->compute_wave_size == 32 ? 0x8000 : 0)`). ### Tested - The author's runs on Windows 11: `agc_driver_prepared_shaders` covers a header without specials deferred to dispatch and run as wave32 and wave64, while a header with specials and no artifact still throws. Without the change, registration throws. - With the change the showcase gets past registration and reaches `ready GL=4.6 (Core Profile) Mesa 26.2.0` (the chain is in #2026). - `tools/check_conventions.py` passes, and the branch merges cleanly with current `main`. Fixes #2580 ### 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 - [x] AI-assisted: yes
adriadam10 commented 2026-10-10 08:53:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T08:53:26Z.


Checked on Linux: build + prepared_shaders* ctest group green; the new RegistrationWithoutSpecials case fails without the ShaderRegistry.cpp change. Header with specials and no artifact still throws. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6095863194 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2627#issuecomment-6095863194). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T08:53:26Z. --- Checked on Linux: build + `prepared_shaders*` ctest group green; the new `RegistrationWithoutSpecials` case fails without the `ShaderRegistry.cpp` change. Header with specials and no artifact still throws. 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!2627
No description provided.