GPU: reject non-UAV and structured buffer views in ClearUnorderedAccessView #3173
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!3173
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3173"
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 11:00 UTC · original
fuzeofficlal:fix/gpu-clear-uav-validation→main· +319 −0 · 2 files · 1 commits · openSummary
State::clear_unorderedforwarded anyViewrecorded at the CPU descriptor handle directly toClearUnorderedAccessViewUint/ClearUnorderedAccessViewFloatwithout validating that it is a clearable UAV:View::Shader,View::Constant,View::Sampler,View::ConsoleSampler,View::Placed(false, ..)):make_at/make_viewconstruct SRV descriptors instead of UAVs and pass them toClearUnorderedAccessView*, crashing WARP withSTATUS_ACCESS_VIOLATION (0xc0000005)on a buffer SRV and triggering D3D12 debug layer error 646 (The CPU and GPU descriptor handles refer to unmatched descriptors) on a CBV.StructureByteStride > 0, regular or placed): D3D12 forbids clearing structured buffers with eitherClearUnorderedAccessViewUintorClearUnorderedAccessViewFloat, emitting D3D12 debug layer error 1156 (ClearUnorderedAccessView* methods are not compatible with Structured Buffers).Fix
descriptor::host::is_clearable_uav(view: &View) -> boolincrates/victory-gpu/src/descriptor/host.rs:View::UnorderedandView::Placed(true, ..).ViewDimension == D3D12_UAV_DIMENSION_BUFFERandStructureByteStride == 0.D3D12_UAV_DIMENSION_BUFFER.State::clear_unorderedincrates/victory-gpu/src/draw.rswithis_clearable_uav(&view)before allocating a dynamic slot or recording GPU work. All valid raw, typed buffer, placed raw buffer, and texture UAV clears continue to run unchanged.Verification
Added unit and real D3D12 GPU/WARP regression tests:
descriptor::host::tests::clearable_uav_rejects_non_uavs_and_structured_buffers: unit-tests allViewvariants and buffer/texture dimension combinations.draw::tests::clear_unordered_skips_invalid_views_and_clears_valid_ones: verifies that non-UAV views (buffer SRV, texture SRV, CBV, placed buffer SRV) and structured buffer UAVs (regular and placed, bothUintandFloat) allocate no dynamic slots, record no GPU work, and emit zero D3D12 debug errors, while valid raw buffer, typed uint/float buffer, placed raw buffer, and texture UAV clears execute on the GPU and write expected values back to title memory. Confirmed the test crashes WARP (0xc0000005) and triggers D3D12 debug errors 646 and 1156 onmain, and passes cleanly after the fix.Ran:
cargo test -p victory-gpu --lib --locked -- --test-threads=1(RTX 5090 default, RTX 5090--features diagnostics+VICTORY_D3D12_DEBUG=1, andVICTORY_D3D12_WARP=1+--features diagnostics+VICTORY_D3D12_DEBUG=1)cargo clippy --workspace --all-targets --locked -- -D warnings(default and--all-features)cargo test -p xtask --locked policy::tests::repository_passes_policy@Dukestar69 on GitHub · 2026-11-26 11:06 UTC · original · approved these changes
Verified on RTX 5090 & WARP against
origin/main(63bcca4):cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 21/21 passed on RTX 5090 and WARP (includingclear_unordered_skips_invalid_views_and_clears_valid_ones).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly rejects non-UAV and structured buffer views in
ClearUnorderedAccessViewwhile clearing valid views normally.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@oni-swr on GitHub · 2026-11-26 14:43 UTC · original
WARP verification of head
a9aa5353(base = current main63bcca4).Setup: Windows 11,
VICTORY_WARP=1+VICTORY_D3D12_WARP=1,--features diagnostics(software adapter only, no physical GPU), Windows SDKdxil.dll, synthetic tests only.cargo test -p victory-gpu --lib: 248 passed, 0 failed, 1 ignoreddescriptor::host::tests::clearable_uav_rejects_non_uavs_and_structured_buffersanddraw::tests::clear_unordered_skips_invalid_views_and_clears_valid_ones: both passdraw.rstest, no fix):clear_unordered_skips_invalid_views_and_clears_valid_onesfails. Thedescriptor/host.rstest calls the newis_clearable_uav, so it cannot be built on main without the fix.Verified with Claude Code (Claude Sonnet 5.5).
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.