GPU: target dumps name every writer, and VICTORY_DUMP_AFTER dumps a texture right after a pipeline #3415

Open
github-bot wants to merge 2 commits from github-bot/gh-3415 into main AGit
Owner

@⁠JurajSimicevic on GitHub · 2026-11-26 23:52 UTC · original
JurajSimicevic:capture/dump-after → main · +346 −66 · 4 files · 2 commits · open

Problem

With VICTORY_DUMP_TARGETS, each submission of a listed frame dumps the textures its lists wrote, as frame-<n>-s<sub>-<i>-…-by-<pipeline>.png. Two things made these files easy to misread:

  • Content. A file holds what the whole submission left in the texture, but it is named after the first pipeline that wrote it. Its doc comment said the files follow a frame "pass by pass".
  • Writers. Only views bound through tables counted as writers. Draws that render to a target were never named.

An example, in the world on an RTX 5080, counts only:

  • An additive lighting target was named after the compute pass that writes it first. 188 more pipelines, the draws that render to it, wrote it later in the same submission.
  • Its share of green-dominant pixels was 27% right after that compute pass, and 61% in the per-submission file.

I read such files as the named pass's output twice in my own reports on #2711, and others measure the same way.

Change

Writers.

  • Lists and the frame-end dump keep every pipeline that wrote a target, in order. That covers unordered views through tables, as before, and now also the draws that render to it (render targets, depth).
  • The file name gives the first writer and -and-<n>-more; one log line lists them all.
  • The doc comment and the README say what the per-submission files hold.

VICTORY_DUMP_AFTER=<hash>,.... In listed frames, a texture can now be dumped right after one pipeline's command:

  • It applies after a dispatch, indirect execution, draw or mesh dispatch of a pipeline containing a listed shader hash.
  • The 2D textures that command writes are read back in the same list, right after it: its shaders' unordered views through tables, and a draw's render targets and depth.
  • Once the list has run, each is saved as frame-<n>-after-<k>-…, where n is the frame whose submission ran it and k counts these dumps in order.

Shared code.

  • capture::snapshot does the read-back: a UAV barrier, copy-source, then back to the state the next command needs.
  • The existing 1D/3D probe after dispatches (probe_written) now uses it too.
  • dump_one is split into its read-back and save_target, which both paths use.

Scope.

  • Diagnostics builds only, and nothing changes without these switches.
  • Not covered: depth textures with a writable twin (crate::twin), whose unordered writes are not in the texture yet; they are skipped with a log line. 1D, 3D and multisampled targets are not dumped after a command.

capture.rs, draw.rs, host.rs (all victory-gpu) and README.md.

Tested

Unit and GPU tests:

  • cargo test -p victory-gpu --features diagnostics --lib:
    • WARP (VICTORY_D3D12_WARP=1): 248 passed.
    • RTX 5080: 246 passed and 2 failed. The two are dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views, which fail on main on NVIDIA too (#3178).
  • New: draw::tests::a_snapshot_right_after_a_dispatch_holds_what_it_wrote. Two dispatches write one texture; the snapshot after the first holds the first's values, and the one after the second holds the second's. Expecting the second's values after the first makes it fail.
  • New: capture::tests::dump_names_give_the_first_writer_and_how_many_more.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings, with and without --features diagnostics: clean. No other crate changes.

In the title (RTX 5080):

  • Setup: diag build of a local stack (main + #2098, #2626, #2628, #2464, #2118, #439 at e2d3cfd, and local diagnostic logging) with this change. VICTORY_DUMP_TARGETS=1, VICTORY_CAPTURE_WORLD=150, and VICTORY_DUMP_AFTER naming three compute pipelines.
  • Two runs, the second with the draw writers added. Each saved 30 after-dumps, with no device errors.
  • The lighting target's per-submission file now ends in -and-188-more.
  • After-dumps recorded for the next frame carry that frame's number.
  • The numbers repeat between the runs: 27.2% / 27.1% right after the compute pass, 60.9% / 60.8% at the end of the submission.

Overlap: #3388 also changes dump_one (footprint checks before mapping). Whichever lands second moves those checks into save_target.

No game data: counts and file-name shapes only.

AI-assisted.

🤖 Generated with Claude Code

**@⁠JurajSimicevic** on GitHub · 2026-11-26 23:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/3415) `JurajSimicevic:capture/dump-after` → `main` · +346 −66 · 4 files · 2 commits · open ## Problem With `VICTORY_DUMP_TARGETS`, each submission of a listed frame dumps the textures its lists wrote, as `frame-<n>-s<sub>-<i>-…-by-<pipeline>.png`. Two things made these files easy to misread: - **Content.** A file holds what the whole submission left in the texture, but it is named after the first pipeline that wrote it. Its doc comment said the files follow a frame "pass by pass". - **Writers.** Only views bound through tables counted as writers. Draws that render to a target were never named. An example, in the world on an RTX 5080, counts only: - An additive lighting target was named after the compute pass that writes it first. 188 more pipelines, the draws that render to it, wrote it later in the same submission. - Its share of green-dominant pixels was 27% right after that compute pass, and 61% in the per-submission file. I read such files as the named pass's output twice in my own reports on #2711, and others measure the same way. ## Change **Writers.** - Lists and the frame-end dump keep every pipeline that wrote a target, in order. That covers unordered views through tables, as before, and now also the draws that render to it (render targets, depth). - The file name gives the first writer and `-and-<n>-more`; one log line lists them all. - The doc comment and the README say what the per-submission files hold. **`VICTORY_DUMP_AFTER=<hash>,...`.** In listed frames, a texture can now be dumped right after one pipeline's command: - It applies after a dispatch, indirect execution, draw or mesh dispatch of a pipeline containing a listed shader hash. - The 2D textures that command writes are read back in the same list, right after it: its shaders' unordered views through tables, and a draw's render targets and depth. - Once the list has run, each is saved as `frame-<n>-after-<k>-…`, where `n` is the frame whose submission ran it and `k` counts these dumps in order. **Shared code.** - `capture::snapshot` does the read-back: a UAV barrier, copy-source, then back to the state the next command needs. - The existing 1D/3D probe after dispatches (`probe_written`) now uses it too. - `dump_one` is split into its read-back and `save_target`, which both paths use. **Scope.** - Diagnostics builds only, and nothing changes without these switches. - Not covered: depth textures with a writable twin (`crate::twin`), whose unordered writes are not in the texture yet; they are skipped with a log line. 1D, 3D and multisampled targets are not dumped after a command. `capture.rs`, `draw.rs`, `host.rs` (all `victory-gpu`) and `README.md`. ## Tested **Unit and GPU tests:** - `cargo test -p victory-gpu --features diagnostics --lib`: - WARP (`VICTORY_D3D12_WARP=1`): 248 passed. - RTX 5080: 246 passed and 2 failed. The two are `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`, which fail on `main` on NVIDIA too (#3178). - New: `draw::tests::a_snapshot_right_after_a_dispatch_holds_what_it_wrote`. Two dispatches write one texture; the snapshot after the first holds the first's values, and the one after the second holds the second's. Expecting the second's values after the first makes it fail. - New: `capture::tests::dump_names_give_the_first_writer_and_how_many_more`. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`, with and without `--features diagnostics`: clean. No other crate changes. **In the title (RTX 5080):** - Setup: diag build of a local stack (`main` + #2098, #2626, #2628, #2464, #2118, #439 at `e2d3cfd`, and local diagnostic logging) with this change. `VICTORY_DUMP_TARGETS=1`, `VICTORY_CAPTURE_WORLD=150`, and `VICTORY_DUMP_AFTER` naming three compute pipelines. - Two runs, the second with the draw writers added. Each saved 30 after-dumps, with no device errors. - The lighting target's per-submission file now ends in `-and-188-more`. - After-dumps recorded for the next frame carry that frame's number. - The numbers repeat between the runs: 27.2% / 27.1% right after the compute pass, 60.9% / 60.8% at the end of the submission. **Overlap:** #3388 also changes `dump_one` (footprint checks before mapping). Whichever lands second moves those checks into `save_target`. No game data: counts and file-name shapes only. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A per-submission dump (`frame-<n>-s<sub>-...-by-<pipeline>`) holds what the
whole submission left in a texture, but its name gave only the first
pipeline that wrote it, and its doc said it follows a frame "pass by pass".
Read as that pipeline's output, it is wrong whenever later commands of the
submission write the same texture (an additive lighting target that some
290 draws add to after the compute that "wrote" it, in one capture).

- Lists and the frame's dump keep every pipeline that wrote a target, in
  order. The file name gives the first and `-and-<n>-more`; the log lists
  them all.
- `VICTORY_DUMP_AFTER=<hash>,...`: in listed frames, the 2D textures a
  dispatch or draw of a matching pipeline writes (unordered views through
  tables; a draw's render targets and depth) are read back in the list
  right after that command and saved as `frame-<n>-after-<k>-...` once it
  has run. `capture::snapshot` does the read-back (UAV barrier, copy-source
  and back); the existing 1D/3D probe after dispatches now uses it too.
- README: what the per-submission files hold, and the new switch.

Tests (diagnostics feature): `a_snapshot_right_after_a_dispatch_holds_what_it_wrote`
(two dispatches write one texture; the snapshot after the first holds the
first's values) and `dump_names_give_the_first_writer_and_how_many_more`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The writers a dump lists came from views bound through tables, so the
draws that render to a target (render targets, depth) were left out: a
target lit by some 180 draws after one compute named only the compute.
Draws now add their pipeline when they bind it as a target.

Lists are recorded ahead of the frame that submits them, so an after-dump
is named when its list has run (as the per-submission dumps are), not
when its command was recorded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:07:02 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-27 00:07 UTC · original · approved these changes

LGTM — verified on RTX 5090 (Windows / D3D12) against origin/main (63bcca4).

  • Naming every writer in target dumps and supporting opt-in VICTORY_DUMP_AFTER for post-pipeline texture dumps build and pass cleanly in both default and --features diagnostics configurations.
  • cargo test -p victory-gpu --lib --features diagnostics capture:: -- --test-threads=1: all passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default + --features diagnostics): clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-27 00:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/3415#pullrequestreview-6081855298) · **approved these changes** LGTM — verified on RTX 5090 (Windows / D3D12) against `origin/main` (`63bcca4`). - Naming every writer in target dumps and supporting opt-in `VICTORY_DUMP_AFTER` for post-pipeline texture dumps build and pass cleanly in both default and `--features diagnostics` configurations. - `cargo test -p victory-gpu --lib --features diagnostics capture:: -- --test-threads=1`: all passed. - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default + `--features diagnostics`): clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠Venom2054 on GitHub · 2026-11-27 00:21 UTC · original

Tested VICTORY_DUMP_AFTER on Windows at 6406c5b with a synthetic four-draw case on an RTX 5070 Ti and WARP. All four DrawInstanced calls wrote to the same 1280 × 720, single-sample R8G8B8A8_TYPELESS resource through an R8G8B8A8_UNORM RTV. The draws wrote blue, red, green, then blue. I selected only the red and green pixel shader hashes.

Both adapters produced exactly two PNGs in that order. All 230,400 sampled pixels in the first PNG were red and all 230,400 in the second were green. A separate full-resolution readback after the fourth draw was blue at all 921,600 pixels. The D3D12 debug layer reported no errors.

This exercises two selected draws writing the same target in one list and verifies that a later unselected draw still renders. Synthetic inputs only. AI-assisted test and analysis.

**@⁠Venom2054** on GitHub · 2026-11-27 00:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/3415#issuecomment-7206395287) Tested `VICTORY_DUMP_AFTER` on Windows at `6406c5b` with a synthetic four-draw case on an RTX 5070 Ti and WARP. All four `DrawInstanced` calls wrote to the same 1280 × 720, single-sample `R8G8B8A8_TYPELESS` resource through an `R8G8B8A8_UNORM` RTV. The draws wrote blue, red, green, then blue. I selected only the red and green pixel shader hashes. Both adapters produced exactly two PNGs in that order. All 230,400 sampled pixels in the first PNG were red and all 230,400 in the second were green. A separate full-resolution readback after the fourth draw was blue at all 921,600 pixels. The D3D12 debug layer reported no errors. This exercises two selected draws writing the same target in one list and verifies that a later unselected draw still renders. Synthetic inputs only. AI-assisted test and analysis.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-27 00:48 UTC · original · approved these changes

Looks good. Verified all code paths, diagnostics feature gating, and live D3D12 behavior on both RTX 5090 and WARP with VICTORY_D3D12_DEBUG=1:

  • cargo xtask policy and cargo clippy --tests -p victory-gpu (both default and --features diagnostics, -D warnings) pass cleanly, and all new hooks in draw.rs and host.rs remain properly gated behind #[cfg(feature = "diagnostics")].
  • add_writer / writers_label preserve writer order cleanly without stripping the -and-<n>-more or -twin<p> suffixes in save_target.
  • capture::tests (6/6), a_snapshot_right_after_a_dispatch_holds_what_it_wrote (1/1), and draw::tests (21/21) all pass on both RTX 5090 and WARP.
  • Additionally tested capture::snapshot and end-to-end capture::dump_after (deferred PNG write) on R8G8B8A8_UNORM (RENDER_TARGET), D32_FLOAT (DEPTH_WRITE), and R24G8_TYPELESS (DEPTH_WRITE) textures on both RTX 5090 and WARP: all snapshots and saved PNGs succeeded with zero D3D12 debug layer messages.
**@⁠fuzeofficlal** on GitHub · 2026-11-27 00:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/3415#pullrequestreview-6082063091) · **approved these changes** Looks good. Verified all code paths, diagnostics feature gating, and live D3D12 behavior on both RTX 5090 and WARP with `VICTORY_D3D12_DEBUG=1`: - `cargo xtask policy` and `cargo clippy --tests -p victory-gpu` (both default and `--features diagnostics`, `-D warnings`) pass cleanly, and all new hooks in `draw.rs` and `host.rs` remain properly gated behind `#[cfg(feature = "diagnostics")]`. - `add_writer` / `writers_label` preserve writer order cleanly without stripping the `-and-<n>-more` or `-twin<p>` suffixes in `save_target`. - `capture::tests` (6/6), `a_snapshot_right_after_a_dispatch_holds_what_it_wrote` (1/1), and `draw::tests` (21/21) all pass on both RTX 5090 and WARP. - Additionally tested `capture::snapshot` and end-to-end `capture::dump_after` (deferred PNG write) on `R8G8B8A8_UNORM` (`RENDER_TARGET`), `D32_FLOAT` (`DEPTH_WRITE`), and `R24G8_TYPELESS` (`DEPTH_WRITE`) textures on both RTX 5090 and WARP: all snapshots and saved PNGs succeeded with zero D3D12 debug layer messages.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3415/head:github-bot/gh-3415'
git switch 'github-bot/gh-3415'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3415'
git switch 'github-bot/gh-3415'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3415'
git switch 'github-bot/gh-3415'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3415'
git switch 'main'
git merge --squash 'github-bot/gh-3415'
git switch 'main'
git merge --ff-only 'github-bot/gh-3415'
git switch 'main'
git merge 'github-bot/gh-3415'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3415
No description provided.