Textures picked by index: looked at again past the schedule, and read whole up to a size (HUD glyphs) #956

Open
github-bot wants to merge 2 commits from github-bot/gh-956 into main AGit
Owner

@⁠Victorywillbeours222 on GitHub · 2026-11-25 13:43 UTC · original
Victorywillbeours222:texture-recheck-every-whole → main · +139 −33 · 4 files · 2 commits · open

The problem

A texture picked by index is looked at again after an upload, at 4, 12, 40, 120 and 400 frames (RECHECK_FRAMES), and then never again. Each look compares a fingerprint of three 16 KiB windows: the start, the middle and the end of the memory.

The title fills some textures piece by piece, long after their first upload. The visible case is the HUD's glyph cache. In the prologue's cell, button prompts showed only some of their letters (M d), and those letters stayed missing. A glyph written after the last look, or between the windows, never reached the host copy.

The change (both switches off by default; with neither set nothing changes)

  • VICTORY_HEAP_RECHECK_EVERY=<frames>: a slot still unchanged at the last scheduled look is looked at again every that many frames, for as long as it stays unchanged. It still leaves the queue when it is written again or streamed out.
  • VICTORY_HEAP_RECHECK_WHOLE_MB=<n>: textures over 48 KiB and up to n MiB get a fingerprint of their whole memory too, read in 48 KiB pieces.
    • The windows' hash is kept in the low 32 bits, so a change that only the whole read saw can be counted.
    • Textures above n MiB keep the three windows.
  • New counters on the frame line: looks, changes, changes found after the scheduled looks, and changes found only between the sampled windows.

Measured

RTX 5080 16 GB, Ryzen 7 5800X, diag build of f85101b with its frame-rate switches, Series S profile, the prologue (the diner, the title card, the cell). A 10-minute run with VICTORY_HEAP_RECHECK_EVERY=60 VICTORY_HEAP_RECHECK_WHOLE_MB=8:

looks at uploaded textures 332,642
changes found (uploaded again) 34,457
… only after the scheduled looks (_EVERY) 141
… only between the three windows (_WHOLE_MB) 9,714 (28 %)
  • More than a quarter of the changes the title makes to these textures fall between the three windows. That is the gap #559 describes; this is a count of it in the game. A second run, with #868's switch on, found 9,005 of 28,590 (31 %).

  • With both switches on, the cell's HUD prompts and the subtitles read in full. Without them, letters are missing in the same scene (seen on 9376fd6).

  • Cost: same tree, profile and scene, 10 minutes each, readings over 200 draws:

    world median texture preparation per frame
    both switches off 4.3 fps 19.8 ms, 40.0 MB
    both on (_EVERY=60, _WHOLE_MB=8) 4.4 fps 20.7 ms, 45.2 MB

    That is about 1 ms and 5 MB more a frame, for the textures uploaded again. The frame-rate difference is within run-to-run noise.

  • At that cost the switches could reasonably be on by default. They are left off here so other cards can measure first.

How it relates to other PRs

  • #559 adds 1 KiB ranges at the start of every mip of every slice. That is cheaper than a whole read and covers big textures. But it stops looking after the fifth look, and its ranges can still miss a glyph in the middle of a mip. The two fit together: #559's ranges for big textures, a whole read for small ones (atlases are small), and looks that go on. Happy to rebase onto #559 if it goes in first.
  • #676 (the queue when the card is full, mip-stream view rewrites) and #605 (the budget per copy) touch the same queue but not the recheck itself. No overlap in behaviour that I can see.

Checks

On 0b0074e with only this change:

  • cargo build --profile diag -p victory --features diagnostics: ok.
  • cargo clippy -p victory-gpu --all-targets --features diagnostics: no new warnings. The three it prints are in code this change does not touch (draw.rs:2427, shadow.rs:2675, indirect.rs:2159).
  • cargo test --profile diag -p victory-gpu --lib: 169 passed, 5 ignored, 1 failed. The failure is indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields, which fails on 0b0074e without this change too (2 of 2 runs) and passes now and then with or without it. It is the flaky software-adapter test that a253706's message mentions.
  • cargo xtask policy: 179 files ok.
  • Numbers only; no game data, captures or screenshots.

🤖 Generated with Claude Code

**@⁠Victorywillbeours222** on GitHub · 2026-11-25 13:43 UTC · [original](https://github.com/fxceless/victory-fork/pull/956) `Victorywillbeours222:texture-recheck-every-whole` → `main` · +139 −33 · 4 files · 2 commits · open ## The problem A texture picked by index is looked at again after an upload, at 4, 12, 40, 120 and 400 frames (`RECHECK_FRAMES`), and then never again. Each look compares a fingerprint of three 16 KiB windows: the start, the middle and the end of the memory. The title fills some textures piece by piece, long after their first upload. The visible case is the HUD's glyph cache. In the prologue's cell, button prompts showed only some of their letters (`M d`), and those letters stayed missing. A glyph written after the last look, or between the windows, never reached the host copy. ## The change (both switches off by default; with neither set nothing changes) - `VICTORY_HEAP_RECHECK_EVERY=<frames>`: a slot still unchanged at the last scheduled look is looked at again every that many frames, for as long as it stays unchanged. It still leaves the queue when it is written again or streamed out. - `VICTORY_HEAP_RECHECK_WHOLE_MB=<n>`: textures over 48 KiB and up to `n` MiB get a fingerprint of their whole memory too, read in 48 KiB pieces. - The windows' hash is kept in the low 32 bits, so a change that only the whole read saw can be counted. - Textures above `n` MiB keep the three windows. - New counters on the frame line: looks, changes, changes found after the scheduled looks, and changes found only between the sampled windows. ## Measured RTX 5080 16 GB, Ryzen 7 5800X, diag build of `f85101b` with its frame-rate switches, Series S profile, the prologue (the diner, the title card, the cell). A 10-minute run with `VICTORY_HEAP_RECHECK_EVERY=60 VICTORY_HEAP_RECHECK_WHOLE_MB=8`: | | | |---|---:| | looks at uploaded textures | 332,642 | | changes found (uploaded again) | 34,457 | | … only after the scheduled looks (`_EVERY`) | 141 | | … only between the three windows (`_WHOLE_MB`) | **9,714 (28 %)** | - More than a quarter of the changes the title makes to these textures fall between the three windows. That is the gap #559 describes; this is a count of it in the game. A second run, with #868's switch on, found 9,005 of 28,590 (31 %). - With both switches on, the cell's HUD prompts and the subtitles read in full. Without them, letters are missing in the same scene (seen on `9376fd6`). - Cost: same tree, profile and scene, 10 minutes each, readings over 200 draws: | | world median | texture preparation per frame | |---|---:|---:| | both switches off | 4.3 fps | 19.8 ms, 40.0 MB | | both on (`_EVERY=60`, `_WHOLE_MB=8`) | 4.4 fps | 20.7 ms, 45.2 MB | That is about 1 ms and 5 MB more a frame, for the textures uploaded again. The frame-rate difference is within run-to-run noise. - At that cost the switches could reasonably be on by default. They are left off here so other cards can measure first. ## How it relates to other PRs - **#559** adds 1 KiB ranges at the start of every mip of every slice. That is cheaper than a whole read and covers big textures. But it stops looking after the fifth look, and its ranges can still miss a glyph in the middle of a mip. The two fit together: #559's ranges for big textures, a whole read for small ones (atlases are small), and looks that go on. Happy to rebase onto #559 if it goes in first. - **#676** (the queue when the card is full, mip-stream view rewrites) and **#605** (the budget per copy) touch the same queue but not the recheck itself. No overlap in behaviour that I can see. ## Checks On `0b0074e` with only this change: - `cargo build --profile diag -p victory --features diagnostics`: ok. - `cargo clippy -p victory-gpu --all-targets --features diagnostics`: no new warnings. The three it prints are in code this change does not touch (`draw.rs:2427`, `shadow.rs:2675`, `indirect.rs:2159`). - `cargo test --profile diag -p victory-gpu --lib`: 169 passed, 5 ignored, 1 failed. The failure is `indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields`, which fails on `0b0074e` without this change too (2 of 2 runs) and passes now and then with or without it. It is the flaky software-adapter test that `a253706`'s message mentions. - `cargo xtask policy`: 179 files ok. - Numbers only; no game data, captures or screenshots. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Two opt-in switches for the recheck of textures picked by index, both off
by default (with neither set nothing changes):

- VICTORY_HEAP_RECHECK_EVERY=<frames>: a slot still unchanged at the last
  of RECHECK_FRAMES is looked at again every that many frames while it
  stays unchanged.
- VICTORY_HEAP_RECHECK_WHOLE_MB=<n>: textures over 48 KiB and up to n MiB
  get a fingerprint of their whole memory besides the three 16 KiB
  windows (the windows' hash kept in the low 32 bits).

The frame line counts the looks, the changes, and of those the ones found
only after the schedule and only between the windows. In the prologue
28 % of the changes were only between the windows; with both switches on
the cell's HUD prompts and subtitles read in full.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:54:35 +00:00
Author
Owner

@⁠tippythetaidum on GitHub · 2026-11-25 16:47 UTC · original · edited 2026-11-25 16:50 UTC

Tried on an RTX 5080 16 GB (Windows 11, driver 621.14, Series X profile), the prologue from the cell to the salon. One 10-minute run with VICTORY_HEAP_RECHECK_EVERY=60 VICTORY_HEAP_RECHECK_WHOLE_MB=8.

Build: diagnostics build of main 3973179 + #24 + #927 + #823 + #606 + this PR + #1002 + #907. That run also carried a local diagnostic of mine that changes texture reads (pages not there read as a marker colour instead of zeros), so read the cost notes below with that in mind.

Counters at the end of the run (they fit yours):

looks 387,859
changed (uploaded again) 51,728
changed only after the scheduled looks 1,479
changed only between the sampled windows 14,317

The queue line overstates "waiting for their memory" with _EVERY set. With it, the texture queue line said 10,500 to 12,000 slots were waiting for their memory, all run long. In a run of the same build without the switches (and without my diagnostic), it fell from about 8,600 at the start of the world to 2,200 to 2,900, as before. The slots that _EVERY keeps looking at stay in the queue as recheck left them, looks 1 and mapped 0, and TextureQueue::census counts every slot with looks > 0 and mapped == 0 as waiting. So the line is about 9,000 too high: those textures are uploaded and fine. Counting slots that have a checked fingerprint apart would fix the line.

Cost: I can't separate it in this run. Frame times were about the same as without the switches (3 to 4 fps in the same scenes in both runs). The first 30 frames of the world were worse, though: characters whose skin colour had not arrived yet lit up as bright white figures. Correction: that run also entered the world with about 1,230 pipelines still being made, because other PRs in the stack changed the translator and the caches were cold. The runs I compared it with had none. That is the likelier cause, not this PR.

AI-assisted (Claude Code, Claude Opus 5.5). Counts and descriptions only, nothing from the game attached.

**@⁠tippythetaidum** on GitHub · 2026-11-25 16:47 UTC · [original](https://github.com/fxceless/victory-fork/pull/956#issuecomment-7168531118) · edited 2026-11-25 16:50 UTC Tried on an RTX 5080 16 GB (Windows 11, driver 621.14, Series X profile), the prologue from the cell to the salon. One 10-minute run with `VICTORY_HEAP_RECHECK_EVERY=60 VICTORY_HEAP_RECHECK_WHOLE_MB=8`. **Build:** diagnostics build of `main` `3973179` + #24 + #927 + #823 + #606 + this PR + #1002 + #907. That run also carried a local diagnostic of mine that changes texture reads (pages not there read as a marker colour instead of zeros), so read the cost notes below with that in mind. **Counters at the end of the run** (they fit yours): | | | |---|---:| | looks | 387,859 | | changed (uploaded again) | 51,728 | | changed only after the scheduled looks | 1,479 | | changed only between the sampled windows | 14,317 | **The queue line overstates "waiting for their memory" with `_EVERY` set.** With it, the texture queue line said 10,500 to 12,000 slots were waiting for their memory, all run long. In a run of the same build without the switches (and without my diagnostic), it fell from about 8,600 at the start of the world to 2,200 to 2,900, as before. The slots that `_EVERY` keeps looking at stay in the queue as `recheck` left them, `looks` 1 and `mapped` 0, and `TextureQueue::census` counts every slot with `looks > 0` and `mapped == 0` as waiting. So the line is about 9,000 too high: those textures are uploaded and fine. Counting slots that have a `checked` fingerprint apart would fix the line. **Cost:** I can't separate it in this run. Frame times were about the same as without the switches (3 to 4 fps in the same scenes in both runs). The first 30 frames of the world were worse, though: characters whose skin colour had not arrived yet lit up as bright white figures. **Correction:** that run also entered the world with about 1,230 pipelines still being made, because other PRs in the stack changed the translator and the caches were cold. The runs I compared it with had none. That is the likelier cause, not this PR. AI-assisted (Claude Code, Claude Opus 5.5). Counts and descriptions only, nothing from the game attached.
With VICTORY_HEAP_RECHECK_EVERY set, the slots `recheck` keeps carry
`looks` 1 and nothing mapped, so `TextureQueue::census` counted them as
waiting for their memory: about 9,000 too many on the queue line (seen
by a tester on an RTX 5080). They are uploaded and fine. The census now
counts slots with a `checked` fingerprint apart, and the line says
"uploaded whole and kept for another look". Unit test added.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠Victorywillbeours222 on GitHub · 2026-11-26 13:27 UTC · original

Thanks for running it. The queue line is fixed in a9040a8:

  • TextureQueue::census now counts the slots recheck keeps (those with a checked fingerprint) apart from the ones waiting for their memory.
  • The line says how many are "uploaded whole and kept for another look", so "waiting for their memory" no longer includes them.
  • A unit test covers it (slots_kept_for_another_look_are_not_waiting_for_their_memory). The descriptor::host tests pass, and the changed hunks add no clippy or rustfmt findings.

I haven't re-run it in game yet.

AI-assisted (Claude Code).

**@⁠Victorywillbeours222** on GitHub · 2026-11-26 13:27 UTC · [original](https://github.com/fxceless/victory-fork/pull/956#issuecomment-7193379266) Thanks for running it. The queue line is fixed in a9040a8: - `TextureQueue::census` now counts the slots `recheck` keeps (those with a `checked` fingerprint) apart from the ones waiting for their memory. - The line says how many are "uploaded whole and kept for another look", so "waiting for their memory" no longer includes them. - A unit test covers it (`slots_kept_for_another_look_are_not_waiting_for_their_memory`). The `descriptor::host` tests pass, and the changed hunks add no clippy or rustfmt findings. I haven't re-run it in game yet. *AI-assisted (Claude Code).*
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/956/head:github-bot/gh-956'
git switch 'github-bot/gh-956'

Merge

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