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

Open
github-bot wants to merge 1 commit from github-bot/gh-206 into main AGit
Owner

@⁠AscilCH on GitHub · 2026-11-24 22:33 UTC · original
AscilCH:fix/shadow-uncopied-pages-under-writes → main · +64 −22 · 1 files · 1 commits · open

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.)

**@⁠AscilCH** on GitHub · 2026-11-24 22:33 UTC · [original](https://github.com/fxceless/victory-fork/pull/206) `AscilCH:fix/shadow-uncopied-pages-under-writes` → `main` · +64 −22 · 1 files · 1 commits · open ## 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.)*
Under `VICTORY_LATE_WAIT` and `VICTORY_RELAY`, `Shadow::stale_under_writes`
and `Shadow::merge_under_writes` (`crates/victory-gpu/src/shadow.rs`) only
iterated pages returned by the write-watch delta (`written`). Any page inside
a pending shader `GpuWrite` range whose `copied` timestamp was still `0`
(never copied into the host copy yet) and that did not appear in `written`
was silently skipped, leaving it zeroed on the GPU while `Shadow::update`
also skipped the pending range.

Mirror `Shadow::copy_stale` by extracting `stale_pages_in` and scanning every
page in `[a, e)` for `copied == 0 || write > copied` in both
`stale_under_writes` and `merge_under_writes`. Add
`shadow::relay_tests::stale_pages_include_uncopied_pages_absent_from_write_watch`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:38:17 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/shadow.rs
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.
git fetch -u origin '+refs/pull/206/head:github-bot/gh-206'
git switch 'github-bot/gh-206'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-206'
git switch 'github-bot/gh-206'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-206'
git switch 'github-bot/gh-206'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-206'
git switch 'main'
git merge --squash 'github-bot/gh-206'
git switch 'main'
git merge --ff-only 'github-bot/gh-206'
git switch 'main'
git merge 'github-bot/gh-206'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.