Repository navigation
fix(gpu): preserve newer game writes after marked page copy-back - #437
Merged
pragyaangaur merged 1 commit intoNov 27, 2026
Merged
pragyaangaur merged 1 commit into
pragyaangaur merged 1 commit into
Conversation
Port the fix from BastienRodz in Marvisak/VIctory#2437 (60d81cfb). Advance snapshots of marked pages after merging them in the Mac batched path. The old declared pass restored three stale bytes in a clipped three-page D3DMetal regression. Co-authored-by: BastienRdz <58186763+BastienRodz@users.noreply.github.com>
This was referenced Nov 26, 2026
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.
The game and the GPU can write different bytes of the same buffer during a submission. The Mac port first copies back the pages that shaders marked, then checks its saved copy for any overlapping declared write ranges. The second pass still compares against the bytes from before the first. It can mistake the values the first pass published for another GPU write, and restore them over a newer CPU write.
This is the macOS port of the fix identified by @BastienRodz in Marvisak/VIctory#2436 and #2437 (
60d81cfb). The Mac implementation batches marked pages. It now advances existing snapshots over each page it merged, including a page with only a CPU change. It skips pages it could not read or did not merge, keeps the batched writes and handles partial first/last pages.Reproduced on an M5 Pro
The regression uses one D3D12 buffer across three 64 KiB pages, with its first and last pages clipped. It marks those two pages, leaves the middle one for the declared pass, and changes three game-side bytes between the two passes. The previous shader write, the game-only change and the still-unpublished middle-page shader write are checked independently.
33 44 B2 55bf99e728+ test onlyA1 11 B2 22— three stale bytes33 44 B2 55— all four matchOn the fixed path the marked batch writes 65,520 bytes (the clipped first page); the declared pass writes 65,536 bytes (only the middle page). The CPU-only last page does not trigger a redundant write. This is a buffer correctness result; it does not establish the cause of a particular in-game visual defect or crash.
The focused release test under Wine/D3DMetal is
shadow::tests::declared_writeback_preserves_title_writes_after_marked_pages. Both paths were exercised on an M5 Pro / 48 GB, macOS 27.2.1, Wine 11.0 and D3DMetal 4.0b3. This change is independent of the capture-time optimization in #436.Checks on macOS
bf99e728and the PRshadow::: 33 passed, 0 failed, 3 ignored on this branch.shadow::suite passed 35/0/4, including both PRs’ regressions. The mapped capture benchmark then passed explicitly.git diff --checkpassed.cargo fmt --all -- --checkreports the same 81 existing files on main and head; no unrelated formatting changes included.Prepared and tested with GPT-6.2 Astra. Only synthetic test bytes and Rust source are included.