xmem: tell the GPU side of an unmapped view after unmapping it, not before #1005

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

@⁠SpaghettiMaster545 on GitHub · 2026-11-25 15:40 UTC · original
SpaghettiMaster545:pr/unmap-then-tell → main · +3 −1 · 1 files · 1 commits · open

What was wrong

xmem::unmap told victory_gpu that a view's memory had changed (title_memory_remapped) before it unmapped the view. A GPU copy refreshing that range in between could guard the blocks that were still mapped and note them clean. Once the view was gone they stayed clean, so copies kept the view's old bytes until something was mapped there again.

How it shows in game

Buffers and textures in physical-page memory that the title unmaps and later reads (zeros, or whatever it maps there next) can keep showing their old contents on the card.

What the change does

The GPU side is told once the view is unmapped. That clears the stale guard state, and the next refresh takes the memory as it now is: its blocks known unmapped, their zeros copied once. The shown bookkeeping is unchanged.

How it was tested

  • cargo test --locked -p victory-hle --lib passes (98 passed). cargo clippy -p victory-hle --no-deps --all-targets --locked -- -D warnings is clean. Without --no-deps, clippy stops on the errors main already has in victory-gpu.
  • Played with this change in our integration branch.
  • GPU and driver: NVIDIA GeForce RTX 5070 Ti, driver 621.40, Windows 11.

Developed with AI assistance (Claude Code).

**@⁠SpaghettiMaster545** on GitHub · 2026-11-25 15:40 UTC · [original](https://github.com/fxceless/victory-fork/pull/1005) `SpaghettiMaster545:pr/unmap-then-tell` → `main` · +3 −1 · 1 files · 1 commits · open ## What was wrong `xmem::unmap` told `victory_gpu` that a view's memory had changed (`title_memory_remapped`) before it unmapped the view. A GPU copy refreshing that range in between could guard the blocks that were still mapped and note them clean. Once the view was gone they stayed clean, so copies kept the view's old bytes until something was mapped there again. ## How it shows in game Buffers and textures in physical-page memory that the title unmaps and later reads (zeros, or whatever it maps there next) can keep showing their old contents on the card. ## What the change does The GPU side is told once the view is unmapped. That clears the stale guard state, and the next refresh takes the memory as it now is: its blocks known unmapped, their zeros copied once. The `shown` bookkeeping is unchanged. ## How it was tested - `cargo test --locked -p victory-hle --lib` passes (98 passed). `cargo clippy -p victory-hle --no-deps --all-targets --locked -- -D warnings` is clean. Without `--no-deps`, clippy stops on the errors `main` already has in `victory-gpu`. - Played with this change in our integration branch. - GPU and driver: NVIDIA GeForce RTX 5070 Ti, driver 621.40, Windows 11. Developed with AI assistance (Claude Code).
unmap() told victory_gpu that a view's memory changed before it unmapped
the view. A GPU copy refreshing the range in between could guard the
still-mapped blocks and note them clean; once unmapped they stayed clean,
so copies kept the view's old bytes until something was mapped there
again. Telling after the unmap clears that state, and the next refresh
takes the memory as it now is (its blocks known unmapped, their zeros
copied once).

(cherry picked from commit 97a5900d)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:55:41 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-hle/src/modules/xmem.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/1005/head:github-bot/gh-1005'
git switch 'github-bot/gh-1005'

Merge

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