GPU: include uncopied pages in Shadow stale/merge under pending writes (#168, #89) #206

Open
AscilCH wants to merge 1 commit from upstream-pr/206 into main
AscilCH commented 2026-11-24 22:33:51 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by AscilCH on 2026-11-24T22:33:51Z.


Problem

Related to #168 (VICTORY_LATE_WAIT=3 / VICTORY_RELAY=2 missing geometry) and #89 (VICTORY_RELAY=2 artifacts). Complementary to #191 (which only touches host.rs).

In crates/victory-gpu/src/shadow.rs:

  • Shadow::copy_stale (default synchronous path) scans every page in [from, to) and copies any page where copied[page - base] == 0 || write > copied[page - base].
  • Shadow::stale_under_writes and Shadow::merge_under_writes (used under VICTORY_LATE_WAIT and VICTORY_RELAY) only iterated the write-watch delta written. Any page inside an in-flight GpuWrite range that had never been copied yet (copied == 0) and did not appear in written was silently skipped, leaving those bytes zeroed in the host copy while Shadow::update also skipped the pending range.

Fix

  • Extract stale_pages_in(base, copied, a, e, written) in crates/victory-gpu/src/shadow.rs to scan every page in a / PAGE..=(e - 1) / PAGE and return pages with copied == 0 || write > copied, matching copy_stale.
  • Use stale_pages_in in both Shadow::stale_under_writes and Shadow::merge_under_writes.
  • Add shadow::relay_tests::stale_pages_include_uncopied_pages_absent_from_write_watch.

Verification

  • rustfmt --edition 2024 --check crates/victory-gpu/src/shadow.rs (changed hunks): clean
  • cargo test -p victory-gpu --locked -- --test-threads=1: 111 passed, 0 failed
  • cargo xtask policy: 169 files ok
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean
  • cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings: clean

(AI-assisted; synthetic unit test only, no game data.)

<!-- greyfinch-sync:fxceless/victory-fork:issue:6592757068 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/206). Originally posted by [AscilCH](https://github.com/AscilCH) on 2026-11-24T22:33:51Z. --- ## Problem Related to #168 (`VICTORY_LATE_WAIT=3` / `VICTORY_RELAY=2` missing geometry) and #89 (`VICTORY_RELAY=2` artifacts). Complementary to #191 (which only touches `host.rs`). In `crates/victory-gpu/src/shadow.rs`: - `Shadow::copy_stale` (default synchronous path) scans every page in `[from, to)` and copies any page where `copied[page - base] == 0 || write > copied[page - base]`. - `Shadow::stale_under_writes` and `Shadow::merge_under_writes` (used under `VICTORY_LATE_WAIT` and `VICTORY_RELAY`) only iterated the write-watch delta `written`. Any page inside an in-flight `GpuWrite` range that had never been copied yet (`copied == 0`) and did not appear in `written` was silently skipped, leaving those bytes zeroed in the host copy while `Shadow::update` also skipped the pending range. ## Fix - Extract `stale_pages_in(base, copied, a, e, written)` in `crates/victory-gpu/src/shadow.rs` to scan every page in `a / PAGE..=(e - 1) / PAGE` and return pages with `copied == 0 || write > copied`, matching `copy_stale`. - Use `stale_pages_in` in both `Shadow::stale_under_writes` and `Shadow::merge_under_writes`. - Add `shadow::relay_tests::stale_pages_include_uncopied_pages_absent_from_write_watch`. ## Verification - `rustfmt --edition 2024 --check crates/victory-gpu/src/shadow.rs` (changed hunks): clean - `cargo test -p victory-gpu --locked -- --test-threads=1`: 111 passed, 0 failed - `cargo xtask policy`: 169 files ok - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: clean - `cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings`: clean *(AI-assisted; synthetic unit test only, no game data.)*
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/206:upstream-pr/206'
git switch 'upstream-pr/206'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/206'
git switch 'upstream-pr/206'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/206'
git switch 'upstream-pr/206'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/206'
git switch 'main'
git merge --squash 'upstream-pr/206'
git switch 'main'
git merge --ff-only 'upstream-pr/206'
git switch 'main'
git merge 'upstream-pr/206'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!206
No description provided.