GPU: a partial refresh of an armed page leaves its saved bytes stale, so marked copy-back undoes title writes #2375
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#2375
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@BastienRodz on GitHub · 2026-11-25 12:15 UTC · original
What happens
Since
cd94d35, a range a list declares as written through marked views arms its 64 KiB pages (Shadow::writing(.., marked = true)→Tracked::arm). The title's first write to an armed page saves the page's bytes from before it (Changed::save), and after the submissionShadow::copy_back_markedtakes what differs from those saved bytes as the shaders' writes.If a refresh in the same submission copies only part of that page into the host copy (
Shadow::update_busyunder a range shaders write, orupdate_freebeside a sub-page one),Tracked::takeleaves the page changed and its saved bytes untouched.update_busyupdates only the snapshots of unmarked ranges (Shadow::before). The copy now holds the title's newer bytes there, but the saved bytes still hold the older ones, so copy-back:A synthetic run shows both. Title bytes
0x55/0x44written after arming and refreshed, then the title writes0x66and a shader writes0x00: copy-back leaves0x55and0x44.Expected
copy_back_marked's own description: "What they changed is what differs from the copy's bytes before the submission".update_busykeeps that for unmarked ranges: "The same bytes go into the snapshotwritingtook, so copy-back neither takes them for the GPU's nor puts them back over a later title write." Saved bytes of armed pages should follow a partial refresh the same way.Where
crates/victory-gpu/src/shadow.rs(Shadow::copy,update_busy,copy_back_marked) andcrates/victory-gpu/src/watch.rs(Tracked,Saved). Introduced bycd94d35. #2172 (whole-page refreshes for marked views) avoids the partial refresh for marked view ranges but not for a refresh of another range in the same page.AI-assisted (Gemini 4 Neon found it, Claude Code reviewed and verified it); synthetic test only, no game data.
@shawshanker18 on GitHub · 2026-11-25 16:41 UTC · original
Tested #2377 on
main(67e8ae1), on Windows 11 with an RTX 4050 Laptop. Command:cargo test -p victory-gpu --lib.partial_refresh_under_marked_range_updates_saved_bytespasses.main's 2 (NVIDIA view-heap cap).It conflicts with #2437 (#2436) and #2434: all three change
copy_back_marked. See the order suggested on #2436.@Marvisak on GitHub · 2026-11-25 18:49 UTC · original
Automated triage for the maintainers.
Confirmed in main. In
crates/victory-gpu/src/shadow.rs,Shadow::update_busycopies the runsTracked::takereturns. It then writes the new bytes only into the unmarked snapshots inself.before. The bytesTrackedsaved for an armed page (read back throught.saved(..)inShadow::copy_back_marked) are left as they were.copy_back_markedthen treats bytes that differ from those saved bytes as the shaders' writes, so a partial refresh of an armed page produces the effects described here.Open PR #2377 updates the saved bytes. It was tested on current main in the comment above. It conflicts with #2434 and #2437, which also change
copy_back_marked, so the merge order matters.Generated by Claude Code