GPU: avoid illegal COPY_SOURCE self-transition in Host::present #2543
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2545"
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 reeledMarek on 2026-11-25T15:33:50Z.
Problem
queue::presentandHost::present, if the presented texture was already inD3D12_RESOURCE_STATE_COPY_SOURCE(0x800),Host::presentemitted illegalCOPY_SOURCE -> COPY_SOURCEbefore/after resource barriers.queue::presentobtained an un-owned&'static ID3D12Resourceviahost_resource()and mutatedHostTexture::stateviahost_transition()outsideHost::submitted, racing with concurrent submissions and risking use-after-free if the resource was released during presentation.Fix
&Arc<HostTexture>fromqueue::present(viaresource::host_copy) intoHost::present.p.copy.move_texture(copy, COPY_SOURCE)sop.copy.prelude()swapscopy.stateatomically underHost::submittedand skips emitting any barrier whencopyis already inCOPY_SOURCE.resource::host_transitionwith#[cfg(all(windows, test))].Testing
move_texture_to_copy_source_skips_prelude_when_already_copy_sourceincrates/victory-gpu/src/host.rs.cargo test -p xtask --lockedpasses asset policy.Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-25T16:08:56Z.
Status check (2026-11-25, no game data):
gh pr view 2545 --json mergeable,mergeStateStatusreportsmergeable=CONFLICTING,mergeStateStatus=DIRTYagainstmain— this PR cannot merge as-is and needs a rebase. No formal review and no comments were present at check time. Other PRs checked in the same pass are not in that state: #2543 isMERGEABLE(status UNSTABLE, CI pending) and #2542 is transientUNKNOWN. Flagging only because the conflict is real, not because CI is red. AI-assisted (Hy4 flash); GPU/driver N/A (status check only); no game data.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T16:14:38Z.
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main:mainhas moved since the last triage, and the branch now conflicts incrates/victory-gpu/src/host.rsandcrates/victory-gpu/src/queue.rs. It will be reviewed again once it is rebased onto currentmain.Previous verdict for this head: merge candidate.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-25T20:05:28Z.
Updated to address the triage feedback and CI failure:
move_texture_to_copy_source_skips_prelude_when_already_copy_sourceinto its ownmod present_testswith proper imports and addedlist.close()beforelist.reset().present, the texture remains inCOPY_SOURCEwithcopy.stateupdated byp.copy's prelude (so later draws/copies transition cleanly fromCOPY_SOURCEwithout an extra barrier).p.copy.statesright afterself.execute(&[&p.copy])is safe becauseHost::executewaits for the submission fence to finish before returning.host_resourcereturning an owned clone.[PR #2545] GPU: avoid illegal COPY_SOURCE self-transition and keep HostTexture alive in Host::presentto [PR #2545] GPU: avoid illegal COPY_SOURCE self-transition in Host::presentImported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T05:49:47Z.
Closing as superseded by #1997 (
0736f8b):Host::presentnow skips theCOPY_SOURCE -> COPY_SOURCEself-transition andqueue.rskeeps ownedID3D12Resourcehandles alive acrosshost.present.Pull request closed