GPU: capture render and depth targets written by clears #2730

Open
andrewpozdnakov7-jpg wants to merge 3 commits from upstream-pr/2732 into main
andrewpozdnakov7-jpg commented 2026-11-25 19:14:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T19:14:08Z.


Summary

Record textures written by ClearRenderTargetView and ClearDepthStencilView in diagnostic captures. A guest can clear a view without binding it through OMSetRenderTargets. Both the submission capture and the present capture now include that texture.

A clear carries no pipeline name. If a later binding names the same texture, capture retains that name across the lists in the submission.

Verification

The same synthetic guest-vtable fixture on 13f91ca emits just two PNGs for a blue control that is later bound. With this change it emits six. The four additional PNGs contain a red color clear and a two-tone depth clear at submission and at present. The fixture decodes every PNG, checks the pixels and verifies the blue control retains its pipeline label.

The targeted regression passed on D3D12 WARP. The app-local WARP GPU library suite, strict GPU Clippy with and without diagnostics, and the staged asset policy also passed.

Coordination claim

Please retain the Git author if cherry-picking or rebasing this commit. If folding it into another commit, add Co-authored-by: andrewpozdnakov7-jpg [email protected].

AI-assisted. Verification used synthetic textures and command lists.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6611824996 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2732). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T19:14:08Z. --- ## Summary Record textures written by ClearRenderTargetView and ClearDepthStencilView in diagnostic captures. A guest can clear a view without binding it through OMSetRenderTargets. Both the submission capture and the present capture now include that texture. A clear carries no pipeline name. If a later binding names the same texture, capture retains that name across the lists in the submission. ## Verification The same synthetic guest-vtable fixture on 13f91ca emits just two PNGs for a blue control that is later bound. With this change it emits six. The four additional PNGs contain a red color clear and a two-tone depth clear at submission and at present. The fixture decodes every PNG, checks the pixels and verifies the blue control retains its pipeline label. The targeted regression passed on D3D12 WARP. The app-local WARP GPU library suite, strict GPU Clippy with and without diagnostics, and the staged asset policy also passed. [Coordination claim](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7171818636) Please retain the Git author if cherry-picking or rebasing this commit. If folding it into another commit, add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>. AI-assisted. Verification used synthetic textures and command lists.
fuzeofficlal commented 2026-11-25 20:06:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T19:36:22Z.


Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and review of a7c5f5a7 (on 13f91ca):

Verification (rustc 1.98.1 MSVC)

  • cargo xtask policy: 184 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings and --features diagnostics: 0 warnings.
  • WARP (VICTORY_D3D12_WARP=1): cargo test --locked -p victory-gpu --features diagnostics -> 199 passed, 0 failed, 1 ignored (including resource::tests::clear_only_targets_are_captured_without_a_pipeline_name).
  • RTX 5090 (default features, non-diagnostics): cargo test --locked -p victory-gpu --lib -- clear -> 4 passed, 0 failed (all capture hooks cleanly compiled out).

Review & Merge-Ordering Notes

  • Recording clears with an empty writer (note_clear -> note_write(..., false)) and promoting empty writers to named pipeline writers on subsequent binds avoids attributing clears to an unrelated prior pipeline, with zero overhead outside feature = "diagnostics".
  • Cleanly complementary with #2702 (zero hunk overlap in capture.rs and resource.rs) and #2673 (only 1-line adjacent context near dump_submission in host.rs).
<!-- greyfinch-sync:Marvisak/VIctory:comment:7172527355 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2732#issuecomment-7172527355). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T19:36:22Z. --- Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and review of `a7c5f5a7` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC) - `cargo xtask policy`: **184 files ok**. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` and `--features diagnostics`: **0 warnings**. - **WARP (`VICTORY_D3D12_WARP=1`):** `cargo test --locked -p victory-gpu --features diagnostics` -> **199 passed, 0 failed, 1 ignored** (including `resource::tests::clear_only_targets_are_captured_without_a_pipeline_name`). - **RTX 5090 (default features, non-`diagnostics`):** `cargo test --locked -p victory-gpu --lib -- clear` -> **4 passed, 0 failed** (all capture hooks cleanly compiled out). ### Review & Merge-Ordering Notes - Recording clears with an empty `writer` (`note_clear` -> `note_write(..., false)`) and promoting empty writers to named pipeline writers on subsequent binds avoids attributing clears to an unrelated prior pipeline, with zero overhead outside `feature = "diagnostics"`. - Cleanly complementary with #2702 (zero hunk overlap in `capture.rs` and `resource.rs`) and #2673 (only 1-line adjacent context near `dump_submission` in `host.rs`).
kotekompotek commented 2026-11-25 20:06:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T20:06:21Z.


Sensible attribution: clears get recorded with an empty writer name, and record_capture_target backfills the writer only when the stored one is empty - so a later pipeline write in the same frame claims the dump over the clear, and a clear-only frame still names the resource. The DSV flag check (flags & 3 != 0) matches which clears actually write.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7173197463 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2732#issuecomment-7173197463). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T20:06:21Z. --- Sensible attribution: clears get recorded with an empty writer name, and record_capture_target backfills the writer only when the stored one is empty - so a later pipeline write in the same frame claims the dump over the clear, and a clear-only frame still names the resource. The DSV flag check (flags & 3 != 0) matches which clears actually write.
Marvisak commented 2026-11-26 00:03:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T23:21:23Z.


Automated triage for the maintainers.

Merge candidate. Re-reviewed at 20acb8f. clear_rtv and clear_dsv (the latter only when depth or stencil is cleared) in crates/victory-gpu/src/list.rs call capture::note_clear. That records the target with an empty writer instead of the stale bound pipeline. record_capture_target (host.rs) and note_write (capture.rs) fill in the writer name when a later pipeline binding names the same target. All of this is behind diagnostics.

The process-spawning test is gone. clear_only_targets_are_captured_without_a_pipeline_name now runs in-process through the thread-scoped with_test_capture. It drives the guest clear calls and checks six PNGs: pixels, the absence of the stale name, and the later name. The scaffolding is the same as in #2702.

Reply to the author: thanks, this resolves the point.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177448286 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2732#issuecomment-7177448286). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T23:21:23Z. --- <!-- victory-triage v1 head=20acb8fb10f7eab4af20ed9485af9fd05edfb594 verdict=merge-candidate at=2026-11-26T07:18:37Z --> Automated triage for the maintainers. **Merge candidate.** Re-reviewed at `20acb8f`. `clear_rtv` and `clear_dsv` (the latter only when depth or stencil is cleared) in `crates/victory-gpu/src/list.rs` call `capture::note_clear`. That records the target with an empty writer instead of the stale bound pipeline. `record_capture_target` (`host.rs`) and `note_write` (`capture.rs`) fill in the writer name when a later pipeline binding names the same target. All of this is behind `diagnostics`. The process-spawning test is gone. `clear_only_targets_are_captured_without_a_pipeline_name` now runs in-process through the thread-scoped `with_test_capture`. It drives the guest clear calls and checks six PNGs: pixels, the absence of the stale name, and the later name. The scaffolding is the same as in #2702. **Reply to the author:** thanks, this resolves the point. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
andrewpozdnakov7-jpg commented 2026-11-26 07:01:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T06:27:31Z.


Commit 20acb8f ports the regression to the current test process and brings the branch onto current main. Capture settings and pending targets are scoped to the test thread. Guest RTV/DSV clears still go through the command list ABI. The test checks color and depth PNGs at submission and present, exact pixels, and whether a later pipeline binding supplies the writer name.

On app-local WARP the same test yielded only the two named control images with the clear hooks disabled, and all six expected images with them enabled. Full GPU suite 247 passed and 1 ignored. Strict GPU Clippy passed with default and all features, and asset policy passed.

Please retain the Git author if moving the test. If folding it into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7184448595 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2732#issuecomment-7184448595). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T06:27:31Z. --- Commit [20acb8f](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/20acb8fb10f7eab4af20ed9485af9fd05edfb594) ports the regression to the current test process and brings the branch onto current `main`. Capture settings and pending targets are scoped to the test thread. Guest RTV/DSV clears still go through the command list ABI. The test checks color and depth PNGs at submission and present, exact pixels, and whether a later pipeline binding supplies the writer name. On app-local WARP the same test yielded only the two named control images with the clear hooks disabled, and all six expected images with them enabled. Full GPU suite 247 passed and 1 ignored. Strict GPU Clippy passed with default and all features, and asset policy passed. Please retain the Git author if moving the test. If folding it into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
fuzeofficlal commented 2026-11-26 14:15:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T14:15:26Z.

Review: APPROVED


Reviewed and verified head 20acb8fb10f7eab4af20ed9485af9fd05edfb594 (clean merge with origin/main 63bcca43) on Windows 11 x64 with NVIDIA GeForce RTX 5090 and D3D12 WARP (VICTORY_D3D12_WARP=1, VICTORY_D3D12_DEBUG=1, Rust 1.98.1).

Code review

  • All capture hooks and helper code remain strictly gated behind #[cfg(feature = "diagnostics")] (crates/victory-gpu/src/list.rs:1039,1082-1083, host.rs:1663,2042, capture.rs), keeping default and --release builds completely zero-overhead.
  • clear_rtv notes clears only after early-out checks on handle/resource/color, and clear_dsv gates on flags & 3 != 0 so no-op clears are not captured.
  • capture::note_clear (capture.rs:338-342) records clears with an empty writer instead of the thread's stale bound pipeline, while record_capture_target (host.rs:1663) and note_write (capture.rs:369-377) promote an empty writer when a subsequent pipeline binding names the same resource without overwriting an existing pipeline label.
  • with_test_capture (capture.rs:283) is #[cfg(test)]-only and cleans up thread-local state via a Drop guard.
  • Clean 3-way merge with #2702 (note: minor conflict in capture.rs with #594 when both are combined).

Verification

  • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default & --all-features): 0 warnings
  • RTX 5090 (non-diagnostics): default resource::tests list::tests 22/22 passed; --release clear 5/5 passed
  • RTX 5090 & WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1):
    • resource::tests::clear_only_targets_are_captured_without_a_pipeline_name: passed on both (clear-only capture produced 6 PNGs)
    • resource::tests capture::tests list::tests: 28/28 passed on both adapters
  • Combined #2732 + #2702 merged onto origin/main: strict --all-features Clippy clean, and both clear_only_targets_are_captured_without_a_pipeline_name and multisampled_color_targets_are_captured passed concurrently on both RTX 5090 and WARP under VICTORY_D3D12_DEBUG=1.

Clean, well-tested fix; approving.

<!-- greyfinch-sync:Marvisak/VIctory:review:6075627098 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2732#pullrequestreview-6075627098). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T14:15:26Z. **Review:** APPROVED --- Reviewed and verified head `20acb8fb10f7eab4af20ed9485af9fd05edfb594` (clean merge with `origin/main` `63bcca43`) on Windows 11 x64 with **NVIDIA GeForce RTX 5090** and **D3D12 WARP** (`VICTORY_D3D12_WARP=1`, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1). **Code review** - All capture hooks and helper code remain strictly gated behind `#[cfg(feature = "diagnostics")]` (`crates/victory-gpu/src/list.rs:1039,1082-1083`, `host.rs:1663,2042`, `capture.rs`), keeping default and `--release` builds completely zero-overhead. - `clear_rtv` notes clears only after early-out checks on handle/resource/color, and `clear_dsv` gates on `flags & 3 != 0` so no-op clears are not captured. - `capture::note_clear` (`capture.rs:338-342`) records clears with an empty writer instead of the thread's stale bound pipeline, while `record_capture_target` (`host.rs:1663`) and `note_write` (`capture.rs:369-377`) promote an empty writer when a subsequent pipeline binding names the same resource without overwriting an existing pipeline label. - `with_test_capture` (`capture.rs:283`) is `#[cfg(test)]`-only and cleans up thread-local state via a `Drop` guard. - Clean 3-way merge with #2702 (note: minor conflict in `capture.rs` with #594 when both are combined). **Verification** - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default & `--all-features`): 0 warnings - **RTX 5090 (non-diagnostics)**: default `resource::tests list::tests` **22/22 passed**; `--release` `clear` **5/5 passed** - **RTX 5090 & WARP (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`)**: - `resource::tests::clear_only_targets_are_captured_without_a_pipeline_name`: passed on both (`clear-only capture produced 6 PNGs`) - `resource::tests capture::tests list::tests`: **28/28 passed** on both adapters - **Combined #2732 + #2702** merged onto `origin/main`: strict `--all-features` Clippy clean, and both `clear_only_targets_are_captured_without_a_pipeline_name` and `multisampled_color_targets_are_captured` passed concurrently on both RTX 5090 and WARP under `VICTORY_D3D12_DEBUG=1`. Clean, well-tested fix; approving.
andrewpozdnakov7-jpg commented 2026-11-26 15:02:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T14:36:40Z.


The #594 conflict raised in review is resolved in integration 5e2e85a, which combines all three exact heads. This PR's six clear-only capture PNGs still match on app-local WARP alongside #2702's two MSAA PNGs and #594's slice-copy regression. Merge order is with the maintainers. WARP results and test details.

Please retain the Git authors on pickup. If folding the resolution into another commit, use Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7195067880 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2732#issuecomment-7195067880). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T14:36:40Z. --- The #594 conflict raised in review is resolved in [integration `5e2e85a`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/5e2e85acbaaade435ecbed7fb48438df715ed864), which combines all three exact heads. This PR's six clear-only capture PNGs still match on app-local WARP alongside #2702's two MSAA PNGs and #594's slice-copy regression. Merge order is with the maintainers. [WARP results and test details](https://github.com/Marvisak/VIctory/pull/2702#issuecomment-7195060199). Please retain the Git authors on pickup. If folding the resolution into another commit, use `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
Dukestar69 commented 2026-11-26 18:11:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T18:11:53Z.

Review: APPROVED


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

  • Recording cleared render targets and depth targets directly into the frame capture ensures clear-only passes are visible in diagnostics captures without disturbing normal draw recording.
  • cargo test -p victory-gpu --lib --features diagnostics capture:: -- --test-threads=1: 11 passed, 0 failed.
  • cargo test -p victory-gpu --lib resource:: -- --test-threads=1: 18 passed, 0 failed.
  • 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).

<!-- greyfinch-sync:Marvisak/VIctory:review:6078825444 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2732#pullrequestreview-6078825444). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T18:11:53Z. **Review:** APPROVED --- LGTM — verified on RTX 5090 (Windows / D3D12) against `origin/main` (`63bcca4`). - Recording cleared render targets and depth targets directly into the frame capture ensures clear-only passes are visible in diagnostics captures without disturbing normal draw recording. - `cargo test -p victory-gpu --lib --features diagnostics capture:: -- --test-threads=1`: 11 passed, 0 failed. - `cargo test -p victory-gpu --lib resource:: -- --test-threads=1`: 18 passed, 0 failed. - `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).
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/2732:upstream-pr/2732'
git switch 'upstream-pr/2732'

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/2732'
git switch 'upstream-pr/2732'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2732'
git switch 'upstream-pr/2732'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2732'
git switch 'main'
git merge --squash 'upstream-pr/2732'
git switch 'main'
git merge --ff-only 'upstream-pr/2732'
git switch 'main'
git merge 'upstream-pr/2732'
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
Marvisak/VIctory!2730
No description provided.