fix(diagnostics): capture failed shader preparation requests #2313

Merged
JulioCacko merged 1 commit from upstream-pr/2313 into main 2026-10-10 06:39:38 +00:00
JulioCacko commented 2026-10-09 15:17:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JulioCacko on 2026-10-09T15:17:35Z.


What

Shader preparation failures can occur before the existing request capture point. With APS5_DUMP_SHADERS set, serialize the failed preparation request and rethrow the original exception. Route registered compute/graphics and unregistered compute preparation through one wrapper; a failed diagnostic write must not replace the original preparation error.

The regression verifies disabled capture writes nothing, enabled capture matches the complete serialized request, replay round-trips, and the original failure message is preserved. A CTest resource lock prevents the prepared-shader variants from racing on their shared diagnostic fixture filename. No proprietary shader dumps or title data are included.

Upstream's overlap tool reports nearby edits in #2257 (deferred preparation), #2261 (NGG workgroups), #2285 (draw offsets), and #2302 (user-data call targets). I inspected those patches: they implement separate behavior rather than this failure-capture wrapper. There is no functional dependency on them, but their merge order can require rebasing this PR's call sites/public declaration. This branch merges cleanly with current main.

Tested

Windows 11 x64, MinGW GCC, RelWithDebInfo, NVIDIA GeForce RTX 3070. Focused build passed; agc_driver_prepared_shaders and its indirect/uncached/debug/debug_failure modes passed 5/5 with ANYPS5_REQUIRE_VULKAN=1, no skips (each 0.45-1.13 s). The debug_failure mode passed its expected-failure check. The branch/title/body conventions check passed. Built and tested with the integrated contribution set on upstream d70b8998; this branch contains only the diagnostic capture change and its test resource lock.

Checklist

  • Based on current main; open-PR overlap checked before submission
  • One topic per PR
  • No new code comments or investigation files in the repository
  • Generic behavior; preparation failures continue to throw
  • Depends on: none
  • AI-assisted: yes; reviewed and submitted by the author
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4802363772 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2313). Originally posted by [JulioCacko](https://github.com/JulioCacko) on 2026-10-09T15:17:35Z. --- ### What Shader preparation failures can occur before the existing request capture point. With `APS5_DUMP_SHADERS` set, serialize the failed preparation request and rethrow the original exception. Route registered compute/graphics and unregistered compute preparation through one wrapper; a failed diagnostic write must not replace the original preparation error. The regression verifies disabled capture writes nothing, enabled capture matches the complete serialized request, replay round-trips, and the original failure message is preserved. A CTest resource lock prevents the prepared-shader variants from racing on their shared diagnostic fixture filename. No proprietary shader dumps or title data are included. Upstream's overlap tool reports nearby edits in #2257 (deferred preparation), #2261 (NGG workgroups), #2285 (draw offsets), and #2302 (user-data call targets). I inspected those patches: they implement separate behavior rather than this failure-capture wrapper. There is no functional dependency on them, but their merge order can require rebasing this PR's call sites/public declaration. This branch merges cleanly with current `main`. ### Tested Windows 11 x64, MinGW GCC, RelWithDebInfo, NVIDIA GeForce RTX 3070. Focused build passed; `agc_driver_prepared_shaders` and its indirect/uncached/debug/debug_failure modes passed 5/5 with `ANYPS5_REQUIRE_VULKAN=1`, no skips (each 0.45-1.13 s). The debug_failure mode passed its expected-failure check. The branch/title/body conventions check passed. Built and tested with the integrated contribution set on upstream `d70b8998`; this branch contains only the diagnostic capture change and its test resource lock. ### Checklist - [x] Based on current `main`; open-PR overlap checked before submission - [x] One topic per PR - [x] No new code comments or investigation files in the repository - [x] Generic behavior; preparation failures continue to throw - [x] Depends on: none - [x] AI-assisted: yes; reviewed and submitted by the author
Kikoarl commented 2026-10-09 20:00:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Kikoarl on 2026-10-09T20:00:55Z.


Tested on Linux (CachyOS x86_64, Intel RPL-S iGPU / Mesa 26.3.0-devel / Vulkan 1.4.363, GCC 16.2.1) at c079c935:

  • Build: Built cleanly in RAM (/tmp/anyps5_build) with zero warnings/errors.
  • Conventions: python3 tools/check_conventions.py --base origin/main --head HEAD -> PASS (0 errors).
  • Verification: Verified agc_driver_prepared_shaders_debug_failure (FailureCapture). Diagnostic capture with APS5_DUMP_SHADERS=1 correctly dumps serialized .req shader preparation files on failure for replay analysis without altering error semantics.

LGTM!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6088305335 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2313#issuecomment-6088305335). Originally posted by [Kikoarl](https://github.com/Kikoarl) on 2026-10-09T20:00:55Z. --- Tested on Linux (CachyOS x86_64, Intel RPL-S iGPU / Mesa 26.3.0-devel / Vulkan 1.4.363, GCC 16.2.1) at `c079c935`: - **Build**: Built cleanly in RAM (`/tmp/anyps5_build`) with zero warnings/errors. - **Conventions**: `python3 tools/check_conventions.py --base origin/main --head HEAD` -> **PASS (0 errors)**. - **Verification**: Verified `agc_driver_prepared_shaders_debug_failure` (`FailureCapture`). Diagnostic capture with `APS5_DUMP_SHADERS=1` correctly dumps serialized `.req` shader preparation files on failure for replay analysis without altering error semantics. LGTM!
oneandonlydean commented 2026-10-10 05:18:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T05:18:36Z.


Conflicts with main in ShaderRegistry.cpp; please rebase. The red build came from a main breakage that is fixed now, not from this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094143193 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2313#issuecomment-6094143193). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-10T05:18:36Z. --- Conflicts with main in `ShaderRegistry.cpp`; please rebase. The red build came from a main breakage that is fixed now, not from this PR.
adriadam10 commented 2026-10-10 06:32:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:32:11Z.


Rebased onto current main (conflict in ShaderRegistry.cpp/Driver.hpp, as noted above). PrepareShader now takes a ShaderPreparationContext* and the unregistered/deferred branch was merged, so PrepareShaderWithDiagnostics takes an optional ShaderPreparationContext* and forwards it; all four call sites go through it, and ShaderPreparationContext is forward-declared in ShaderRegistry.hpp.

Checked on Linux (scoped build + ctest): all agc_driver_prepared_shaders* pass, including debug_failure. Merging once CI is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094681877 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2313#issuecomment-6094681877). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T06:32:11Z. --- Rebased onto current `main` (conflict in `ShaderRegistry.cpp`/`Driver.hpp`, as noted above). `PrepareShader` now takes a `ShaderPreparationContext*` and the unregistered/deferred branch was merged, so `PrepareShaderWithDiagnostics` takes an optional `ShaderPreparationContext*` and forwards it; all four call sites go through it, and `ShaderPreparationContext` is forward-declared in `ShaderRegistry.hpp`. Checked on Linux (scoped build + ctest): all `agc_driver_prepared_shaders*` pass, including `debug_failure`. Merging once CI is green.
github-actions[bot] commented 2026-10-10 06:34:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T06:34:46Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1732 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp L22-23, L180-184, L234-238
#1825 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp L22-23, L180-184, L234-238
#1902 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hpp L16, L73-74
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp L179-184, L233-238
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094700857 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2313#issuecomment-6094700857). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T06:34:46Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1732 | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp` [L22-23](https://github.com/boykopovar/AnyPS5/blob/b58b1ccff48fe41ad774a30e99b6af41cbcba549/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp#L22-L23), [L180-184](https://github.com/boykopovar/AnyPS5/blob/b58b1ccff48fe41ad774a30e99b6af41cbcba549/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp#L180-L184), [L234-238](https://github.com/boykopovar/AnyPS5/blob/b58b1ccff48fe41ad774a30e99b6af41cbcba549/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp#L234-L238) | | | | #1825 | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp` [L22-23](https://github.com/boykopovar/AnyPS5/blob/b58b1ccff48fe41ad774a30e99b6af41cbcba549/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp#L22-L23), [L180-184](https://github.com/boykopovar/AnyPS5/blob/b58b1ccff48fe41ad774a30e99b6af41cbcba549/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp#L180-L184), [L234-238](https://github.com/boykopovar/AnyPS5/blob/b58b1ccff48fe41ad774a30e99b6af41cbcba549/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp#L234-L238) | | | | #1902 | `core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hpp` [L16](https://github.com/boykopovar/AnyPS5/blob/b58b1ccff48fe41ad774a30e99b6af41cbcba549/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hpp#L16), [L73-74](https://github.com/boykopovar/AnyPS5/blob/b58b1ccff48fe41ad774a30e99b6af41cbcba549/core/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hpp#L73-L74)<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp` [L179-184](https://github.com/boykopovar/AnyPS5/blob/b58b1ccff48fe41ad774a30e99b6af41cbcba549/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp#L179-L184), [L233-238](https://github.com/boykopovar/AnyPS5/blob/b58b1ccff48fe41ad774a30e99b6af41cbcba549/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp#L233-L238) | | |
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!2313
No description provided.