fix(agc): skip registration-time preparation for unsupported shader types #1893

Merged
fisherjoey merged 1 commit from upstream-pr/1893 into main 2026-10-10 04:42:13 +00:00
fisherjoey commented 2026-10-08 22:51:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T22:51:19Z.


Closes #1892

What

PrepareRegistered throws AGC driver: unsupported registered shader type for any Shader::type outside 0, 1, 2, 4, 5, 6 and 7. Since #639 it runs for every RegisterShader, so one unknown type ends the run. Stray (PPSA02100, Unreal Engine 4) registers 13 shaders of type 8 at start-up. They have no SPI_SHADER_PGM_* registers and are never used by a draw or dispatch.

With this change:

  • At registration, an unsupported type is logged (Shader 0x… has unsupported registered shader type N; it is not prepared at registration) and no artifact is prepared.
  • Outside registration it still throws, now as AGC driver: unsupported registered shader type N.

Tested

Linux (Nobara 44, GCC), RTX 5070 Ti, NVIDIA 595.91.07.

New check UnsupportedTypeRegistration() in tests/execution/PreparedShaders.cpp. It registers a type 8 header with Stray's sh register table twice, and runs in every agc_driver_prepared_shaders mode.

ctest -R agc_driver_prepared_shaders
main 1be6f9f1 + the test only 4 of 5 fail (agc_driver_prepared_shaders, _indirect, _uncached, _debug) with AGC driver: unsupported registered shader type. _debug_failure passes, as it expects a failure.
this branch 5/5 pass

Stray on main + #861 + #1836: without this change it aborts at start-up with the error above. With it, all 13 type 8 registrations are skipped and the title reaches its window. It then stops on a separate, unrelated error.

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
  • No notes, investigation .md files or images added to the repository
  • Generic behaviour, not specific to one title
  • Depends on: none (related: #1836 defers shaders that fail to prepare; this type throws before that path)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4793730024 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1893). Originally posted by [fisherjoey](https://github.com/fisherjoey) on 2026-10-08T22:51:19Z. --- Closes #1892 ### What `PrepareRegistered` throws `AGC driver: unsupported registered shader type` for any `Shader::type` outside 0, 1, 2, 4, 5, 6 and 7. Since #639 it runs for every `RegisterShader`, so one unknown type ends the run. Stray (PPSA02100, Unreal Engine 4) registers 13 shaders of type 8 at start-up. They have no `SPI_SHADER_PGM_*` registers and are never used by a draw or dispatch. With this change: - At registration, an unsupported type is logged (`Shader 0x… has unsupported registered shader type N; it is not prepared at registration`) and no artifact is prepared. - Outside registration it still throws, now as `AGC driver: unsupported registered shader type N`. ### Tested Linux (Nobara 44, GCC), RTX 5070 Ti, NVIDIA 595.91.07. New check `UnsupportedTypeRegistration()` in `tests/execution/PreparedShaders.cpp`. It registers a type 8 header with Stray's sh register table twice, and runs in every `agc_driver_prepared_shaders` mode. | | `ctest -R agc_driver_prepared_shaders` | |---|---| | `main` 1be6f9f1 + the test only | 4 of 5 fail (`agc_driver_prepared_shaders`, `_indirect`, `_uncached`, `_debug`) with `AGC driver: unsupported registered shader type`. `_debug_failure` passes, as it expects a failure. | | this branch | 5/5 pass | Stray on `main` + #861 + #1836: without this change it aborts at start-up with the error above. With it, all 13 type 8 registrations are skipped and the title reaches its window. It then stops on a separate, unrelated error. ### 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 - [x] No notes, investigation `.md` files or images added to the repository - [x] Generic behaviour, not specific to one title - [x] Depends on: none (related: #1836 defers shaders that fail to prepare; this type throws before that path) - [x] AI-assisted: yes
EdouardSence commented 2026-10-09 10:37:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EdouardSence on 2026-10-09T10:37:53Z.


Another title that needs this: Rise of the Ronin (PPSA04540).

Setup: Linux, RX 9070 XT (RADV). Base is main 43972e69 + #1836 + #1837 + #2105 + #2153, plus local throwing placeholders for imports the title never calls in these runs.

  • Without this PR, the title stops about 3 min 40 s in, while it loads its shaders: AGC driver: unsupported registered shader type.
  • With it, the log shows Shader ... has unsupported registered shader type 8; it is not prepared at registration for its type 8 shaders. The title goes on to a later, unrelated stop at about 4 min 40 s (NGS2: system option flags are not implemented).

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6079216889 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1893#issuecomment-6079216889). Originally posted by [EdouardSence](https://github.com/EdouardSence) on 2026-10-09T10:37:53Z. --- Another title that needs this: Rise of the Ronin (PPSA04540). **Setup:** Linux, RX 9070 XT (RADV). Base is `main` 43972e69 + #1836 + #1837 + #2105 + #2153, plus local throwing placeholders for imports the title never calls in these runs. - Without this PR, the title stops about 3 min 40 s in, while it loads its shaders: `AGC driver: unsupported registered shader type`. - With it, the log shows `Shader ... has unsupported registered shader type 8; it is not prepared at registration` for its type 8 shaders. The title goes on to a later, unrelated stop at about 4 min 40 s (`NGS2: system option flags are not implemented`). *Tested and written by Claude (AI assistant) on a contributor's machine.*
popcoder565 commented 2026-10-09 15:23:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:23:14Z.


Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head 21612855, merged onto main d70b8998 in one build with 33 other AGC/shader PRs that had no Windows run.

  • This PR's tests pass: agc_driver_prepared_shaders, agc_driver_prepared_shaders_indirect, agc_driver_prepared_shaders_uncached, agc_driver_prepared_shaders_debug, agc_driver_prepared_shaders_debug_failure. None of them reported skipping a case.
  • Full ctest in that build: 514 of 515. The one failure is #2257's new test, which is registered without the Windows PATH setup.

No title was run.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6083886570 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1893#issuecomment-6083886570). Originally posted by [popcoder565](https://github.com/popcoder565) on 2026-10-09T15:23:14Z. --- Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head `21612855`, merged onto `main` d70b8998 in one build with 33 other AGC/shader PRs that had no Windows run. - This PR's tests pass: `agc_driver_prepared_shaders`, `agc_driver_prepared_shaders_indirect`, `agc_driver_prepared_shaders_uncached`, `agc_driver_prepared_shaders_debug`, `agc_driver_prepared_shaders_debug_failure`. None of them reported skipping a case. - Full ctest in that build: 514 of 515. The one failure is #2257's new test, which is registered without the Windows `PATH` setup. No title was run. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
SleglJan commented 2026-10-10 00:52:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-10T00:52:24Z.


A third title, with a different type: 007 First Light (PPSA11386 v01.018.000) on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1), RTX 3080 (NVIDIA 615.71.09). Base is main 58706dc2 (carried in by #2500's branch) plus the PRs that get the title this far: SleglJan/AnyPS5#15 to #21, #1964, #2282, #2327, #2347, #2471, #2480, #2500 (the last three closed by the intake pause) and #1184's ResourceTracker.cpp change.

  • Without this PR, start-up stops after 654 shader-cache writes with AGC driver: unsupported registered shader type. With it (21612855), 10 of the 581 registered shaders are logged as Shader 0x… has unsupported registered shader type 3; it is not prepared at registration, and start-up goes on to at least 725 shader-cache writes and an unrelated recompiler stop (GetSamplerResource dword 3 is not a valid runtime value; chain: BitReverse32(Immediate)).
  • Unlike the type 8 shaders in the description, these type 3 headers carry program registers. APS5_TRACE_SHADER_REGS=all lists sh registers 0x148/0x149, 0x10a/0x10b and 0x100 (twice), plus context registers 0x286, 0x287, 0x2d6 and 0x2db; 0x148/0x149 and 0x10b are what PrepareRegistered reads for type 5. So for type 3 the skip may only defer a failure to the first use of these shaders. Neither run gets far enough to show what happens then.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6091840810 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1893#issuecomment-6091840810). Originally posted by [SleglJan](https://github.com/SleglJan) on 2026-10-10T00:52:24Z. --- A third title, with a different type: 007 First Light (PPSA11386 v01.018.000) on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1), RTX 3080 (NVIDIA 615.71.09). Base is `main` 58706dc2 (carried in by #2500's branch) plus the PRs that get the title this far: SleglJan/AnyPS5#15 to #21, #1964, #2282, #2327, #2347, #2471, #2480, #2500 (the last three closed by the intake pause) and #1184's `ResourceTracker.cpp` change. - Without this PR, start-up stops after 654 shader-cache writes with `AGC driver: unsupported registered shader type`. With it (21612855), 10 of the 581 registered shaders are logged as `Shader 0x… has unsupported registered shader type 3; it is not prepared at registration`, and start-up goes on to at least 725 shader-cache writes and an unrelated recompiler stop (`GetSamplerResource dword 3 is not a valid runtime value; chain: BitReverse32(Immediate)`). - Unlike the type 8 shaders in the description, these type 3 headers carry program registers. `APS5_TRACE_SHADER_REGS=all` lists sh registers 0x148/0x149, 0x10a/0x10b and 0x100 (twice), plus context registers 0x286, 0x287, 0x2d6 and 0x2db; 0x148/0x149 and 0x10b are what `PrepareRegistered` reads for type 5. So for type 3 the skip may only defer a failure to the first use of these shaders. Neither run gets far enough to show what happens then. AI-assisted: 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!1893
No description provided.