GPU diagnostics: show one of the title's render targets in the window #530

Open
github-bot wants to merge 1 commit from github-bot/gh-530 into main AGit
Owner

@⁠AKA0GHOST on GitHub · 2026-11-24 04:32 UTC · original
AKA0GHOST:gpu/show-render-target → main · +102 −1 · 3 files · 1 commits · open

What

A diagnostics switch that shows one of the title's render targets in the window instead of the title's frame:

VICTORY_SHOW_TARGET=<w>x<h>-f<format>, e.g. VICTORY_SHOW_TARGET=2560x1440-f28

  • capture::note_target (already called for every bound render target in diagnostics builds) remembers the last target of that size and DXGI format.
  • Host::present copies it 1:1 to the top left of the back buffer (CopyTextureRegion, clamped to the back buffer) instead of CopyResource of the title's frame. The state transitions are the ones dump_one uses.
  • Nothing is copied when the formats differ (no invalid copy); then the title's frame is shown as before. Without the variable nothing changes, and release builds are untouched.

Why

The world's final image is black (README: "not working yet"), but VICTORY_DUMP_TARGETS shows its earlier passes do draw. This puts one of those passes on screen live, which helps to see what the world draws while playing, and to compare runs.

On Grand Theft Auto VI the 2560x1440 RGBA8 (f28) target of the geometry pass shows the scene's objects (picnic tables, street lamps, a basketball hoop, characters, power lines) in false colours, since it holds packed surface data rather than colours. Finding it: VICTORY_CAPTURE + VICTORY_CAPTURE_FRAMES + VICTORY_DUMP_TARGETS=1 on a world frame, then pick the size and format of the target that shows geometry.

Tested

Windows 11, RTX 5070 (driver 621.14), diag build, own 1.0.2.1 copy:

  • cargo test -p victory-gpu with and without --features diagnostics: 46 / 43 passed, 0 failed (one new test for parsing the switch).
  • cargo clippy -p victory-gpu --all-targets with and without diagnostics: no new warnings.
  • A world run with VICTORY_SHOW_TARGET=2560x1440-f28: the geometry showed in the window at 1743 draws per frame; no D3D12 errors from the copy. (The run used main + #20 + #320 and ended in the existing GPU hang, which this change does not touch.)

Limits: a 1:1 copy, so a target smaller than the window fills its top left and one of another format is not shown (a blit shader would lift both; marked shortcut: in the code).

AI-assisted (Claude Code). No game files or images attached.

🤖 Generated with Claude Code

**@⁠AKA0GHOST** on GitHub · 2026-11-24 04:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/530) `AKA0GHOST:gpu/show-render-target` → `main` · +102 −1 · 3 files · 1 commits · open ### What A diagnostics switch that shows one of the title's render targets in the window instead of the title's frame: `VICTORY_SHOW_TARGET=<w>x<h>-f<format>`, e.g. `VICTORY_SHOW_TARGET=2560x1440-f28` - `capture::note_target` (already called for every bound render target in diagnostics builds) remembers the last target of that size and DXGI format. - `Host::present` copies it 1:1 to the top left of the back buffer (`CopyTextureRegion`, clamped to the back buffer) instead of `CopyResource` of the title's frame. The state transitions are the ones `dump_one` uses. - Nothing is copied when the formats differ (no invalid copy); then the title's frame is shown as before. Without the variable nothing changes, and release builds are untouched. ### Why The world's final image is black (README: "not working yet"), but `VICTORY_DUMP_TARGETS` shows its earlier passes do draw. This puts one of those passes on screen live, which helps to see what the world draws while playing, and to compare runs. On Grand Theft Auto VI the 2560x1440 RGBA8 (f28) target of the geometry pass shows the scene's objects (picnic tables, street lamps, a basketball hoop, characters, power lines) in false colours, since it holds packed surface data rather than colours. Finding it: `VICTORY_CAPTURE` + `VICTORY_CAPTURE_FRAMES` + `VICTORY_DUMP_TARGETS=1` on a world frame, then pick the size and format of the target that shows geometry. ### Tested Windows 11, RTX 5070 (driver 621.14), diag build, own 1.0.2.1 copy: - `cargo test -p victory-gpu` with and without `--features diagnostics`: 46 / 43 passed, 0 failed (one new test for parsing the switch). - `cargo clippy -p victory-gpu --all-targets` with and without diagnostics: no new warnings. - A world run with `VICTORY_SHOW_TARGET=2560x1440-f28`: the geometry showed in the window at 1743 draws per frame; no D3D12 errors from the copy. (The run used main + #20 + #320 and ended in the existing GPU hang, which this change does not touch.) Limits: a 1:1 copy, so a target smaller than the window fills its top left and one of another format is not shown (a blit shader would lift both; marked `shortcut:` in the code). AI-assisted (Claude Code). No game files or images attached. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`VICTORY_SHOW_TARGET=<w>x<h>-f<format>` (e.g. `2560x1440-f28`) shows the
last render target of that size and DXGI format each frame instead of the
title's frame: it is copied 1:1 to the top left of the back buffer, and
only when its format is the window's. Draws and dispatches still run as
before; only what reaches the window changes.

With the world's lit image black, this shows what its earlier passes did
draw: on Grand Theft Auto VI, a 2560x1440 RGBA8 target of the geometry
pass shows the scene's objects (packed surface data, so false colours).

The target is the one `capture::note_target` last saw bound, so it needs a
diagnostics build; without the variable nothing changes.

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

@⁠aycow on GitHub · 2026-11-24 04:55 UTC · original

The recognizable geometry in the intermediate target gives us a useful starting point. I built an independent, opt-in dependency trace at a98be75 to follow the normal presentation source back through recorded texture producers, static SRV/UAV bindings, state transitions, and refused passes. The original synthetic fixture passed on AMD, NVIDIA, and WARP with the debug layer and full GPU validation. The normal chain returned red with a current writer. Omitting its producer returned black with the previous writer.

If you're authorized to retest the reproduction described here, build the diagnostic branch with cargo build --profile diag -p victory --features diagnostics. In PowerShell set $env:VICTORY_RENDER_DEPENDENCIES = '256' (replace 256 with the matching present number, or use an inclusive range such as 255-256). Use the same adapter, settings and scene as the #530 run. Run #509 separately if also measuring GPU time.

Please share only the revision, adapter and driver, present number, selected intermediate dimensions/format and whether it showed geometry, the final black flag, aggregate no-prior-writer/unresolved/refused/omitted counts, and the first suspect on_path edge. For that edge, the shader/pipeline hashes, resource ID and extent, writer/refusal frame, and host_resource_matches if available are enough. Texture IDs are run-local. Keep captures, title assets, shader binaries and dumps local. Reproduction steps and interpretation limits

**@⁠aycow** on GitHub · 2026-11-24 04:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/530#issuecomment-7122459558) The recognizable geometry in the intermediate target gives us a useful starting point. I built an independent, opt-in dependency trace at `a98be75` to follow the normal presentation source back through recorded texture producers, static SRV/UAV bindings, state transitions, and refused passes. The original synthetic fixture passed on AMD, NVIDIA, and WARP with the debug layer and full GPU validation. The normal chain returned red with a current writer. Omitting its producer returned black with the previous writer. If you're authorized to retest the reproduction described here, build the [diagnostic branch](https://github.com/aycow/VIctory/tree/gpu/render-pass-dependency-census) with `cargo build --profile diag -p victory --features diagnostics`. In PowerShell set `$env:VICTORY_RENDER_DEPENDENCIES = '256'` (replace 256 with the matching present number, or use an inclusive range such as `255-256`). Use the same adapter, settings and scene as the #530 run. Run #509 separately if also measuring GPU time. Please share only the revision, adapter and driver, present number, selected intermediate dimensions/format and whether it showed geometry, the final black flag, aggregate no-prior-writer/unresolved/refused/omitted counts, and the first suspect `on_path` edge. For that edge, the shader/pipeline hashes, resource ID and extent, writer/refusal frame, and `host_resource_matches` if available are enough. Texture IDs are run-local. Keep captures, title assets, shader binaries and dumps local. [Reproduction steps and interpretation limits](https://github.com/aycow/VIctory/blob/a98be758f15cf5903c3142abd9fc0ba741bb6c64/docs/render-dependencies.md)
Author
Owner

@⁠Fimpos on GitHub · 2026-11-24 05:03 UTC · original

Tested VICTORY_SHOW_TARGET=2560x1440-f28 on Windows 11 Pro 25H2 (26200), Ryzen 7 7800X3D, NVIDIA GeForce RTX 5070 12 GB (driver 621.24), 32 GiB RAM (diag profile, v1.0.2.1).

When merged together with #483, #493 (#336), #439, #492, #459, and #546 (VICTORY_SHADER_LOOP_LIMIT=256):

  • The DXGI_ERROR_DEVICE_HUNG (0x887A0006) on the first 30-list 3D world submission is completely gone.
  • The title has been running continuously through the opening cutscene past frame 1,879+ (800+ frames in the 3D world across both the exterior street/park scene and the interior room/doors scene) at ~2–3 FPS (333–466 ms/frame) with 0 device removals.
  • VICTORY_SHOW_TARGET=2560x1440-f28 cleanly presents the live G-buffer geometry across camera transitions with no D3D12 copy errors.
**@⁠Fimpos** on GitHub · 2026-11-24 05:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/530#issuecomment-7122582116) Tested `VICTORY_SHOW_TARGET=2560x1440-f28` on **Windows 11 Pro 25H2 (26200), Ryzen 7 7800X3D, NVIDIA GeForce RTX 5070 12 GB (driver 621.24), 32 GiB RAM** (`diag` profile, v1.0.2.1). When merged together with **#483**, **#493** (#336), **#439**, **#492**, **#459**, and **#546** (`VICTORY_SHADER_LOOP_LIMIT=256`): - The `DXGI_ERROR_DEVICE_HUNG` (`0x887A0006`) on the first 30-list 3D world submission is completely gone. - The title has been running continuously through the opening cutscene past **frame 1,879+** (800+ frames in the 3D world across both the exterior street/park scene and the interior room/doors scene) at ~2–3 FPS (`333–466 ms/frame`) with **0 device removals**. - `VICTORY_SHOW_TARGET=2560x1440-f28` cleanly presents the live G-buffer geometry across camera transitions with no D3D12 copy errors.
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 06:51 UTC · original

I compared the 2560×1440 RGBA8 target with the normal 3840×2160 present on a physical RTX 5070 and Core Ultra 7 265K under Windows 11. I used the size selector from this PR at 951ceb1 on the same private mission build used to verify #294 and #489. The test saved the original and the composited backbuffer from the same submission. It selected a target recorded for that frame after a fence-confirmed loading readback. The launcher loaded a verified 682-key pipeline cache.

Three consecutive matching presents completed their copy fences and returned S_OK from DXGI. The saved PNGs sample every other pixel in each direction:

Saved loading frames Normal image 2560×1440 target, sampled at 1280×720
First match One flat color All 921,600 samples black
Next two matches Opening title card, pixel-identical across the two frames All 921,600 samples black in each frame

Across all three pairs, every sampled pixel outside the copied area matched the normal image. A late interval measured 0.3 FPS, and the watchdog ended the run 12 seconds after the loading checkpoint. This pins down an early interval where the selector matched and the copy worked, while the selected target was still black. Later world frames remain unverified on this build.

For anyone comparing captures, the stock patch reads back the normal present source even when the alternate target is displayed. Reading back the composited backbuffer as well was what let me check the image that went to DXGI.

**@⁠jeremygold02** on GitHub · 2026-11-24 06:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/530#issuecomment-7124355210) I compared the 2560×1440 RGBA8 target with the normal 3840×2160 present on a physical RTX 5070 and Core Ultra 7 265K under Windows 11. I used the size selector from this PR at `951ceb1` on the same private mission build used to verify #294 and #489. The test saved the original and the composited backbuffer from the same submission. It selected a target recorded for that frame after a fence-confirmed loading readback. The launcher loaded a verified 682-key pipeline cache. Three consecutive matching presents completed their copy fences and returned `S_OK` from DXGI. The saved PNGs sample every other pixel in each direction: | Saved loading frames | Normal image | 2560×1440 target, sampled at 1280×720 | | --- | --- | --- | | First match | One flat color | All 921,600 samples black | | Next two matches | Opening title card, pixel-identical across the two frames | All 921,600 samples black in each frame | Across all three pairs, every sampled pixel outside the copied area matched the normal image. A late interval measured 0.3 FPS, and the watchdog ended the run 12 seconds after the loading checkpoint. This pins down an early interval where the selector matched and the copy worked, while the selected target was still black. Later world frames remain unverified on this build. For anyone comparing captures, the stock patch reads back the normal present source even when the alternate target is displayed. Reading back the composited backbuffer as well was what let me check the image that went to DXGI.
Author
Owner

@⁠AKA0GHOST on GitHub · 2026-11-24 08:16 UTC · original

Thanks all for testing this, and sorry for the late follow-up.

@⁠jeremygold02 — good catch: with a target shown, VICTORY_CAPTURE still reads back the title's own present source, not the back buffer the window gets. So frame-N.png does not show the selected target. With VICTORY_DUMP_TARGETS=1 the selected target is in the dump of that frame, which is how I checked it. Reading back the composited back buffer when a target is shown would be the better behaviour; happy to add it here if wanted. A target that is all black in the loading frames matches what I saw: it only fills once world draws bind it.

@⁠Fimpos — thanks, that combination going 800+ world frames without a removal is the furthest I have seen reported.

@⁠aycow — thanks for the trace branch, I'll run it when I'm back.

What I saw since opening this, on an RTX 5070 (driver 621.14), with main + #20 + #320 (later + #439), the two stuck mesh passes skipped with VICTORY_SKIP_PIPELINES:

  • The shown target has the world's geometry (picnic tables, street lamps, a basketball hoop, characters, power lines) from about frame 2400 on, up to ~4000 draws per frame.
  • In a VICTORY_DUMP_TARGETS capture of the same frames, every 2560x1440 RGBA16F and R11G11B10F target stays at exactly 0: the lighting writes nothing. On NVIDIA that is the screen-size lighting compute (160x90 / 320x180 dispatches) being dropped for wave64 reasons. With #439, six of the seven such shaders I dumped translate and run; the seventh needs v_permlanex16 (#98). I have not yet captured a world frame on #439 to see whether the lighting targets fill.

AI-assisted (Claude Code); no game files attached.

**@⁠AKA0GHOST** on GitHub · 2026-11-24 08:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/530#issuecomment-7125939567) Thanks all for testing this, and sorry for the late follow-up. @⁠jeremygold02 — good catch: with a target shown, `VICTORY_CAPTURE` still reads back the title's own present source, not the back buffer the window gets. So `frame-N.png` does not show the selected target. With `VICTORY_DUMP_TARGETS=1` the selected target is in the dump of that frame, which is how I checked it. Reading back the composited back buffer when a target is shown would be the better behaviour; happy to add it here if wanted. A target that is all black in the loading frames matches what I saw: it only fills once world draws bind it. @⁠Fimpos — thanks, that combination going 800+ world frames without a removal is the furthest I have seen reported. @⁠aycow — thanks for the trace branch, I'll run it when I'm back. What I saw since opening this, on an RTX 5070 (driver 621.14), with main + #20 + #320 (later + #439), the two stuck mesh passes skipped with `VICTORY_SKIP_PIPELINES`: - The shown target has the world's geometry (picnic tables, street lamps, a basketball hoop, characters, power lines) from about frame 2400 on, up to ~4000 draws per frame. - In a `VICTORY_DUMP_TARGETS` capture of the same frames, every 2560x1440 RGBA16F and R11G11B10F target stays at exactly 0: the lighting writes nothing. On NVIDIA that is the screen-size lighting compute (160x90 / 320x180 dispatches) being dropped for wave64 reasons. With #439, six of the seven such shaders I dumped translate and run; the seventh needs `v_permlanex16` (#98). I have not yet captured a world frame on #439 to see whether the lighting targets fill. AI-assisted (Claude Code); no game files attached.
Author
Owner

@⁠erLCoder on GitHub · 2026-11-24 13:09 UTC · original

Target-selection observations on GTX 1660 Ti, NVIDIA 581.42, Windows 10 22H2 19045.6466, Ryzen 5 3600, Rust 1.98.1 MSVC and Agility SDK 1.620.2. Built PR 951ceb1 separately on main 8e79c80 + #493 c48b240 + #189 d0fd9bf + #206 05981dd, with local SDK exports. The diagnostic build and CLI smoke check passed.

cargo test --offline --locked --profile diag -p victory-gpu --features diagnostics --lib show_spec_reads_size_and_format -- --nocapture --test-threads=1 — 1 passed, 0 failed, 0 ignored, 56 filtered out (CPU parser). A native D3D12 probe created a synthetic 2560x1440 format-28 RTV/UAV on NVIDIA LUID 00000000:00017c52.

A separate title run of the base stack without either preview PR captured several 2560x1440 format-28 targets on frame 9000. Two contained three recognizable character meshes; other targets of that same size and format were flat or black. The size-and-format selector remembers the last matching target, so this observation does not determine which one #530 would show. Runtime preview and movement with #530 remain untested. No title files or screenshots attached.

Codex assembled the worktree, ran the tests and drafted this report.

**@⁠erLCoder** on GitHub · 2026-11-24 13:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/530#issuecomment-7132437824) Target-selection observations on GTX 1660 Ti, NVIDIA 581.42, Windows 10 22H2 19045.6466, Ryzen 5 3600, Rust 1.98.1 MSVC and Agility SDK 1.620.2. Built PR 951ceb1 separately on main 8e79c80 + #493 c48b240 + #189 d0fd9bf + #206 05981dd, with local SDK exports. The diagnostic build and CLI smoke check passed. `cargo test --offline --locked --profile diag -p victory-gpu --features diagnostics --lib show_spec_reads_size_and_format -- --nocapture --test-threads=1` — 1 passed, 0 failed, 0 ignored, 56 filtered out (CPU parser). A native D3D12 probe created a synthetic 2560x1440 format-28 RTV/UAV on NVIDIA LUID 00000000:00017c52. A separate title run of the base stack without either preview PR captured several 2560x1440 format-28 targets on frame 9000. Two contained three recognizable character meshes; other targets of that same size and format were flat or black. The size-and-format selector remembers the last matching target, so this observation does not determine which one #530 would show. Runtime preview and movement with #530 remain untested. No title files or screenshots attached. Codex assembled the worktree, ran the tests and drafted this report.
Author
Owner

@⁠AKA0GHOST on GitHub · 2026-11-24 15:55 UTC · original

@⁠mercuryVM thanks for the review and the test run.

  • Name clash with #638: agreed. Two parsers reading the same variable would make one silently ignore the other's values. Whichever lands second should accept all three forms in one parser (<w>x<h>-f<fmt>, <n>, busiest). If #638 lands first, I'll rebase this onto its parser rather than keep two.
  • SHOWN holding an Arc: right, a released target stays alive and on screen until another one matches. That's intended for a diagnostic (the window never goes blank mid-run), and I'll add a comment saying so.

@⁠erLCoder thanks. Yes, several 2560x1440 RGBA8 targets exist per frame, and the selector shows the last one bound. On this title that was the geometry one in the frames I checked, but that's not guaranteed. An index among the matches would pin it; I'd rather converge with #638's <n> form than add a second scheme.

AI-assisted (Claude Code).

**@⁠AKA0GHOST** on GitHub · 2026-11-24 15:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/530#issuecomment-7136853598) @⁠mercuryVM thanks for the review and the test run. - **Name clash with #638:** agreed. Two parsers reading the same variable would make one silently ignore the other's values. Whichever lands second should accept all three forms in one parser (`<w>x<h>-f<fmt>`, `<n>`, `busiest`). If #638 lands first, I'll rebase this onto its parser rather than keep two. - **`SHOWN` holding an `Arc`:** right, a released target stays alive and on screen until another one matches. That's intended for a diagnostic (the window never goes blank mid-run), and I'll add a comment saying so. @⁠erLCoder thanks. Yes, several 2560x1440 RGBA8 targets exist per frame, and the selector shows the last one bound. On this title that was the geometry one in the frames I checked, but that's not guaranteed. An index among the matches would pin it; I'd rather converge with #638's `<n>` form than add a second scheme. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:24 UTC · original

Automated triage for the maintainers.

Needs rebase. This PR does not merge cleanly into current main (ac2525d). Conflicting files: README.md, crates/victory-gpu/src/capture.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/530#issuecomment-7148471016) <!-- victory-triage v1 head=951ceb1eb8dac4034bf2ecec8e9b32a5df1010a6 verdict=needs-rebase at=2026-11-25T00:13:20Z --> Automated triage for the maintainers. **Needs rebase.** This PR does not merge cleanly into current `main` (ac2525d). Conflicting files: `README.md`, `crates/victory-gpu/src/capture.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • README.md
  • crates/victory-gpu/src/capture.rs
  • crates/victory-gpu/src/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-530'
git switch 'github-bot/gh-530'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-530'
git switch 'github-bot/gh-530'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-530'
git switch 'main'
git merge --squash 'github-bot/gh-530'
git switch 'main'
git merge --ff-only 'github-bot/gh-530'
git switch 'main'
git merge 'github-bot/gh-530'
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!530
No description provided.