fix(victory-gpu): collapse duplicate transition barriers per resource in a batch #290
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!290
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-290"
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?
@mauroalvare on GitHub · 2026-11-26 01:25 UTC · original
mauroalvare:fix/victory-barrier-dedup→main· +351 −13 · 1 files · 3 commits · openSummary
Fixes duplicate
D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCEStransition barriers emitted for the same host texture in a singleID3D12GraphicsCommandList::ResourceBarriercall inthird_party/victory/crates/victory-gpu/src/list.rs(barrier/host_barriers).Because
victory-gputracks whole-texture states (Subresource = 0xffffffff), a titleResourceBarrierbatch that transitions two different subresources of the same texture to different states (for example, mip 0RENDER_TARGET -> PIXEL_SHADER_RESOURCEand mip 1PIXEL_SHADER_RESOURCE -> UNORDERED_ACCESS, or two aliased title textures backed by the same host texture) previously emitted twoALL_SUBRESOURCEStransition barriers for the sameID3D12Resource*in oneResourceBarrier()call.In D3D12, referencing the same subresource (or
ALL_SUBRESOURCES) in more than one transition barrier within a singleResourceBarrier()call is invalid (D3D12_MESSAGE_ID_RESOURCE_BARRIER_DUPLICATE_SUBRESOURCE_TRANSITIONS#540) and causesID3D12GraphicsCommandList::Close()to fail under D3D12 validation (triggeringhost::fail).What changed
host_barriers(list, barriers)fromlist::barrierand collapsed multiple transition barriers targeting the same hostID3D12Resource*within a single batch into one transition from the batch's initialStateBeforeto its finalStateAfter.StateBefore == StateAfter):D3D12_RESOURCE_STATE_UNORDERED_ACCESS(0x8), replace it with a resource-scoped UAV barrier (unless a UAV barrier covering that resource is already in the batch) so earlier UAV writes remain ordered without emitting an invalidUAV -> UAVor duplicate transition barrier.list::testscovering same-texture multi-subresource transitions, UAV round-trips, non-UAV round-trips, interleaved multi-texture batches, and end-to-end GPU execution on RTX 5070 Ti and WARP.Reproduction and test results
Base commit:
c4c93bdc413191a9dc909998d2d53080a3f0c880(LooperSalty/AnyXboxX:main).Hardware: Windows x64, Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (driver
32.0.16.2140), Rust1.98.1.All tests are 100% synthetic (no game files). Note: Windows Graphics Tools (
d3d12SDKLayers.dll) is not installed on this machine, so validation checks both the exact barrier slice passed toResourceBarrierand end-to-end command-list execution on RTX 5070 Ti and WARP.Before fix (base
c4c93bdc+ test, RTX 5070 Ti)Result: FAILED:
assertion left == right failed: duplicate ALL_SUBRESOURCES transitions for the same texture must collapse to one barrier(left: 2,right: 1) — emitted twoALL_SUBRESOURCEStransitions (0x4 -> 0x80,0x80 -> 0x8) for the same host texture in a singleResourceBarriercall.After fix
cargo test --locked -p victory-gpu list::tests -- --test-threads=1VICTORY_D3D12_DEBUG=1 cargo test --locked -p victory-gpu --features diagnostics list::tests -- --test-threads=1diagnostics)VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test --locked -p victory-gpu --features diagnostics list::tests -- --test-threads=1diagnostics)cargo test --locked -p victory-loader --test load_probehle-probe)cargo xtask policy(inthird_party/victory)cargo clippy --locked -p victory-gpu --testslist.rsAI assistance
Developed and verified with AI assistance (Antigravity / Gemini 4 Neon). All code, synthetic tests, and local GPU/WARP runs were inspected and verified on this machine.
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.