GPU: do not wait for title-memory remaps when refreshing textures by default #393

Closed
relativespace2K wants to merge 1 commit from upstream-pr/393 into main
relativespace2K commented 2026-11-25 00:19:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by relativespace2K on 2026-11-25T00:19:10Z.


What

VICTORY_TEXTURE_NO_WAIT is now on by default: a texture refresh asks for the title-memory mapping lock without waiting. If the runtime is remapping, it reads through the kernel instead (or leaves the texture for its next refresh, a frame later); it never reads a partly mapped texture. VICTORY_TEXTURE_NO_WAIT=0 restores the old waiting behaviour.

This follows the proposal in #178 (RX 7900 XT, RADV) with a second AMD data point on native Windows D3D12.

Measurements

Machine: RX 6800 XT 16 GB (RDNA2), driver 32.0.21045.29003, Ryzen 5 5600, 32 GB, Windows 11 26100, Series X profile, diagnostics build, 1920x1080.

Opening cutscene, same phase, warm shader cache:

fps ms/frame textures
before (default wait) 0.2 4,363-5,658 3,124-4,958 ms
VICTORY_TEXTURE_NO_WAIT=1 0.3-0.7 1,390-3,095 9-11 ms

The texture line names the wait as the whole cost: texture refreshes per frame ... 0.0 ms waiting for title memory to hold still with the switch, against seconds without it.

Prologue (same checkpoint, 180 s runs):

fps ms/frame textures wait
default after this PR 1.4 695 39 ms 0.0 ms
VICTORY_TEXTURE_NO_WAIT=0 1.2-1.4 725-807 59-107 ms 0-43 ms

The large win is while the world is streaming in; once the prologue settles the wait is small, so the default does not change the steady state much there. The run reached the prologue with ~5,000 draws/frame, ~17 GB working set and no device loss.

Checks

  • cargo test --workspace --locked -- --test-threads=1: 497 passed, 0 failed, 7 ignored.
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean.
  • cargo xtask policy: 169 files ok.
  • New unit test texture::title_memory_tests::texture_refreshes_do_not_wait_unless_asked_to covers the unset/1/0 parsing.

No game files, shaders or captures are included; the runs were on the reporter's own copy.

AI-assisted: the patch and the runs above were made with an AI agent on my machine; I reviewed the result and the logs.

Refs #178.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6594184318 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/393). Originally posted by [relativespace2K](https://github.com/relativespace2K) on 2026-11-25T00:19:10Z. --- ## What `VICTORY_TEXTURE_NO_WAIT` is now on by default: a texture refresh asks for the title-memory mapping lock without waiting. If the runtime is remapping, it reads through the kernel instead (or leaves the texture for its next refresh, a frame later); it never reads a partly mapped texture. `VICTORY_TEXTURE_NO_WAIT=0` restores the old waiting behaviour. This follows the proposal in #178 (RX 7900 XT, RADV) with a second AMD data point on native Windows D3D12. ## Measurements Machine: RX 6800 XT 16 GB (RDNA2), driver 32.0.21045.29003, Ryzen 5 5600, 32 GB, Windows 11 26100, Series X profile, diagnostics build, 1920x1080. Opening cutscene, same phase, warm shader cache: | | fps | ms/frame | textures | |---|---:|---:|---:| | before (default wait) | 0.2 | 4,363-5,658 | 3,124-4,958 ms | | `VICTORY_TEXTURE_NO_WAIT=1` | 0.3-0.7 | 1,390-3,095 | 9-11 ms | The texture line names the wait as the whole cost: `texture refreshes per frame ... 0.0 ms waiting for title memory to hold still` with the switch, against seconds without it. Prologue (same checkpoint, 180 s runs): | | fps | ms/frame | textures | wait | |---|---:|---:|---:|---:| | default after this PR | 1.4 | 695 | 39 ms | 0.0 ms | | `VICTORY_TEXTURE_NO_WAIT=0` | 1.2-1.4 | 725-807 | 59-107 ms | 0-43 ms | The large win is while the world is streaming in; once the prologue settles the wait is small, so the default does not change the steady state much there. The run reached the prologue with ~5,000 draws/frame, ~17 GB working set and no device loss. ## Checks - `cargo test --workspace --locked -- --test-threads=1`: 497 passed, 0 failed, 7 ignored. - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings`: clean. - `cargo xtask policy`: 169 files ok. - New unit test `texture::title_memory_tests::texture_refreshes_do_not_wait_unless_asked_to` covers the unset/`1`/`0` parsing. No game files, shaders or captures are included; the runs were on the reporter's own copy. AI-assisted: the patch and the runs above were made with an AI agent on my machine; I reviewed the result and the logs. Refs #178.
upstream-sync closed this pull request 2026-11-25 01:11:38 +00:00
relativespace2K commented 2026-11-25 01:12:07 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by relativespace2K on 2026-11-25T01:06:11Z.


Superseded by #175, which fixes the root cause by scoping the mapping lock to the affected ranges and keeping the in-place texture read. I validated #175 on an RX 6800 XT (Windows 11, native D3D12): mapping wait median 0.0 ms and max 35.5 ms over 107 windows, against a 7,886.5 ms worst window before; prologue at 1.2-1.5 fps with no device loss. Details in #175. Closing this in favor of #175.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7149207623 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/393#issuecomment-7149207623). Originally posted by [relativespace2K](https://github.com/relativespace2K) on 2026-11-25T01:06:11Z. --- Superseded by #175, which fixes the root cause by scoping the mapping lock to the affected ranges and keeping the in-place texture read. I validated #175 on an RX 6800 XT (Windows 11, native D3D12): mapping wait median 0.0 ms and max 35.5 ms over 107 windows, against a 7,886.5 ms worst window before; prologue at 1.2-1.5 fps with no device loss. Details in #175. Closing this in favor of #175.

Pull request closed

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!393
No description provided.