Skip to content

feat(agc): trace shader addresses for each draw - #5238

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
MarcZX10:fix/trace-draw-program-addresses-5166
Oct 15, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
MarcZX10:fix/trace-draw-program-addresses-5166

Conversation

@MarcZX10

Copy link
Copy Markdown
Contributor

What

Add opt-in APS5_TRACE_DRAW_PROGRAMS per-draw diagnostics that print the selected shader stage and role with the code base and entry addresses, plus submission serial and queue. This lets investigators compare selected shader addresses against shader-preparation failure logs without implying the failures caused the black frames.

Tested

  • Linux: configured the project and built agc_driver_draw_program_trace_tests with CMake/Ninja.
  • Linux: ctest --test-dir /tmp/AnyPS5-5166-build --output-on-failure -R '^agc_driver_draw_program_trace$' passed (1/1).
  • Linux: compiled the production Draw.cpp object with Ninja.
  • Linux: python3 tools/check_conventions.py --base upstream/main passed.
  • No GPU or game runtime tests were run.

Checklist

@github-actions github-actions Bot added build shader core/shader agc libSceAgc* labels Oct 13, 2026
@MarcZX10
MarcZX10 force-pushed the fix/trace-draw-program-addresses-5166 branch from b6ddca7 to 06c752e Compare October 13, 2026 15:42
@MarcZX10 MarcZX10 changed the title Add per-draw shader address tracing feat(agc): trace shader addresses for each draw Oct 13, 2026
@MarcZX10
MarcZX10 force-pushed the fix/trace-draw-program-addresses-5166 branch from 06c752e to 09acdd2 Compare October 13, 2026 15:43
@MarcZX10

Copy link
Copy Markdown
Contributor Author

The Conventional Commit check initially caught the commit subject and PR title. Both are corrected now; the latest conventions check passes. The path-filtered Linux, Windows, relinker, register-context and write-watch jobs are skipped for this diagnostic-only change.

@sktharunbalaji13-cmd

Copy link
Copy Markdown
Contributor

Thank you @MarcZX100 for the per-draw shader-address tracing and for the CI and convention follow-up.

Your stage, role, code address, entry address, queue and submission fields complement our local investigation. They give a direct per-draw address comparison point for shader-selection decisions made at submission time.

Local update, uncommitted work only: we now have local draw-to-submission correlation covering draw attempts, shader-selection and preparation failures, recorded draw commands, and deduplicated draw-token sets associated with recorder batches. Submission attempts are distinguished from submit-confirmed events emitted after successful queue submission and recorder-state finalization.

Windows game-runtime validation has not been completed. Relevant object compilations and seven CaptureTrace utility tests passed, but the full PRX relink and AGC integration path remain blocked.

This does not claim that shader-preparation failures caused the black output. The cause remains unresolved.

@sktharunbalaji13-cmd

Copy link
Copy Markdown
Contributor

Thank you for the per-draw shader-address tracing. We've now prepared a complementary contribution focused on connecting draw attempts and shader-preparation failures to actual recorded commands and the set of correlation tokens associated with each submitted recorder batch.

The clean-branch validation result for the new PR is: successful Windows configure, full instrumented libSceAgcDriver.prx build with NID patching, and 8/8 passing CaptureTrace tests. No GPU/game-runtime validation was performed.

The two diagnostic approaches complement each other: per-draw address information helps identify which shader program is selected, while the additional correlation data is intended to connect failures with recorded draw commands and queue-submission batches. We have not yet established that shader-preparation failures caused the black output; runtime validation remains necessary.

Related PR: #5431

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Thanks for clarifying the complementary scope. I agree the address trace and draw-to-batch correlation answer different diagnostic questions. I checked #5431 as well: its current convention job fails on inline comments in CaptureTrace.hpp and the missing required PR-template headings, so I left those concrete findings there. Since both PRs touch Draw.cpp and the AGC CMake target, I asked there how the implementations compose and whether they share or duplicate any instrumentation; that should make the integration boundary clear before either lands.

@adriadam10 adriadam10 self-assigned this Oct 14, 2026
@adriadam10
adriadam10 force-pushed the fix/trace-draw-program-addresses-5166 branch from 09acdd2 to a741ed2 Compare October 14, 2026 11:35
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the build, agc_driver_draw_program_trace and the scoped ctest on the PR rebased onto main; the only failures (agc_recorder_kept_bytes, agc_driver_tessellation) fail identically without the Draw.cpp change.

Added one commit: docs/dev/BUILD.md now documents APS5_TRACE_DRAW_PROGRAMS next to the other APS5_* diagnostics variables.

Not verified here: the output on a real draw (the test covers the formatter only). Merging once CI is green.

@adriadam10

Copy link
Copy Markdown
Collaborator

Rebased onto current main (only the #include block in Draw.cpp conflicted; kept <cstdio> and <cstring>). Build and scoped ctest re-run: agc_driver_draw_program_trace passes; the only failure, agc_driver_tessellation, also fails without the Draw.cpp change. Merging once CI is green.

@adriadam10
adriadam10 force-pushed the fix/trace-draw-program-addresses-5166 branch from a741ed2 to de0cd00 Compare October 14, 2026 21:45
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 14, 2026
@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
#6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt L147
#6203 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp L2
#6208 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp L2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants