GPU/host: track deferred read-backs in late line.written and copy via write_mapped #565
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!565
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-565"
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?
@AscilCH on GitHub · 2026-11-25 02:17 UTC · original
AscilCH:fix/gpu-readback-late-written-and-safe-write→main· +131 −6 · 1 files · 1 commits · openProblem
Two bugs in texture-to-buffer read-back handling (
HostList::defer_read_back/read_backs()) incrates/victory-gpu/src/host.rs:line.writtendependency tracking in late/relay mode:execute_late(),execute_own(), andrelay_land()populatedline.writtensolely fromsent.back/flight.back(Step::GpuWrite), omitting ranges written bylist.deferred().backs(CopyTextureRegiontexture-to-buffer read-backs). A subsequent submission or wait reading the destination title buffer before the read-back landed missedlate_blocked()/late_met()and read stale bytes.read_backs():Shadow::copy_back()(which opens write-watch guards withwatch::writingand copies viawrite_mapped),read_backs()wrote directly into title memory usingstd::ptr::copy_nonoverlapping. If the title unmapped/freed the destination buffer while the flight was in flight (or if pages were write-guarded),read_backs()triggered an unhandled access violation.Fix
read_back_span()andread_back_ranges()helpers and storeread_backs: Vec<(usize, usize)>onSentandFlight, merging them intoline.writteninexecute_late(),execute_own(), andrelay_land().read_backs()to callcrate::watch::writing(...)and copy each row throughwrite_mapped(...)with checked row offsets.read_backs_tracks_spans_copies_mapped_rows_and_skips_unmapped_memory.Verification
cargo test -p victory-gpu --locked host::batch -- --test-threads=1: 5 passed, 0 failed (1 pre-existing ignored benchmark)cargo 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
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.