GPU: resolve multisampled color targets before diagnostic readback #2702
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2702
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2702"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 18:28 UTC · original
andrewpozdnakov7-jpg:codex2/capture-msaa-color→main· +264 −15 · 2 files · 4 commits · openProblem
The diagnostic target dump skips multisampled color targets, so a frame or submission can be missing the render target that was just written.
Change
For a typed color format with render-target and resolve support, resolve the first subresource into a temporary single-sample texture before readback. The source returns to its original state before the capture list finishes. D3D12 ResolveSubresource requirements
Verification
13f91ca. With the patch, it writes a red 2x2 present PNG and a green 2x2 submission PNG after a second clear. The regression inflates both PNGs to check every sampled pixel.Coordination claim
AI-assisted (Codex 2). Please retain the Git author on cherry-pick or rebase. If folding this change into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg [email protected].
@fuzeofficlal on GitHub · 2026-11-25 18:48 UTC · original
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and code review of
b48e6c74(on13f91ca):Verification (
rustc 1.98.1MSVC)cargo clippy --locked -p victory-gpu --all-targets -- -D warningsand--features diagnostics: 0 warnings.cargo test --locked -p victory-gpu --features diagnostics --lib capture: 3 passed, 0 failed (includingmultisampled_color_targets_are_captured, which runs a 4x MSAA capture in its WARP child process).cargo test --locked -p victory-gpu --features diagnostics --lib resource: 20 passed, 0 failed.VICTORY_D3D12_WARP=1):cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1: 199 passed, 0 failed, 1 ignored.git merge-treewith #2701 (a86d36ef).Code Review Notes
resolve_destinationproperly filters to non-depthTEXTURE2Dand queriesD3D12_FORMAT_SUPPORT1_RENDER_TARGET | D3D12_FORMAT_SUPPORT1_MULTISAMPLE_RESOLVE, safely skipping integer and typeless formats thatResolveSubresourcecannot take without risking D3D12 validation errors or device removal.legal_state -> RESOLVE_SOURCE -> original, and temporary single-sample targetRESOLVE_DEST -> COPY_SOURCE) andresolvedlifetime (kept alive past synchronoushost.execute) are sound.@kotekompotek on GitHub · 2026-11-25 18:54 UTC · original
Clean approach: gate on RENDER_TARGET|MULTISAMPLE_RESOLVE support, build the single-sample dest in RESOLVE_DEST, and the twins skip stays scoped correctly (moved after dump_one so the MSAA target itself resolves, while twins - which can't be resolved anyway - are still skipped). The two-PNG inflation test verifies actual content, not just file existence.
@oni-swr on GitHub · 2026-11-25 18:54 UTC · original
Independent WARP/CPU verification
PR head:
b48e6c749efe616ac72e24c24af09f5a021c5da4Environment: Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1, WARP only (
VICTORY_WARP=1+VICTORY_D3D12_WARP=1),dxil.dll1.8.2502.11 (Windows SDK 10.0.26100.0), no physical GPU touched, no game files/dumps/retail hashes.CARGO_TARGET_DIRon D:,--lockedthroughout.origin/main=13f91caee25f2fdf2c062be5f7a27f058e51cbca; merges cleanly (git merge-tree); open, non-draft, nooni-swrcomment on this head.Commands / results (
-p victory-gpu):origin/main:cargo test --locked -p victory-gpu --features diagnostics→ 198 passed, 0 failed, 1 ignored.multisampled_color_targets_are_captured). Run with--nocapture: "4x WARP color target produced 2 PNGs" (so WARP supports the 4x target here; the test did not take its skip path).diagnostics:cargo test --locked -p victory-gpu→ 195 passed, 0 failed, 1 ignored.cargo clippy --locked -p victory-gpu --all-targets [--features diagnostics] -- -D warnings→ clean (both).capture.rsrestored toorigin/main→ the new test FAILS (0 PNGs produced, "expected one present PNG and one submission PNG"). So the test exercises the production change.Review: no bugs found. The test checks exact pixel values for both the present dump and the per-submission dump (red, then green), which is a strong check. Minor, non-blocking observations: only subresource 0 is resolved (fine for non-array MSAA; an MSAA array target would dump only slice 0 if the readback covers more); unsupported/typeless/depth MSAA formats are still silently skipped (
resolve_destination->None), as before. Dump code is diagnostics-only.Not tested: physical hardware GPU, retail game run, release build.
AI use: Claude Code (Claude Sonnet 5.5). Claim: #1633
@Marvisak on GitHub · 2026-11-25 22:20 UTC · original · edited 2026-11-26 07:18 UTC
Automated triage for the maintainers.
Merge candidate. Re-reviewed at
c946918. The code under test has not changed.dump_targets/dump_submissionincrates/victory-gpu/src/capture.rsno longer skip MSAA color targets.resolve_destinationmakes a single-sample copy only for non-depth 2D formats that support render-target and multisample resolve, anddump_oneresolves subresource 0, then puts the source back in its original state.The only blocker last time was the self-spawning test, and it is gone.
multisampled_color_targets_are_capturednow runs in-process:with_test_capturescopes the folder and pending targets to the test thread, and the test checks both PNGs pixel by pixel. The test hooks inlisted,dump_on,save_asanddump_targetsarecfg(test)only. #2732 adds the same scaffolding, so whichever PR lands second should merge cleanly or take a trivial rebase. Still minor: an MSAA array target dumps only its first slice.Reply to the author: thanks, this resolves the point.
CI:
checkpassing.Generated by Claude Code
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 06:24 UTC · original
The regression now runs in the current process on current
main. Commit 8e46ade scopes capture settings and pending targets to the test thread. It uses the actual D3D12 submission and present capture paths, with one green submission PNG and one red present PNG. It checks both image sizes and every RGB pixel.On app-local WARP, restoring the two old MSAA skip checks yielded zero PNGs with this same test. The updated head yielded both. The full GPU suite passed 247 tests with 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 it is folded into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.@andrewpozdnakov7-jpg on GitHub · 2026-11-26 06:44 UTC · original
Follow-up c946918 keeps MSAA test registration separate from the clear writer tracking edited by #2732. The two current branches now merge cleanly. In their exact local combination, both capture tests also passed when run concurrently, with 2 MSAA PNGs and 6 clear-only PNGs. The combined GPU suite passed 248 tests with one ignored. The standalone MSAA regression still produces zero PNGs with the old skips and two with the resolve enabled.
Please retain the Git author if moving the test. If it is folded into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.@fuzeofficlal on GitHub · 2026-11-26 14:15 UTC · original · approved these changes
Reviewed and verified head
c94691808c0a17aad39c3fc87e350161fba203bf(clean merge withorigin/main63bcca43) 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 (
crates/victory-gpu/src/capture.rs)capture.rsandresource.rs:2417test).resolve_destination(L591) restricts resolve targets to non-depthTEXTURE2Dresources whose format supports bothD3D12_FORMAT_SUPPORT1_RENDER_TARGETandD3D12_FORMAT_SUPPORT1_MULTISAMPLE_RESOLVE, safely skipping typeless, integer, and depth MSAA textures. The temporary single-sample target clearsAlignment/Flags(L617-623) and starts inRESOLVE_DEST.dump_one(L642-690) transitions the MSAA sourcestate -> RESOLVE_SOURCE, executesResolveSubresource(target, 0, texture, 0, d.Format)(L671), transitions the temporary targetRESOLVE_DEST -> COPY_SOURCEforread_back, restores the MSAA source back to its originalstate, and keepsresolvedalive past synchronoushost.execute.capture.rswith #594 when combined).Verification
cargo xtask policy:191 files ok;cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default &--all-features): 0 warnings--features diagnostics,VICTORY_D3D12_DEBUG=1):resource::tests::multisampled_color_targets_are_captured: passed on both (4x color target produced 2 PNGs)resource::tests capture::tests: 24/24 passed on both adaptersresolve_destinationreturnsNonefor 4x MSAAR8G8B8A8_TYPELESS,R32_UINT, andD32_FLOATwithout Debug Layer errors; (2) afterdump_oneresolves a 4x MSAAR8G8B8A8_UNORMtarget inRENDER_TARGETstate, an immediate subsequentClearRenderTargetViewwith no barrier succeeds with 0 D3D12 Debug Layer messages, verifying exact GPU-side state restoration.origin/main: strict--all-featuresClippy clean, and both capture tests passed concurrently on RTX 5090 and WARP underVICTORY_D3D12_DEBUG=1.Clean implementation; approving.
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 14:36 UTC · original
I resolved the #594 conflict mentioned in the latest review. Integration
5e2e85acombines this head with #2732 at20acb8fand #594 atc6e6daa, preserving all three histories. The MSAA path moves only subresource 0 toRESOLVE_SOURCEand restores its previous state under the submission lock.The expanded regression clears slice 0 of a 4× MSAA array while slice 1 is in
COPY_SOURCE. It checks the states after both capture paths and compares every pixel in the green submission PNG and red present PNG. App-local Agility 1.620.2 / WARP 1.0.22 also produced all six clear-only PNGs and passed #594's slice-copy regression. The full GPU suite was 250 passed (including the runtime-identity check), 1 ignored. Strict GPU Clippy with default and all features and the asset-policy check passed. Local debug-layer startup returned0x887a002d, so the integration runtime results are from WARP with the debug layer off.The integration branch is available for the maintainers when choosing the merge order. Please retain the Git authors on pickup, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding this resolution into another commit.@Dukestar69 on GitHub · 2026-11-26 18:30 UTC · original · approved these changes
LGTM — verified on RTX 5090 (Windows / D3D12) against
origin/main(63bcca4).cargo test -p victory-gpu --lib --features diagnostics resource::tests::multisampled_color_targets_are_captured -- --nocapture --test-threads=1: passed (4x color target produced 2 PNGson RTX 5090).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).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.