GPU: ignore depth-stencil clears whose host flags mask to zero #3148
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3150"
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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T10:24:20Z.
Summary
list::clear_dsvmasks incomingClearDepthStencilViewflags with& 3to strip console-only bits aboveD3D12_CLEAR_FLAG_DEPTH | D3D12_CLEAR_FLAG_STENCIL, but still transitions the depth target, allocates a host DSV, and recordsClearDepthStencilView(..., D3D12_CLEAR_FLAGS(0), ...)when the masked value is0(for example,flags == 0or console-only flags such as0x4).D3D12 rejects
ClearFlags == 0(ID3D12CommandList::ClearDepthStencilView: Invalid ClearFlags value (0x0). ClearFlags must be either D3D12_CLEAR_FLAG_DEPTH (0x1) or D3D12_CLEAR_FLAG_STENCIL (0x2) or both (0x3).).Fix
Mask
flagswith& 3at the top ofclear_dsvand return early when the result is0, before transitioning the resource or recording the clear.Testing
Added a synthetic D3D12 unit test (
list::tests::clear_dsv_skips_empty_masked_flags) verifying that:ClearDepthStencilViewwith0or console-only flags (0x4) records no clear or state transition and emits zero D3D12 debug layer errors (fails onmainwithInvalid ClearFlags value (0x0)underVICTORY_D3D12_DEBUG=1and records a non-empty list without the debug layer).1 | 0x4) clears aD32_FLOATtexture to0.25(verified via GPU readback), and subsequent empty-masked clears leave the cleared depth untouched.Verified on native D3D12 hardware and WARP (
VICTORY_D3D12_WARP=1) withVICTORY_D3D12_DEBUG=1and--features diagnostics,cargo clippy --workspace --all-targets --locked -- -D warnings(default and--all-features), andcargo test -p xtask --locked policy::tests::repository_passes_policy.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T10:26:51Z.
Review: APPROVED
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-gpu --lib list:: -- --test-threads=1: passed on RTX 5090 and WARP.cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 20/20 passed on RTX 5090 and WARP.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly ignores depth-stencil clears whose masked host clear flags are zero.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T23:02:11Z.
Windows 11,
63bcca4+ this PR, Radeon RX 7900 XTX:cargo test -p victory-gpu --lib: 232 passed / 0 failed / 1 ignored (unpatched63bcca4here: 231).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.clear_dsv_skips_empty_masked_flagspasses; the other clear tests are unchanged. Synthetic only. AI-assisted.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.