HLE xmem: avoid recommitting pages when mapping GPU aliases #808

Open
Chezzuss wants to merge 1 commit from upstream-pr/809 into main
Chezzuss commented 2026-11-25 08:27:41 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Chezzuss on 2026-11-25T08:27:41Z.


What

When copying GPU page mappings, map_alias finds the source in a live physical view. Mapping another view of the same section page can use its existing commitment, so the alias path skips the redundant VirtualAlloc(MEM_COMMIT). The initial mapping and the existing partial-unmap restoration path still commit as before.

Tested

Windows 11 x64, build 26340. All 12 XMem tests passed with cargo test --locked --profile diag -p victory-hle modules::xmem::tests -- --test-threads=1. The regression test checks the commit call count, the alias's MEM_COMMIT state, and writes shared through both views. This branch was tested with synthetic data. Its effect on frame rate has not been isolated.

AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6600348556 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/809). Originally posted by [Chezzuss](https://github.com/Chezzuss) on 2026-11-25T08:27:41Z. --- ## What When copying GPU page mappings, `map_alias` finds the source in a live physical view. Mapping another view of the same section page can use its existing commitment, so the alias path skips the redundant `VirtualAlloc(MEM_COMMIT)`. The initial mapping and the existing partial-unmap restoration path still commit as before. ## Tested Windows 11 x64, build 26340. All 12 XMem tests passed with `cargo test --locked --profile diag -p victory-hle modules::xmem::tests -- --test-threads=1`. The regression test checks the commit call count, the alias's `MEM_COMMIT` state, and writes shared through both views. This branch was tested with synthetic data. Its effect on frame rate has not been isolated. AI-assisted.
MamaLeVrai commented 2026-11-25 10:11:15 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by MamaLeVrai on 2026-11-25T09:54:05Z.


Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head e40ef63 into main 9376fd6 in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails, with the same two errors as main itself on this machine (function placed_filler_twins is never used, field depth_written is never read, victory-gpu): this PR adds none and removes none. cargo test --workspace --locked: 540 passed, 0 failed, 10 ignored, two runs (main alone: 540 passed). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7158952482 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/809#issuecomment-7158952482). Originally posted by [MamaLeVrai](https://github.com/MamaLeVrai) on 2026-11-25T09:54:05Z. --- Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head `e40ef63` into `main` `9376fd6` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings` fails, with the same two errors as `main` itself on this machine (`function placed_filler_twins is never used`, `field depth_written is never read`, `victory-gpu`): this PR adds none and removes none. `cargo test --workspace --locked`: 540 passed, 0 failed, 10 ignored, two runs (`main` alone: 540 passed). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/809:upstream-pr/809'
git switch 'upstream-pr/809'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/809'
git switch 'upstream-pr/809'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/809'
git switch 'upstream-pr/809'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/809'
git switch 'main'
git merge --squash 'upstream-pr/809'
git switch 'main'
git merge --ff-only 'upstream-pr/809'
git switch 'main'
git merge 'upstream-pr/809'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!808
No description provided.