Skip to content

fix(agc): name preparation-failure shader dumps apart from dispatch captures - #6134

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
fdfawef324:claude/agc-prepare-dump-name
Oct 18, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
fdfawef324:claude/agc-prepare-dump-name

Conversation

@fdfawef324

@fdfawef324 fdfawef324 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What

With APS5_DUMP_SHADERS set, a shader whose preparation fails is dumped by PrepareShaderWithDiagnostics under the same shader_<address>.req name that dispatch and draw captures use. The two kinds of file need different replays:

  • A preparation-failure request has no captured resources. The one written after registration (PrepareRegistered) also carries placeholder user data (all zero) and only the code and shader-header memory.
  • Replaying such a file as a dispatch capture (the default recompile path of agc_shader_replay, or --materialize from feat(agc): replay prepared shader capture and materialization offline #5959) follows the zero user-data pointer into the SRT. The table-base read then misses the request memory and SrtWalker::EvaluateDescriptorSource throws, so the replay reports a walker failure that never happens in the game, where dispatch uses the real user data. --prepare succeeds on the same files.
  • Driver::dumpRequest de-duplicated by address. Once a preparation failure had been dumped, a later dispatch or draw dump of the same shader was dropped, so the request that would have shown the real capture was never written.

Changes:

  • Driver::dumpRequest takes an optional file-name suffix. PrepareShaderWithDiagnostics passes .prepare, so preparation failures are written as shader_<address>.prepare.req. Dispatch and draw dumps keep their shader_<address>.req name.
  • De-duplication is keyed by file name instead of by address, so the later dispatch dump of a shader is still written after its preparation dump.
  • The agc_shader_replay usage text says that a .prepare.req holds a request whose preparation failed before any resource capture, and that it should be replayed with --prepare.
  • FailureCapture in tests/execution/PreparedShaders.cpp expects the .prepare.req name and no plain .req from a preparation failure. It then dumps a dispatch request for the same address and requires shader_<address>.req to be written with the serialized request.

Known limit: a registration-time .prepare dump still suppresses a later at-use .prepare dump of the same address, which would carry real user data. Both replay only with --prepare, so this PR leaves it as is.

Tested

Windows Server 2025 (10.0.26100), NVIDIA GeForce RTX 3060 12 GB, driver 591.86, Vulkan 1.4.325. WinLibs MinGW-w64 GCC 15.2.0, Ninja, Release, BUILD_TESTING=ON. Built agc_driver_prepared_shaders_tests, libSceAgcDriver and agc_shader_replay. Based on main 6239cef.

ctest -R '^agc_driver_prepared_shaders' (9 variants; FailureCapture runs in agc_driver_prepared_shaders, _indirect, _uncached and _debug):

  • Red, with the new test and main's driver: those 4 variants fail with "enabled shader capture changed the diagnosed failure", because the failure names shader_12345cafe.req. The other 5 pass.
  • Red, with the new name but the old address-keyed de-duplication: the same 4 fail with "an earlier preparation failure dump suppressed the dispatch request dump".
  • Green, with this change: 9 of 9 pass, in 3 of 3 runs on main 80ccb9f and again after rebasing onto 6239cef.
  • agc_shader_replay with no arguments prints the new usage text.

The bug was found while replaying a corpus of dumps from a title: every request that failed in SrtWalker was a registration-time preparation dump with zero user data and only code and header memory, and each one passed with --prepare. Those dumps are not attached or included.

Not tested: Linux, macOS, a title run with this change.

Checklist

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

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
PR 6454 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp L69-70
PR 6856 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp L70
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderDiagnostics.cpp L52, L54-56, L58

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4650 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 5115 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 5404 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 5609 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 5925 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6188 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 6292 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderDiagnostics.cpp
PR 6501 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6539 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6615 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderDiagnostics.cpp
PR 6867 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/tests/execution/PreparedShaders.cpp
PR 6941 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6946 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 6947 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
PR 6963 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
PR 6977 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp
core/libs/prx/libSceAgcDriver/tools/ShaderReplay.cpp
PR 7332 3rdparty/SPIRV-Headers
3rdparty/SPIRV-Tools
PR 7642 core/libs/prx/libSceAgcDriver/Execution/include/Driver/Driver.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cpp

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 16, 2026
@adriadam10 adriadam10 self-assigned this Oct 16, 2026
…aptures

With APS5_DUMP_SHADERS set, PrepareShaderWithDiagnostics wrote a request
whose preparation failed under the same shader_<address>.req name that
dispatch and draw captures use. A preparation request has no captured
resources: the registration-time one carries placeholder (zero) user
data and only the code and header memory. Replaying such a file as a
dispatch capture follows the null user-data pointer into the SRT and
fails in SrtWalker, which looks like a walker bug but is not one.

dumpRequest also de-duplicated by address, so once a preparation
failure had been dumped, a later dispatch dump of the same shader was
silently dropped and the real capture was lost.

Preparation-failure dumps are now written as shader_<address>.prepare.req,
and dumpRequest de-duplicates by file name, so the later dispatch dump
of the same address is still written. agc_shader_replay's usage text
says to replay .prepare.req files with --prepare.

The FailureCapture test expects the .prepare.req name, no plain .req
from a preparation failure, and a subsequent dispatch dump of the same
address to be written with the serialized request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adriadam10
adriadam10 force-pushed the claude/agc-prepare-dump-name branch from b886106 to 1db31b9 Compare October 18, 2026 19:22
@github-actions github-actions Bot added build and removed needs rebase Conflicts with main, rebase needed labels Oct 18, 2026
@adriadam10
adriadam10 merged commit 8256d3a into boykopovar:main Oct 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants