GPU: reject non-UAV and structured buffer views in ClearUnorderedAccessView #3171
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T11:00:34Z.
Summary
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_policyImported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T11:06:58Z.
Review: APPROVED
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).
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T14:43:49Z.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.