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

Open
github-bot wants to merge 3 commits from github-bot/gh-2732 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 19:14 UTC · original
andrewpozdnakov7-jpg:codex2/capture-clear-only-targets → main · +216 −20 · 4 files · 3 commits · open

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.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 19:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/2732) `andrewpozdnakov7-jpg:codex2/capture-clear-only-targets` → `main` · +216 −20 · 4 files · 3 commits · open ## 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://git.gtahub.st/github/Marvisak--VIctory/issues/1633) 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:58 +00:00
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 19:36 UTC · original

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).
**@⁠fuzeofficlal** on GitHub · 2026-11-25 19:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2732#issuecomment-7172527355) 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`).
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 20:06 UTC · original

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.

**@⁠kotekompotek** on GitHub · 2026-11-25 20:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2732#issuecomment-7173197463) 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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:21 UTC · original · edited 2026-11-26 07:18 UTC

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

**@⁠Marvisak** on GitHub · 2026-11-25 23:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/2732#issuecomment-7177448286) · edited 2026-11-26 07:18 UTC <!-- 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)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 06:27 UTC · original

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]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 06:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/2732#issuecomment-7184448595) 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]>`.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 14:15 UTC · original · approved these changes

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.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 14:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2732#pullrequestreview-6075627098) · **approved these changes** 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.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 14:36 UTC · original

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]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 14:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2732#issuecomment-7195067880) 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://git.gtahub.st/github/Marvisak--VIctory/pulls/2702). Please retain the Git authors on pickup. If folding the resolution into another commit, use `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
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/2732/head:github-bot/gh-2732'
git switch 'github-bot/gh-2732'

Merge

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