Under Wine, title memory is copied, not used in place #53

Open
ntgata1-dotcom wants to merge 1 commit from upstream-pr/53 into main
ntgata1-dotcom commented 2026-11-25 13:10:12 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by ntgata1-dotcom on 2026-11-25T13:10:12Z.


Under Wine and Proton, every frame has been black from the first one since 440589e ("GPU: title memory used in place by the host GPU"); see #19. sil-kong bisected it there, and I got the same commit in a separate bisect.

Change

One function, direct() in crates/victory-gpu/src/shadow.rs:

  • Under Wine, title memory is copied by default, as with VICTORY_COPY_MEMORY. Wine is detected the way victory-hle's xmem::on_wine does it: ntdll exports wine_get_version.
  • Under Wine, VICTORY_COPY_MEMORY=0 keeps title memory in place, to try a vkd3d-proton where that works.
  • On Windows nothing changes.
  • The log line says which: title memory used in place by the host GPU on=false wine=true.
VICTORY_COPY_MEMORY Windows Wine
not set in place (as before) copied
0 copied (as before) in place
any other value copied (as before) copied

Tested

Linux: RX 9070 XT (RDNA4), RADV / Mesa 26.3.1, system Wine 11.22, vkd3d-proton v3.1-83-gcae8353ed and DXVK dxgi from GE-Proton11-14. Diagnostics build for x86_64-pc-windows-msvc with cargo-xwin. First-boot screens, no input, 75 s per run, judged from VICTORY_CAPTURE frames:

Build Frame GPU time per frame
8e79c80 (upstream base) renders
71652a2 black (every pixel 0)
this branch, not set renders, frame-2048.png byte-identical to 8e79c80's 0.6 ms
this branch, VICTORY_COPY_MEMORY=0 black 12.1 ms
this branch, VICTORY_COPY_MEMORY=1 renders, byte-identical 0.6–0.7 ms
  • cargo xwin clippy -p victory-gpu --all-targets: the same 58 warning lines as on main, none in the changed code.
  • cargo xtask policy --staged: ok. The full check stops at lower.rs's size, as the README says.
  • Not run on Windows. There on_wine() is false, so both branches of the switch behave as before.
  • Not tested past the first-boot screens.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:6605237386 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/53). Originally posted by [ntgata1-dotcom](https://github.com/ntgata1-dotcom) on 2026-11-25T13:10:12Z. --- Under Wine and Proton, every frame has been black from the first one since `440589e` ("GPU: title memory used in place by the host GPU"); see #19. sil-kong bisected it there, and I got the same commit in a separate bisect. ## Change One function, `direct()` in `crates/victory-gpu/src/shadow.rs`: - Under Wine, title memory is copied by default, as with `VICTORY_COPY_MEMORY`. Wine is detected the way `victory-hle`'s `xmem::on_wine` does it: ntdll exports `wine_get_version`. - Under Wine, `VICTORY_COPY_MEMORY=0` keeps title memory in place, to try a vkd3d-proton where that works. - On Windows nothing changes. - The log line says which: `title memory used in place by the host GPU on=false wine=true`. | `VICTORY_COPY_MEMORY` | Windows | Wine | |---|---|---| | not set | in place (as before) | **copied** | | `0` | copied (as before) | in place | | any other value | copied (as before) | copied | ## Tested Linux: RX 9070 XT (RDNA4), RADV / Mesa 26.3.1, system Wine 11.22, vkd3d-proton `v3.1-83-gcae8353ed` and DXVK `dxgi` from GE-Proton11-14. Diagnostics build for `x86_64-pc-windows-msvc` with cargo-xwin. First-boot screens, no input, 75 s per run, judged from `VICTORY_CAPTURE` frames: | Build | Frame | GPU time per frame | |---|---|---| | `8e79c80` (upstream base) | renders | | | `71652a2` | black (every pixel 0) | | | this branch, not set | renders, `frame-2048.png` byte-identical to `8e79c80`'s | 0.6 ms | | this branch, `VICTORY_COPY_MEMORY=0` | black | 12.1 ms | | this branch, `VICTORY_COPY_MEMORY=1` | renders, byte-identical | 0.6–0.7 ms | - `cargo xwin clippy -p victory-gpu --all-targets`: the same 58 warning lines as on `main`, none in the changed code. - `cargo xtask policy --staged`: ok. The full check stops at `lower.rs`'s size, as the README says. - Not run on Windows. There `on_wine()` is false, so both branches of the switch behave as before. - Not tested past the first-boot screens. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gut0to commented 2026-11-25 16:23:18 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by gut0to on 2026-11-25T16:23:18Z.

Review: COMMENTED


AI-assisted static review; I did not run tests or launch the game. Wine is detected with wine_get_version; title memory is copied by default under Wine, while VICTORY_COPY_MEMORY=0 preserves the in-place test path. The PR reports capture comparisons for unset, 0, and 1, plus cargo xwin clippy and cargo xtask policy --staged. I did not run those checks or the game here.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:review:6061089724 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/53#pullrequestreview-6061089724). Originally posted by [gut0to](https://github.com/gut0to) on 2026-11-25T16:23:18Z. **Review:** COMMENTED --- AI-assisted static review; I did not run tests or launch the game. Wine is detected with wine_get_version; title memory is copied by default under Wine, while VICTORY_COPY_MEMORY=0 preserves the in-place test path. The PR reports capture comparisons for unset, 0, and 1, plus cargo xwin clippy and cargo xtask policy --staged. I did not run those checks or the game here.
TobiasFornell commented 2026-11-25 21:32:55 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by TobiasFornell on 2026-11-25T21:32:55Z.


Confirming this fix in-world on Linux (CachyOS, RX 9070 XT RDNA4, RADV, Proton Experimental, offline, x86_64-pc-windows-msvc diagnostics build, Series S mode, 480 s runs).

Measured in-world A/B (same build, VICTORY_COPY_MEMORY=1 only, with the 4 KiB tile-base fix from #100 applied):

  • In-place heaps (OpenExistingHeapFromAddress1, ~2.5 GiB in L0/GTT over PCIe on RADV): median 9,537 ms/frame, GPU median 8,867 ms/frame (even though D3D12 command timestamps in a separate timing run summed to only 33.9–48.1 ms/frame).
  • Copy mode under Wine (VICTORY_COPY_MEMORY=1, n=47 world frames): median 1,954 ms/frame (-79.5%), GPU median 148 ms/frame (-98.3%), 0 kernel GPU page faults, and visible 3D world rendering (time_to_world dropped from 215.3 s to 144.9 s).

One companion note for Wine/vkd3d-proton once copy mode is on: if sparse copies remain enabled, Shadow::sparse_writing hits 0xc0000005 on world entry because vkd3d-proton's Map() is only 4 KiB-aligned — that is fixed by #100 (or avoided by #69).

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:comment:7175223525 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/53#issuecomment-7175223525). Originally posted by [TobiasFornell](https://github.com/TobiasFornell) on 2026-11-25T21:32:55Z. --- Confirming this fix **in-world** on Linux (CachyOS, RX 9070 XT RDNA4, RADV, Proton Experimental, offline, `x86_64-pc-windows-msvc` diagnostics build, Series S mode, 480 s runs). **Measured in-world A/B (same build, `VICTORY_COPY_MEMORY=1` only, with the 4 KiB tile-base fix from #100 applied):** - **In-place heaps (`OpenExistingHeapFromAddress1`, ~2.5 GiB in `L0`/GTT over PCIe on RADV):** median **9,537 ms/frame**, GPU median **8,867 ms/frame** (even though D3D12 command timestamps in a separate timing run summed to only **33.9–48.1 ms/frame**). - **Copy mode under Wine (`VICTORY_COPY_MEMORY=1`, `n=47` world frames):** median **1,954 ms/frame** (**-79.5%**), GPU median **148 ms/frame** (**-98.3%**), **0 kernel GPU page faults**, and visible 3D world rendering (`time_to_world` dropped from 215.3 s to 144.9 s). One companion note for Wine/vkd3d-proton once copy mode is on: if sparse copies remain enabled, `Shadow::sparse_writing` hits `0xc0000005` on world entry because vkd3d-proton's `Map()` is only 4 KiB-aligned — that is fixed by #100 (or avoided by #69).
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/53:upstream-pr/53'
git switch 'upstream-pr/53'

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/53'
git switch 'upstream-pr/53'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/53'
git switch 'upstream-pr/53'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/53'
git switch 'main'
git merge --squash 'upstream-pr/53'
git switch 'main'
git merge --ff-only 'upstream-pr/53'
git switch 'main'
git merge 'upstream-pr/53'
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
Belobug/VIctory-Belobug-AMD!53
No description provided.