fix(gpu): time the look-again cap of away textures by the frame #496

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

@⁠arutkowski00 on GitHub · 2026-12-04 18:32 UTC · original
arutkowski00:pr/lookagain-cap → main · +37 −9 · 1 files · 1 commits · open

Problem

A slot whose texture memory is not mapped yet is looked at again after 1, 2, 4, ... frames, up to the number of frames in about four seconds. Those frames were counted from the time between texture passes, of which there are several a frame, so the cap sat at its 256-frame ceiling nearly always: 10-18 s at 14-25 frames a second. A texture the title streamed in was noticed 0.9 s late on average and up to 16 s (texture_late "away_to_upload"), and was drawn blurry or missing meanwhile.

Change

The cap now comes from the title's frame time, smoothed over a few frames, so it is about four seconds as intended (100 frames at 25 fps). One file, draw.rs.

Switch

None. This corrects the unit the cap was computed in; it does not add behaviour. The only visible difference is how late a streamed-in texture is noticed. I did not compare output with a switch off, because there is no switch. If maintainers want one, say so and I will add it.

Queue

Independent of the open PRs I found touching draw.rs and the texture look: a test merge with #355, #313 and #481 is clean. I did not compare the intent of the others in the list.

How it was checked

  • Release build of the workspace on the MSVC target, no warnings.
  • cargo xtask policy: ok.
  • The late-notice figures (0.9 s average, 16 s maximum) come from the texture_late counters in one play session on an RX 7900 XTX. I have not re-measured them after the change as a separate run, so the improvement in how late a texture is noticed is expected from the arithmetic of the cap and is not yet measured.

Not tested

  • No test. I have not written one, and no existing test covers the cap. A test would need the cap's computation separated from the texture pass.
  • Hardware other than the 7900 XTX.
  • Frame times, before and after, for this change alone.

Cost

No memory cost. The frame time is smoothed with a few arithmetic operations once a frame. No new switch, nothing on by default that was not already.

**@⁠arutkowski00** on GitHub · 2026-12-04 18:32 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/496) `arutkowski00:pr/lookagain-cap` → `main` · +37 −9 · 1 files · 1 commits · open ## Problem A slot whose texture memory is not mapped yet is looked at again after 1, 2, 4, ... frames, up to the number of frames in about four seconds. Those frames were counted from the time between texture passes, of which there are several a frame, so the cap sat at its 256-frame ceiling nearly always: 10-18 s at 14-25 frames a second. A texture the title streamed in was noticed 0.9 s late on average and up to 16 s (`texture_late` "away_to_upload"), and was drawn blurry or missing meanwhile. ## Change The cap now comes from the title's frame time, smoothed over a few frames, so it is about four seconds as intended (100 frames at 25 fps). One file, `draw.rs`. ## Switch None. This corrects the unit the cap was computed in; it does not add behaviour. The only visible difference is how late a streamed-in texture is noticed. I did not compare output with a switch off, because there is no switch. If maintainers want one, say so and I will add it. ## Queue Independent of the open PRs I found touching `draw.rs` and the texture look: a test merge with #355, #313 and #481 is clean. I did not compare the intent of the others in the list. ## How it was checked - Release build of the workspace on the MSVC target, no warnings. - `cargo xtask policy`: ok. - The late-notice figures (0.9 s average, 16 s maximum) come from the `texture_late` counters in one play session on an RX 7900 XTX. I have not re-measured them after the change as a separate run, so the improvement in how late a texture is noticed is expected from the arithmetic of the cap and is not yet measured. ## Not tested - **No test.** I have not written one, and no existing test covers the cap. A test would need the cap's computation separated from the texture pass. - Hardware other than the 7900 XTX. - Frame times, before and after, for this change alone. ## Cost No memory cost. The frame time is smoothed with a few arithmetic operations once a frame. No new switch, nothing on by default that was not already.
A slot whose texture memory is not mapped yet is looked at again after
1, 2, 4... frames, up to the frames in about four seconds. Those frames
were counted from the time between texture passes, of which there are
several a frame, so the cap sat at its 256-frame ceiling nearly always:
10-18 s at 14-25 frames a second. A texture the title streamed in was
noticed 0.9 s late on average and up to 16 s (texture_late
"away_to_upload"), drawn blurry or missing meanwhile.

The cap now comes from the title's frame time, smoothed over a few
frames, so it is about four seconds as intended (100 frames at 25 fps).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 18:36:31 +00:00
github-bot changed title from draw: time the look-again cap of away textures by the frame to fix(gpu): time the look-again cap of away textures by the frame 2026-12-04 18:42:29 +00:00
Author
Owner

@⁠Kal0s-design on GitHub · 2026-12-04 19:08 UTC · original

Checked 597e595 on native Windows (one NVIDIA desktop card, didn't run the game). cargo test -p victory-gpu --lib gives the same result as main apart from the usual native failures (indirect host_list x2, the two pipeline library loads, one flaky watch test that only failed on the PR run). Clippy is clean with and without diagnostics, with the same warning count as main.

The change looks right to me. frame is the title's frame counter from frame.rs, so the first pass of each frame sets the time, and the CAS keeps the other passes of that frame out. Division by zero can't happen (the 0 case falls back to 16 ms), and the result is still clamped to 16..256. PASSED was local, so nothing else used the old value.

I copied frame_ms into a scratch program with a fake clock and fed it frame times with 4 passes a frame. On main, steady 40 ms gives 256 almost every pass (102 on the first pass when the passes are bunched). The PR gives 100. 16 ms gives 250, and 5 ms gives 256. Alternating 16/66 settles around 95-111. A single 2 s hitch in 40 ms frames drops the cap to 16, and it takes about 15 frames to climb back to 88. Six frames at 0.5 fps keep it at 16 for about a dozen frames after the rate recovers. Both cases only mean extra looks for a short while, so that seems fine.

Two small things, neither blocking

  • at 25 fps an away slot is now looked at about 2.5x as often as before (cap 100 instead of 256). With tens of thousands of such views it might be worth one look at the pass time in texture_late/the timeline when you re-measure.
  • the doc comment on heap_textures still says the wait is "at most about a second". That was already out of date before this PR, but now is a good time to make it say about four seconds.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-12-04 19:08 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/496#issuecomment-7421453488) Checked 597e595 on native Windows (one NVIDIA desktop card, didn't run the game). `cargo test -p victory-gpu --lib` gives the same result as main apart from the usual native failures (indirect host_list x2, the two pipeline library loads, one flaky watch test that only failed on the PR run). Clippy is clean with and without `diagnostics`, with the same warning count as main. The change looks right to me. `frame` is the title's frame counter from frame.rs, so the first pass of each frame sets the time, and the CAS keeps the other passes of that frame out. Division by zero can't happen (the 0 case falls back to 16 ms), and the result is still clamped to 16..256. `PASSED` was local, so nothing else used the old value. I copied `frame_ms` into a scratch program with a fake clock and fed it frame times with 4 passes a frame. On main, steady 40 ms gives 256 almost every pass (102 on the first pass when the passes are bunched). The PR gives 100. 16 ms gives 250, and 5 ms gives 256. Alternating 16/66 settles around 95-111. A single 2 s hitch in 40 ms frames drops the cap to 16, and it takes about 15 frames to climb back to 88. Six frames at 0.5 fps keep it at 16 for about a dozen frames after the rate recovers. Both cases only mean extra looks for a short while, so that seems fine. Two small things, neither blocking - at 25 fps an away slot is now looked at about 2.5x as often as before (cap 100 instead of 256). With tens of thousands of such views it might be worth one look at the pass time in `texture_late`/the timeline when you re-measure. - the doc comment on `heap_textures` still says the wait is "at most about a second". That was already out of date before this PR, but now is a good time to make it say about four seconds. AI-assisted: yes
Author
Owner

@⁠turboheadcrab on GitHub · 2026-12-04 21:20 UTC · original

Measured 597e595 against its base 2382b4c, two runs each: texture_late goes up, the blinks from #463 don't change.

Setup: RX 9070 XT 16 GB, Linux, RADV, diagnostics profile. Series X, FSR 4 Quality (960p → 1440p), RT on, no frame generation. Standing on an idle save with the cinematic camera running, popwatch from 120 to 600 s. That runs at about 24 fps, so this is the "cap 100 instead of 256" case from the review. The two builds were run alternately.

Run away_to_upload at ~600 s: n mean p90 Frames with 20+ blipped blocks
base, 1 18,369 3.2 s < 16 s 15
base, 2 19,386 3.7 s < 16 s 15
PR, 1 28,873 5.5 s < 32 s 8
PR, 2 24,149 4.5 s < 32 s 15
  • Late textures: both PR runs report 25-50% more late away textures, a longer mean, and a p90 one bucket higher. Two runs each isn't much, but the two builds don't overlap on any of the three numbers.
  • Blinks: no change. PR run 1's lower count came with the idle camera starting late, so it had fewer cuts. Run 2 matched the base exactly. The neutral-texture share was 57-58% on all four runs.
  • No crash, hang or device loss on any run.

So at this frame rate, looking at away slots more often doesn't seem to bring them in sooner here. If anything they are counted late more often and for longer. I didn't separate whether the count rises because the lookups themselves take longer or because more slots are counted, and I haven't run it rebased on top of #503.

AI-assisted: yes

**@⁠turboheadcrab** on GitHub · 2026-12-04 21:20 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/496#issuecomment-7424555102) **Measured 597e595 against its base 2382b4c, two runs each: `texture_late` goes up, the blinks from #463 don't change.** **Setup:** RX 9070 XT 16 GB, Linux, RADV, diagnostics profile. Series X, FSR 4 Quality (960p → 1440p), RT on, no frame generation. Standing on an idle save with the cinematic camera running, popwatch from 120 to 600 s. That runs at about 24 fps, so this is the "cap 100 instead of 256" case from the review. The two builds were run alternately. | Run | `away_to_upload` at ~600 s: n | mean | p90 | Frames with 20+ blipped blocks | |---|---|---|---|---| | base, 1 | 18,369 | 3.2 s | < 16 s | 15 | | base, 2 | 19,386 | 3.7 s | < 16 s | 15 | | PR, 1 | 28,873 | 5.5 s | < 32 s | 8 | | PR, 2 | 24,149 | 4.5 s | < 32 s | 15 | - **Late textures:** both PR runs report 25-50% more late away textures, a longer mean, and a p90 one bucket higher. Two runs each isn't much, but the two builds don't overlap on any of the three numbers. - **Blinks:** no change. PR run 1's lower count came with the idle camera starting late, so it had fewer cuts. Run 2 matched the base exactly. The neutral-texture share was 57-58% on all four runs. - No crash, hang or device loss on any run. So at this frame rate, looking at away slots more often doesn't seem to bring them in sooner here. If anything they are counted late more often and for longer. I didn't separate whether the count rises because the lookups themselves take longer or because more slots are counted, and I haven't run it rebased on top of #503. AI-assisted: yes
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/496/head:github-bot/gh-496'
git switch 'github-bot/gh-496'

Merge

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