GPU: ignore depth-stencil clears whose host flags mask to zero #3150
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!3150
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@fuzeofficlal on GitHub · 2026-11-26 10:24 UTC · original
fuzeofficlal:fix/gpu-clear-dsv-empty-flags→main· +178 −1 · 1 files · 1 commits · openSummary
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.@Dukestar69 on GitHub · 2026-11-26 10:26 UTC · original · approved these changes
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).
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.