Textures: a refresh lets title memory move again once its bytes are copied (VICTORY_TEXTURE_SHORT_HOLD=1) #1078

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

@⁠alexis27yt on GitHub · 2026-11-25 18:40 UTC · original
alexis27yt:texture-short-hold → main · +264 −3 · 2 files · 1 commits · open

A texture refresh holds title memory still (watch::title_memory_reading) so no page goes under its read, and today it keeps holding it through the hash of the whole texture and the detile. Every page remap of the title (map_alias, ~850 in a frame that streams per the README, each taking MAPPING alone) waits for every refresh under way, and the title's render thread waits for those remaps: the README's streaming frames where "the render thread waits for its own jobs", one of which is the page-mapping copies. VICTORY_TEXTURE_NO_WAIT stops textures from waiting for remaps; nothing stopped remaps from waiting for textures.

With VICTORY_TEXTURE_SHORT_HOLD=1 (off by default) all three paths (partly mapped, VICTORY_TEXTURE_COPY, in place) copy the bytes out under the lock, let it go, then hash and detile the copy. The in-place path pays one extra pass over the bytes, which the read buffer already held for the others.

Measured with the new tests/texture_hold.rs (ignored by default) on an i5-12400F, SW_64KB_S, all mips:

texture held today (hash + detile) held with the switch (copy)
BC7 2048² (5.4 MB) 2.00 ms 0.27 ms 7.3×
BC7 4096² (21.4 MB) 8.36 ms 1.33 ms 6.3×
RGBA8 2048² (21.4 MB) 8.21 ms 1.20 ms 6.9×
per MB 0.384 ms 0.058 ms 6.6×

At the ~110 MB of textures a streaming frame reads (runs 91/93), that is ~42 ms → ~6.6 ms of lock held a frame on this CPU, summed over refreshes. Not measured in game: whether this is what the remaps wait on is exactly what the frame log's RemapWaitUs (and RefreshStillUs) from a streaming scene would show, with and without the switch.

Tests: new a_refresh_detiles_what_title_memory_holds builds a real Staging on a host upload buffer over guarded memory of its own, refreshes, has the "title" write the texture through the guard, refreshes again, and compares the staging bytes with Layout::detile each time; it and the 13 other texture tests pass with and without the switch (RTX 4070 SUPER). Clippy: no new warnings, with and without diagnostics.

**@⁠alexis27yt** on GitHub · 2026-11-25 18:40 UTC · [original](https://github.com/fxceless/victory-fork/pull/1078) `alexis27yt:texture-short-hold` → `main` · +264 −3 · 2 files · 1 commits · open A texture refresh holds title memory still (`watch::title_memory_reading`) so no page goes under its read, and today it keeps holding it through the **hash of the whole texture and the detile**. Every page remap of the title (`map_alias`, ~850 in a frame that streams per the README, each taking `MAPPING` alone) waits for every refresh under way, and the title's render thread waits for those remaps: the README's streaming frames where "the render thread waits for its own jobs", one of which is the page-mapping copies. `VICTORY_TEXTURE_NO_WAIT` stops textures from waiting for remaps; nothing stopped remaps from waiting for textures. With `VICTORY_TEXTURE_SHORT_HOLD=1` (**off by default**) all three paths (partly mapped, `VICTORY_TEXTURE_COPY`, in place) copy the bytes out under the lock, let it go, then hash and detile the copy. The in-place path pays one extra pass over the bytes, which the read buffer already held for the others. **Measured** with the new `tests/texture_hold.rs` (ignored by default) on an i5-12400F, SW_64KB_S, all mips: | texture | held today (hash + detile) | held with the switch (copy) | | |---|---|---|---| | BC7 2048² (5.4 MB) | 2.00 ms | 0.27 ms | 7.3× | | BC7 4096² (21.4 MB) | 8.36 ms | 1.33 ms | 6.3× | | RGBA8 2048² (21.4 MB) | 8.21 ms | 1.20 ms | 6.9× | | **per MB** | **0.384 ms** | **0.058 ms** | **6.6×** | At the ~110 MB of textures a streaming frame reads (runs 91/93), that is ~42 ms → ~6.6 ms of lock held a frame on this CPU, summed over refreshes. **Not measured in game:** whether this is what the remaps wait on is exactly what the frame log's `RemapWaitUs` (and `RefreshStillUs`) from a streaming scene would show, with and without the switch. Tests: new `a_refresh_detiles_what_title_memory_holds` builds a real `Staging` on a host upload buffer over guarded memory of its own, refreshes, has the "title" write the texture through the guard, refreshes again, and compares the staging bytes with `Layout::detile` each time; it and the 13 other texture tests pass with and without the switch (RTX 4070 SUPER). Clippy: no new warnings, with and without `diagnostics`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:57:08 +00:00
Author
Owner

@⁠BitWuehler on GitHub · 2026-11-26 23:08 UTC · original

In-world Linux/Proton data point (CachyOS, GE-Proton11-14 + vkd3d-proton, RTX 5080 16 GB, Series X profile, 4f83d40 merged onto e4245f3/52ac4ec):

  • Ran 8 Prologue world sessions (6–11 min each) with VICTORY_TEXTURE_SHORT_HOLD=1 alongside VICTORY_HEAP_WORKER=1 and VICTORY_LEVELS_ON_DEMAND=1: clean throughout (0 page faults, no crashes or texture-corruption regressions attributable to the shorter hold).
  • Comparing framelog's remapping: ... waiting for readers across two full world runs on the same 52ac4ec-based binary (caveat: multi-switch comparison between our full turbo preset with VICTORY_TEXTURE_SHORT_HOLD=1 and a minimal QU17 preset with VICTORY_TEXTURE_SHORT_HOLD unset, not a single-variable A/B):
    • With VICTORY_TEXTURE_SHORT_HOLD=1 (373 logged intervals): mean 1.10 ms (sum 411.0 ms, max 61.1 ms).
    • With VICTORY_TEXTURE_SHORT_HOLD unset (274 logged intervals): mean 2.98 ms (sum 817.1 ms, max 96.7 ms).

(AI-assisted testing, log extraction, and summary.)

**@⁠BitWuehler** on GitHub · 2026-11-26 23:08 UTC · [original](https://github.com/fxceless/victory-fork/pull/1078#issuecomment-7205282609) In-world Linux/Proton data point (CachyOS, GE-Proton11-14 + `vkd3d-proton`, RTX 5080 16 GB, Series X profile, `4f83d40` merged onto `e4245f3`/`52ac4ec`): - Ran 8 Prologue world sessions (6–11 min each) with `VICTORY_TEXTURE_SHORT_HOLD=1` alongside `VICTORY_HEAP_WORKER=1` and `VICTORY_LEVELS_ON_DEMAND=1`: clean throughout (`0 page faults`, no crashes or texture-corruption regressions attributable to the shorter hold). - Comparing `framelog`'s `remapping: ... waiting for readers` across two full world runs on the same `52ac4ec`-based binary *(caveat: multi-switch comparison between our full turbo preset with `VICTORY_TEXTURE_SHORT_HOLD=1` and a minimal `QU17` preset with `VICTORY_TEXTURE_SHORT_HOLD` unset, not a single-variable A/B)*: - With `VICTORY_TEXTURE_SHORT_HOLD=1` (373 logged intervals): mean **1.10 ms** (`sum 411.0 ms`, `max 61.1 ms`). - With `VICTORY_TEXTURE_SHORT_HOLD` unset (274 logged intervals): mean **2.98 ms** (`sum 817.1 ms`, `max 96.7 ms`). *(AI-assisted testing, log extraction, and summary.)*
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1078/head:github-bot/gh-1078'
git switch 'github-bot/gh-1078'

Merge

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