GPU: copy-back reads into scratch sized to the changed stretch, not a zeroed 64 KiB per range #240

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

@⁠fffluffy-dev on GitHub · 2026-11-24 22:58 UTC · original
fffluffy-dev:gpu/copy-back-scratch → main · +107 −33 · 1 files · 1 commits · open

Shadow::copy_back_with allocated and zeroed a 64 KiB scratch (vec![0u8; PIECE]) on every call, once per joined span, though it only reads the stretch from the first to the last changed byte of each differing piece. The merge moves into back_piece unchanged; the scratch now starts empty and is sized to each stretch, as card_merge already does.

Same bytes compared, read and written back as before; only the scratch changes. Every scratch byte used is first filled by read_into for exactly that stretch, and a failed read returns before the merge, as before.

Model of one submission (8 MiB copy, overlapping and repeated ranges): scratch bytes zeroed 40,763,392 (622 allocations) → 10,912 (171); bytes compared, pieces and bytes written back unchanged. Marvisak/VIctory#1656 found the same allocation before upstream redesigned Shadow.

Validation (cargo-xwin, tests under Wine): cargo test -p victory-gpu 111 passed, 1 ignored, new test a_piece_put_back_reads_only_its_stretch; clippy clean both ways; policy ok. On a real frame: "copying back" ms should fall at the same MB.

AI use: written with Claude Code (Claude Opus 5.5); reviewed and posted with my approval. No game files were used.

**@⁠fffluffy-dev** on GitHub · 2026-11-24 22:58 UTC · [original](https://github.com/fxceless/victory-fork/pull/240) `fffluffy-dev:gpu/copy-back-scratch` → `main` · +107 −33 · 1 files · 1 commits · open `Shadow::copy_back_with` allocated and zeroed a 64 KiB scratch (`vec![0u8; PIECE]`) on every call, once per joined span, though it only reads the stretch from the first to the last changed byte of each differing piece. The merge moves into `back_piece` unchanged; the scratch now starts empty and is sized to each stretch, as `card_merge` already does. Same bytes compared, read and written back as before; only the scratch changes. Every scratch byte used is first filled by `read_into` for exactly that stretch, and a failed read returns before the merge, as before. Model of one submission (8 MiB copy, overlapping and repeated ranges): scratch bytes zeroed 40,763,392 (622 allocations) → 10,912 (171); bytes compared, pieces and bytes written back unchanged. Marvisak/VIctory#1656 found the same allocation before upstream redesigned `Shadow`. Validation (cargo-xwin, tests under Wine): `cargo test -p victory-gpu` 111 passed, 1 ignored, new test `a_piece_put_back_reads_only_its_stretch`; clippy clean both ways; policy ok. On a real frame: "copying back" ms should fall at the same MB. **AI use:** written with Claude Code (Claude Opus 5.5); reviewed and posted with my approval. No game files were used.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:39:10 +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/240/head:github-bot/gh-240'
git switch 'github-bot/gh-240'

Merge

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