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

Open
Victorywillbeours222 wants to merge 2 commits from upstream-pr/956 into main
Victorywillbeours222 commented 2026-11-25 13:43:54 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Victorywillbeours222 on 2026-11-25T13:43:54Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:issue:6605874789 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/956). Originally posted by [Victorywillbeours222](https://github.com/Victorywillbeours222) on 2026-11-25T13:43:54Z. --- ## 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)
tippythetaidum commented 2026-11-25 17:08:03 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by tippythetaidum on 2026-11-25T16:47:15Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7168531118 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/956#issuecomment-7168531118). Originally posted by [tippythetaidum](https://github.com/tippythetaidum) on 2026-11-25T16:47:15Z. --- 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.
Victorywillbeours222 commented 2026-11-26 14:03:30 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Victorywillbeours222 on 2026-11-26T13:27:32Z.


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).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7193379266 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/956#issuecomment-7193379266). Originally posted by [Victorywillbeours222](https://github.com/Victorywillbeours222) on 2026-11-26T13:27:32Z. --- 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 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/956:upstream-pr/956'
git switch 'upstream-pr/956'

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/956'
git switch 'upstream-pr/956'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/956'
git switch 'upstream-pr/956'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/956'
git switch 'main'
git merge --squash 'upstream-pr/956'
git switch 'main'
git merge --ff-only 'upstream-pr/956'
git switch 'main'
git merge 'upstream-pr/956'
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
fxceless/victory-fork!955
No description provided.