GPU: avoid illegal COPY_SOURCE self-transition in Host::present #2545
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!2545
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@reeledMarek on GitHub · 2026-11-25 15:33 UTC · original
reeledMarek:fix/gpu-present-copy-source-and-lifetime→main· +101 −30 · 3 files · 1 commits · closed without mergingProblem
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.@cloph-dsp on GitHub · 2026-11-25 16:08 UTC · original
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.@Marvisak on GitHub · 2026-11-25 16:14 UTC · original · edited 2026-11-25 22:16 UTC
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
@reeledMarek on GitHub · 2026-11-25 20:05 UTC · original
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.@reeledMarek on GitHub · 2026-11-26 05:49 UTC · original
Closing as superseded by #1997 (
0736f8b):Host::presentnow skips theCOPY_SOURCE -> COPY_SOURCEself-transition andqueue.rskeeps ownedID3D12Resourcehandles alive acrosshost.present.Pull request closed