fix(agc): skip prim state preparation for a patch/hull mismatch #2293

Merged
MichonGoddijn231849 merged 1 commit from upstream-pr/2293 into main 2026-10-10 04:46:49 +00:00
MichonGoddijn231849 commented 2026-10-09 14:52:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T14:52:25Z.


What

Since #639, sceAgcCreatePrimState also resolves the graphics ABI ahead of time, and that resolve throws when the primitive type is a patch list without HS_EN, or a hull stage is set with another primitive type. GTA V (PPSA04264) creates such a prim state while it loads, so on current main it aborts a few seconds after launch with AGC graphics: VGT_SHADER_STAGES_EN=0x2002000: Patch topology and HS_EN disagree.

No draw can use a state like that, so the ahead-of-time preparation is skipped for it and the packed registers are still returned. A draw that does use such a state still fails in the draw-time check, as before. Bit 2 of VGT_SHADER_STAGES_EN is HS_EN, not an NGG bit, so the constant is renamed.

The fix and its test are by @CouchRiv, who prepared it on Linux and asked me to open it.

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080, MinGW-w64 GCC 15.2.0, on main d70b8998.

  • agc_shader_helpers (with the new case) and guest_shader_link pass.
  • GTA V (PPSA04264): no longer stops on the patch/HS_EN mismatch. It then stops at the next registration-time error, shader image heap capacity exceeded (#1789).
  • @CouchRiv: the new case fails on main and passes with the change; full ctest 516/516 on RADV and lavapipe.

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
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes. Written with Claude (Anthropic); I reviewed and tested it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4802067557 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2293). Originally posted by [MichonGoddijn231849](https://github.com/MichonGoddijn231849) on 2026-10-09T14:52:25Z. --- ### What Since #639, `sceAgcCreatePrimState` also resolves the graphics ABI ahead of time, and that resolve throws when the primitive type is a patch list without HS_EN, or a hull stage is set with another primitive type. GTA V (PPSA04264) creates such a prim state while it loads, so on current `main` it aborts a few seconds after launch with `AGC graphics: VGT_SHADER_STAGES_EN=0x2002000: Patch topology and HS_EN disagree`. No draw can use a state like that, so the ahead-of-time preparation is skipped for it and the packed registers are still returned. A draw that does use such a state still fails in the draw-time check, as before. Bit 2 of `VGT_SHADER_STAGES_EN` is HS_EN, not an NGG bit, so the constant is renamed. The fix and its test are by @CouchRiv, who prepared it on Linux and asked me to open it. ### Tested Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080, MinGW-w64 GCC 15.2.0, on `main` d70b8998. - `agc_shader_helpers` (with the new case) and `guest_shader_link` pass. - GTA V (PPSA04264): no longer stops on the patch/HS_EN mismatch. It then stops at the next registration-time error, `shader image heap capacity exceeded` (#1789). - @CouchRiv: the new case fails on `main` and passes with the change; full `ctest` 516/516 on RADV and lavapipe. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [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. Written with Claude (Anthropic); I reviewed and tested it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-09 21:12:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T21:12:01Z.


I updated PR #2066 onto current main and moved its regression cases into a dedicated helper, so the test additions no longer share the same insertion hunk. #2066 covers optional geometry output register handling; #2293 covers the patch/hull mismatch path. They are separate fixes with no dependency.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6089338723 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2293#issuecomment-6089338723). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T21:12:01Z. --- I updated PR #2066 onto current `main` and moved its regression cases into a dedicated helper, so the test additions no longer share the same insertion hunk. #2066 covers optional geometry output register handling; #2293 covers the patch/hull mismatch path. They are separate fixes with no dependency.
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!2293
No description provided.