GPU diagnostics: record per-draw samples on selected capture frames #828

Open
Harveyweiii wants to merge 1 commit from upstream-pr/829 into main
Harveyweiii commented 2026-11-25 09:29:12 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Harveyweiii on 2026-11-25T09:29:12Z.


While investigating a dark interior in #12, we could see geometry in the depth buffer but could not tell which individual draws contributed. This adds opt-in D3D12 occlusion counts to the existing frame capture.

Set VICTORY_DRAW_SAMPLES=1, point VICTORY_CAPTURE at an external directory, and select a frame with VICTORY_CAPTURE_FRAMES. Join the draw-query ID in the ops log to the per-frame TSV to see how many samples passed depth and stencil. Indirect commands have one aggregate count. Later draws can overwrite those samples. Sampled submissions use the synchronous path, so these captures should not be used to benchmark frame time.

Verification

Tested against 9376fd6 on Windows with an RTX 4070 Ti SUPER. The synthetic 8 × 8 render target returned 0 samples for an empty draw, 12 for a 3 × 4 scissor, and 64 for full coverage. The same test crosses the 256-query heap boundary and checks the two recording frames' TSV rows.

  • cargo test --locked -p victory-gpu --features diagnostics --lib gpu_reports_empty_scissored_and_full_draws -- --nocapture passed.
  • cargo xtask policy passed (173 files).
  • Local workspace Clippy with warnings as errors still reports the existing sort in draw.rs and unused depth_written field; the default-feature run also reports unused placed_filler_twins. These lines are unchanged by this patch.

Related to #12 for diagnostics. The color issue remains open.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6601359858 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/829). Originally posted by [Harveyweiii](https://github.com/Harveyweiii) on 2026-11-25T09:29:12Z. --- While investigating a dark interior in #12, we could see geometry in the depth buffer but could not tell which individual draws contributed. This adds opt-in D3D12 occlusion counts to the existing frame capture. Set `VICTORY_DRAW_SAMPLES=1`, point `VICTORY_CAPTURE` at an external directory, and select a frame with `VICTORY_CAPTURE_FRAMES`. Join the draw-query ID in the ops log to the per-frame TSV to see how many samples passed depth and stencil. Indirect commands have one aggregate count. Later draws can overwrite those samples. Sampled submissions use the synchronous path, so these captures should not be used to benchmark frame time. ### Verification Tested against `9376fd6` on Windows with an RTX 4070 Ti SUPER. The synthetic 8 × 8 render target returned 0 samples for an empty draw, 12 for a 3 × 4 scissor, and 64 for full coverage. The same test crosses the 256-query heap boundary and checks the two recording frames' TSV rows. - `cargo test --locked -p victory-gpu --features diagnostics --lib gpu_reports_empty_scissored_and_full_draws -- --nocapture` passed. - `cargo xtask policy` passed (173 files). - Local workspace Clippy with warnings as errors still reports the existing sort in draw.rs and unused depth_written field; the default-feature run also reports unused placed_filler_twins. These lines are unchanged by this patch. Related to #12 for diagnostics. The color issue remains open.
MamaLeVrai commented 2026-11-25 11:10:33 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by MamaLeVrai on 2026-11-25T10:12:49Z.


Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head 0947053 into main 9376fd6 in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails with exactly the errors main itself has on this machine (placed_filler_twins never used, depth_written never read, in victory-gpu); with --all-features it fails with the same number of errors as main (4). This PR adds none and removes none. cargo test --workspace --locked: 540 passed, 0 failed, 10 ignored, two runs (main alone: 540 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7159386020 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/829#issuecomment-7159386020). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T10:12:49Z. --- Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head `0947053` into `main` `9376fd6` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings` fails with exactly the errors `main` itself has on this machine (`placed_filler_twins` never used, `depth_written` never read, in `victory-gpu`); with `--all-features` it fails with the same number of errors as `main` (4). This PR adds none and removes none. `cargo test --workspace --locked`: 540 passed, 0 failed, 10 ignored, two runs (`main` alone: 540 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/829:upstream-pr/829'
git switch 'upstream-pr/829'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/829'
git switch 'upstream-pr/829'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/829'
git switch 'upstream-pr/829'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/829'
git switch 'main'
git merge --squash 'upstream-pr/829'
git switch 'main'
git merge --ff-only 'upstream-pr/829'
git switch 'main'
git merge 'upstream-pr/829'
git push origin 'main'
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
fxceless/victory-fork!828
No description provided.