Under Wine, copies of title memory are not sparse buffers by default (GPU reset once the world loads) #69
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/69"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Belobug/VIctory-Belobug-AMD. Originally posted by sil-kong on 2026-11-25T13:18:02Z.
Under Wine, once the world loads, sparse copies of title memory hang the GPU until the driver resets it. This turns them off by default under Wine only.
What happens
Linux, RX 7900 XT (RDNA3), RADV / Mesa 26.2.7, GE-Proton10-34's Wine with vkd3d-proton from Proton Experimental,
x86_64-pc-windows-gnurelease of71652a2, with title memory copied (VICTORY_COPY_MEMORY=1, which #53 makes the default under Wine).The intro and loading pass. When the world loads, the GPU time per frame goes from tens of ms to seconds:
A minute later the card was reset and the desktop (Hyprland, same GPU) went down with it; the machine had to be restarted. The kernel journal of that boot was not flushed, so I have no reset line to quote, only the log above and the crash.
Each tile mapping of a sparse copy becomes a sparse bind on the queue in vkd3d-proton (
UpdateTileMappings), which on RADV is costly, and the world maps many tiles a frame.Change
One function,
sparse()incrates/victory-gpu/src/shadow.rs. Under Wine (ntdll exportswine_get_version, asxmem::on_winetells) copies of title memory are made per title buffer or window, as beforecc4d18d. Windows is unchanged.VICTORY_SPARSE0The log line says which:
copies of title memory in sparse buffers on=false wine=true.Tested
Same machine, same build plus this change, same save, first room of the prison. Nothing else changed between the two runs.
The cost: without sparse copies the CPU copies more per frame (about 640 MB in about 100 ms here), so this trades the GPU hang for CPU time. Some of #18's work might make the sparse path usable under Wine later;
VICTORY_SPARSE=1is there to try it.#6 (Linux, RADV, the desktop froze once the world was black) might be the same; I can't tell from here.
Builds with
cargo build --release -p victory --target x86_64-pc-windows-gnu; no new warnings.Imported from Belobug/VIctory-Belobug-AMD. Originally posted by gut0to on 2026-11-25T15:08:49Z.
Review: COMMENTED
AI-assisted review: I checked the changed behavior and the associated test coverage.
Imported from Belobug/VIctory-Belobug-AMD. Originally posted by gut0to on 2026-11-25T15:08:50Z.
Code review location:
crates/victory-gpu/src/shadow.rs; line 1789Could the default/override policy be extracted into a small pure helper and tested for both Wine defaults and explicit VICTORY_SPARSE=0/1? This toggle changes a GPU-reset-prone path, and OnceLock currently leaves the environment-selection cases untested. AI-assisted review; I checked the selection logic and test coverage.
Imported from Belobug/VIctory-Belobug-AMD. Originally posted by sil-kong on 2026-11-25T15:11:34Z.
Done: the choice is now
sparse_policy(switch, wine), a pure functionsparse_oncalls once, andsparse_copies_are_off_under_wine_unless_asked_forcovers unset (on natively, off under Wine) andVICTORY_SPARSE=0/1on both hosts. The test passes (cargo test -p victory-gpu --lib, run under Wine). Also rebased on current main (01aadd1).Imported from Belobug/VIctory-Belobug-AMD. Originally posted by TobiasFornell on 2026-11-25T21:35:58Z.
Adding an RDNA4 data point here: on CachyOS Linux, RX 9070 XT (RDNA4, RADV), Proton Experimental (Belobug-based local branch with #53's copy mode, #100's 4 KiB tile-base fix, and local CPU-prep patches), sparse copies of title memory do not trigger the ~6 s GPU hang or device reset seen on RDNA3 / Mesa 26.2.7.
In a 600 s prison-cell run (measured after world entry:
461 ms/framemedian — 292 ms prep, 88 ms copy-back, 81 ms GPU), sparse copies ran cleanly with 0 kernel GPU page faults. KeepingVICTORY_SPARSE=1available as an opt-in override when defaulting it off under Wine looks like the right call.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.