GPU: preserve title dirty marks after equal marked-page reads #3850
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3850"
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 Marvisak/VIctory. Originally posted by lhnizdo on 2026-11-29T16:33:07Z.
A marked page can compare equal with its title snapshot while a title thread dirties the page immediately afterward. Calling
Tracked::takenin that case clears the new dirty mark, so the nextShadow::updatecan leave the title byte stale in the host copy.Return before acknowledging the page when the comparison calls for no write. A deterministic fixture writes a byte just after the marked page is read and checks that the next refresh picks it up. Against main the refresh copied zero bytes. With the fix it copied the page and the byte matched. The focused shadow suite passed all 10 tests.
Focused validation also passed the asset policy hook and victory-gpu Clippy with all targets and features.
Imported from Marvisak/VIctory. Originally posted by AurumCarlos on 2026-11-29T20:28:16Z.
Review: COMMENTED
The equal case is fixed, but the same title write is still lost when the copy-back does write: that path has the same window and one more way to lose it.
shadow.rs:538-546: after the read,write_mappedwrites allnbytes. That ishostwhen nothing was saved, or the mergedtitlebuffer. Both hold the title's bytes as read, so a title write that lands afterread_intois overwritten with the stale byte.t.takenthen clears the page's mark, so the nextupdatecopies nothing and the copy keeps the stale byte too.Repro, your fixture plus one shader change elsewhere in the page so
writtenisSome. Onbffa7b8it fails withleft: 0, right: 187; the 11 othershadow::tests pass (Wine, MSVC target):Fix: write only the bytes the shaders changed, and leave the page marked as you do for the equal case. With this, all 12
shadow::tests pass, yours andmarked_pages_go_back_by_the_bytes_the_gpu_changedincluded:The cost is one page refresh after each marked copy-back. A byte that both the title and a shader wrote is still the shaders', as before.
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-29T23:00:51Z.
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
bffa7b89e1ef62eb27cb950e1e66d265e7211b08, base/parent63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-gpu --lib -- shadow::tests::equal_marked_page_keeps_a_title_write_after_the_read --exact --test-threads=1 --quiet→ 1 passed, 0 failed, 232 filtered, exit 0.git grep -Ffor the test name on the base returned no match (test is new on this PR);git diff --check 63bcca4 HEADclean (1 file, +34/-2).CARGO_TARGET_DIR(never shared) withCARGO_BUILD_JOBS=2.AI-assisted (Hy4 flash).
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.