GPU/host: track deferred read-backs in late line.written and copy via write_mapped #565
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from fxceless/victory-fork. Originally posted by AscilCH on 2026-11-25T02:17:20Z.
Problem
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
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.