GPU/present: transition presented texture via HostList prelude under submitted lock #564
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/564"
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 fxceless/victory-fork. Originally posted by AscilCH on 2026-11-25T02:17:18Z.
Problem
Two bugs in the presentation state-tracking path across
crates/victory-gpu/src/queue.rsandcrates/victory-gpu/src/host.rs:COPY_SOURCE -> COPY_SOURCED3D12 barriers: When the presented texture was already inD3D12_RESOURCE_STATE_COPY_SOURCE(0x800),resource::host_transition(resource, COPY_SOURCE)returnedNone, defaultingstate = COPY_SOURCE.Host::present()then unconditionally recorded twoCOPY_SOURCE -> COPY_SOURCEbarriers (StateBefore == StateAfter, violating D3D12 barrier rules).HostTexture::staterace:queue.rsmutatedHostTexture::statetoCOPY_SOURCEbeforeHost::present()acquiredhost.submitted, and unconditionally swapped it back afterwards. A concurrentHost::submit()runninglist.prelude()in that window saw the bogusCOPY_SOURCEstate, emitted a mismatched barrier, and then had its resultingHostTexture::stateclobbered byqueue.rs. (Passing&ID3D12Resourceinstead ofArc<HostTexture>also did not retain the texture on asynclate_free_presentcopy lists.)Fix
Arc<HostTexture>(resource::host_copy) intoHost::present()and remove the unlockedhost_transitionswaps fromqueue.rs(scopingresource::host_transitionto#[cfg(all(windows, test))]).copy.settle(texture, D3D12_RESOURCE_STATE_COPY_SOURCE.0 as u32)on the present copy list socopy.prelude()transitionstexturefrom its true state toCOPY_SOURCEatomically underself.submitted, skips the barrier completely when already inCOPY_SOURCE, and retainsArc<HostTexture>untilcopy.reset().present_settle_skips_redundant_copy_source_barrier_and_tracks_state_at_prelude.Verification
cargo test -p victory-gpu --locked host::batch -- --test-threads=1: 5 passed, 0 failed (1 pre-existing ignored benchmark)cargo test -p victory-gpu --locked queue::tests -- --test-threads=1: 4 passed, 0 failedcargo xtask policy: 169 files okcargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings: clean (default-features build onc96b4f2has only the pre-existingdead_codewarning onplaced_filler_twins, tracked in #491)(AI-assisted; synthetic unit tests only, no game data.)
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.