Repository navigation
Conversation
… write_mapped - Compute title memory spans for deferred texture-to-buffer read-backs (`HostList::defer_read_back`) via `read_back_span` / `read_back_ranges` and include them in `Sent::read_backs`, `Flight::read_backs`, and `line.written` in `execute_late()`, `execute_own()`, and `relay_land()`. Previously, late and relay submissions reading a buffer populated by an in-flight texture read-back missed the dependency and read stale data. - Replace raw `ptr::copy_nonoverlapping` in `read_backs()` with `watch::writing(...)` + `write_mapped(...)` so pages unmapped or write-guarded while a flight is in flight are handled safely without an unhandled AV. - Add synthetic unit tests covering `read_back_span`, `read_back_ranges`, and `read_backs()` writing to both live memory and an unmapped (`VirtualFree`) address.
triippywhale
pushed a commit
to triippywhale/victory-fork
that referenced
this pull request
Nov 25, 2026
Port of PalmVIDev 2ef001c8 (from fxceless#565, AscilCH). Read-backs into title memory (HostList::defer_read_back) copied with a raw copy_nonoverlapping after the list ran; a page unmapped or guarded while the list flew faulted. They now tell the watch (watch::writing over the rows' span) and copy each row through write_mapped, with checked row addresses, and skip empty rows. Adapted to this tree's read_backs, which keeps its walls trace after the copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017V7WBA8CxPD68KngjiMeJb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 GPU: keep clippy green without the diagnostics feature #491)(AI-assisted; synthetic unit tests only, no game data.)