Textures under VRAM pressure: texture pool (#1562), batch-buffer pool (#1441), blurry instead of black, far copies shrink #1759

Closed
github-bot wants to merge 4 commits from github-bot/gh-1759 into main AGit
Owner

@⁠crashoverride1995 on GitHub · 2026-11-28 23:56 UTC · original
pressure-levels → main · +1037 −182 · 7 files · 4 commits · closed without merging

Includes #1562 (Mikael Järvinen) and #1441 (saltdam36). Their commits are in this branch unchanged, with their authors, and two commits of mine follow on top. Merging this merges all of them; the measurements below are of the whole set.

  • If #1562 and #1441 are merged on their own first, this rebases down to my two commits.
  • If this goes in first, #1562 and #1441 can be closed as merged here.
Commit Author What it does
Adaptive 16/8 MiB texture pool, block-aware idle eviction, and pop-in priority Mikael Järvinen (#1562) Texture pool for cards of 12 GB or less
Indirect batches: scratch buffers go to a pool when their list has run saltdam36 (#1441) Fixes the leak of indirect-batch scratch buffers
Textures: blurry instead of black when the card has no room Hitesh Thawani VICTORY_PRESSURE_LEVELS
Textures: copies keep only the levels their slots show while the card has no room Hitesh Thawani VICTORY_SHRINK_FAR

What it changes

On a card that is full, a texture the title picks by index that has no host copy yet waits for room, and draws black (or late, as pop-in) until it gets it. While driving on a 12 GB card the texture queue said "no room, new textures wait" in 70 % of its 5-second checks, with tens of thousands of slots held back every 5 seconds: black sign lettering, blank billboards, roads and leaves popping in late.

  1. Blurry instead of black (VICTORY_PRESSURE_LEVELS, default 2, 0 = off). When the card has no room, a first upload is tried without its largest level, then without its two largest: a quarter or a sixteenth of the bytes. The slot shows the texture at once, a little soft, instead of black. The smaller copy is tried first, so the 5-second first-upload window (shared by every slot of the pass) admits about four times as many textures, instead of a few large ones using it all up. want_level gives the levels back once the card has room again; while it has none, a view of level 0 leaves the small copy as it is instead of sending it back to waiting.
    • Only textures shown by a plain 2D view are reduced, and from_base now moves Texture2DArray views of one-layer textures to the copy's first level too. Without that, a one-layer texture shown as an array by another slot named levels the copy no longer had, and the device was removed about 70 s into a drive.
    • The "reduced" mark is an atomic on the texture (Hosted::reduced). A first version kept it in one table under one lock; every view looked it up, and that cost the submitting thread about 5 ms a frame.
  2. Copies of far textures shrink (VICTORY_SHRINK_FAR, default on, 0 = off). Copies only ever grew: when the title's streaming moved a far texture's views to a smaller level, the host copy kept the large levels. Now, while the card has no room, want_level remakes a copy without its larger levels once no slot shows them any more (lowest level over all slots, first_viewed). The room goes to textures near the player, and the copy grows back when a view asks for the levels and the card has room again.

A new line every 5 s says how many textures are reduced, how many got their levels back, and how many copies shrank, of how many MB.

How it was tested

  • PC: AMD Ryzen 5 7600X (6 cores / 12 threads), 32 GB DDR5-6000, NVIDIA GeForce RTX 4070 Ti 12 GB (VRAM budget about 10.9 GB), driver 610.74, Windows 11 Home 26200.
  • Profile: Series S (720p internal, DLSS upscaling), frame generation off, no ray tracing. Warm pipeline cache.
  • Runs: one save, driving by hand for 3–4 minutes per run on the same stretch of road, with the F3 panel on. Figures are from the 5-second log lines while in the world (frames with 1,000 or more draws).
    • Routes and traffic differ from run to run, and each build was run once, so differences of about 1 fps are noise.
    • The main run was longer (about 10 minutes) and started at night.
Build Card "no room" (5-s checks) Slots held back for room per 5 s (median) Textures given their levels back fps all / medium / heavy Preparing (ms/frame)
main (d4b5d51) 70 % (94/134) 7,958 – 18.9 / 18.3 / 13.8 33.9
+ #1562 51 % (26/51) 13,978 – 17.3 / 18.1 / 15.7 38.2
+ #1562 + blurry 64 % (38/59) 6,264 56 17.0 / 17.2 / 15.5 38.8
+ #1562 + #1441 + blurry 36 % (21/58) 6,391 65 17.2 / 18.2 / 16.9 37.9
+ #1562 + #1441 + blurry + shrink (this branch) 42 % (25/59) 181 1,188 17.9 / 17.9 / 15.9 38.2
  • Last run (this branch):
    • 71,877 first uploads made reduced instead of waiting.
    • 12,667 copies of far textures shrunk, which together had 1,836 MB.
    • No device removed in this run or the two before it.
  • What it looked like: signs, roads and billboards come in slightly blurry instead of black, and sharpen once there is room. With #1441 the picture was a little sharper than with this change on #1562 alone.
  • Frame rate: about the same in every run. This PC is bound by the submitting thread (the GPU waits for it 15–30 ms a frame), not by textures.
  • The two commits alone, on main without #1562 and #1441: black became blurry (135,057 reduced uploads, no device removed), but the card stayed full (79 % "no room"), nothing got its levels back, and frames were no faster. The room these two need comes from #1441's pooled scratch buffers and #1562's texture pool.
  • cargo test -p victory-gpu --lib: all passed (including a new test: a texture made without its largest levels keeps them out while the card has no room, and gets them back with room). cargo clippy finds nothing in the changed lines; it does fail on main already in victory-shader (an unused variable and a manual checked division in emit/lower.rs).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1562 and #1441 (included here). Also tried and left out:
    • #1551, #1557 and #1561, on main: pop-in looked worse with them.
    • #1633, #1637 and #1497, together on top of this branch: preparing went 38 → 45 ms and fps 17.9 → 15.6 on this 7600X.

Credits

  • Mikael Järvinen, #1562: adaptive texture pool and block-aware eviction. It cut "no room" from 70 % to 51 % here.
  • saltdam36, #1441: pooled scratch buffers for indirect batches. About 1.7 GB less card memory in use mid-drive here, and "no room" down to 36 %.
  • held_only / want_level / from_base: the existing machinery that copies only the levels views show. This change builds on it.
**@⁠crashoverride1995** on GitHub · 2026-11-28 23:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1759) `pressure-levels` → `main` · +1037 −182 · 7 files · 4 commits · closed without merging **Includes #1562 (Mikael Järvinen) and #1441 (saltdam36).** Their commits are in this branch unchanged, with their authors, and two commits of mine follow on top. Merging this merges all of them; the measurements below are of the whole set. - If #1562 and #1441 are merged on their own first, this rebases down to my two commits. - If this goes in first, #1562 and #1441 can be closed as merged here. | Commit | Author | What it does | |---|---|---| | Adaptive 16/8 MiB texture pool, block-aware idle eviction, and pop-in priority | Mikael Järvinen (#1562) | Texture pool for cards of 12 GB or less | | Indirect batches: scratch buffers go to a pool when their list has run | saltdam36 (#1441) | Fixes the leak of indirect-batch scratch buffers | | Textures: blurry instead of black when the card has no room | Hitesh Thawani | `VICTORY_PRESSURE_LEVELS` | | Textures: copies keep only the levels their slots show while the card has no room | Hitesh Thawani | `VICTORY_SHRINK_FAR` | ## What it changes On a card that is full, a texture the title picks by index that has no host copy yet waits for room, and draws black (or late, as pop-in) until it gets it. While driving on a 12 GB card the texture queue said "no room, new textures wait" in 70 % of its 5-second checks, with tens of thousands of slots held back every 5 seconds: black sign lettering, blank billboards, roads and leaves popping in late. 1. **Blurry instead of black** (`VICTORY_PRESSURE_LEVELS`, default 2, 0 = off). When the card has no room, a first upload is tried without its largest level, then without its two largest: a quarter or a sixteenth of the bytes. The slot shows the texture at once, a little soft, instead of black. The smaller copy is tried first, so the 5-second first-upload window (shared by every slot of the pass) admits about four times as many textures, instead of a few large ones using it all up. `want_level` gives the levels back once the card has room again; while it has none, a view of level 0 leaves the small copy as it is instead of sending it back to waiting. - Only textures shown by a plain 2D view are reduced, and `from_base` now moves `Texture2DArray` views of one-layer textures to the copy's first level too. Without that, a one-layer texture shown as an array by another slot named levels the copy no longer had, and the device was removed about 70 s into a drive. - The "reduced" mark is an atomic on the texture (`Hosted::reduced`). A first version kept it in one table under one lock; every view looked it up, and that cost the submitting thread about 5 ms a frame. 2. **Copies of far textures shrink** (`VICTORY_SHRINK_FAR`, default on, 0 = off). Copies only ever grew: when the title's streaming moved a far texture's views to a smaller level, the host copy kept the large levels. Now, while the card has no room, `want_level` remakes a copy without its larger levels once no slot shows them any more (lowest level over all slots, `first_viewed`). The room goes to textures near the player, and the copy grows back when a view asks for the levels and the card has room again. A new line every 5 s says how many textures are reduced, how many got their levels back, and how many copies shrank, of how many MB. ## How it was tested - **PC:** AMD Ryzen 5 7600X (6 cores / 12 threads), 32 GB DDR5-6000, NVIDIA GeForce RTX 4070 Ti 12 GB (VRAM budget about 10.9 GB), driver 610.74, Windows 11 Home 26200. - **Profile:** Series S (720p internal, DLSS upscaling), frame generation off, no ray tracing. Warm pipeline cache. - **Runs:** one save, driving by hand for 3–4 minutes per run on the same stretch of road, with the F3 panel on. Figures are from the 5-second log lines while in the world (frames with 1,000 or more draws). - Routes and traffic differ from run to run, and each build was run once, so differences of about 1 fps are noise. - The `main` run was longer (about 10 minutes) and started at night. | Build | Card "no room" (5-s checks) | Slots held back for room per 5 s (median) | Textures given their levels back | fps all / medium / heavy | Preparing (ms/frame) | |---|---|---|---|---|---| | main (d4b5d51) | 70 % (94/134) | 7,958 | – | 18.9 / 18.3 / 13.8 | 33.9 | | + #1562 | 51 % (26/51) | 13,978 | – | 17.3 / 18.1 / 15.7 | 38.2 | | + #1562 + blurry | 64 % (38/59) | 6,264 | 56 | 17.0 / 17.2 / 15.5 | 38.8 | | + #1562 + #1441 + blurry | 36 % (21/58) | 6,391 | 65 | 17.2 / 18.2 / 16.9 | 37.9 | | **+ #1562 + #1441 + blurry + shrink (this branch)** | **42 % (25/59)** | **181** | **1,188** | 17.9 / 17.9 / 15.9 | 38.2 | - **Last run (this branch):** - 71,877 first uploads made reduced instead of waiting. - 12,667 copies of far textures shrunk, which together had 1,836 MB. - No device removed in this run or the two before it. - **What it looked like:** signs, roads and billboards come in slightly blurry instead of black, and sharpen once there is room. With #1441 the picture was a little sharper than with this change on #1562 alone. - **Frame rate:** about the same in every run. This PC is bound by the submitting thread (the GPU waits for it 15–30 ms a frame), not by textures. - **The two commits alone, on main without #1562 and #1441:** black became blurry (135,057 reduced uploads, no device removed), but the card stayed full (79 % "no room"), nothing got its levels back, and frames were no faster. The room these two need comes from #1441's pooled scratch buffers and #1562's texture pool. - `cargo test -p victory-gpu --lib`: all passed (including a new test: a texture made without its largest levels keeps them out while the card has no room, and gets them back with room). `cargo clippy` finds nothing in the changed lines; it does fail on main already in `victory-shader` (an unused variable and a manual checked division in `emit/lower.rs`). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1562 and #1441 (included here). Also tried and left out: - #1551, #1557 and #1561, on main: pop-in looked worse with them. - #1633, #1637 and #1497, together on top of this branch: preparing went 38 → 45 ms and fps 17.9 → 15.6 on this 7600X. ## Credits - **Mikael Järvinen, #1562:** adaptive texture pool and block-aware eviction. It cut "no room" from 70 % to 51 % here. - **saltdam36, #1441:** pooled scratch buffers for indirect batches. About 1.7 GB less card memory in use mid-drive here, and "no room" down to 36 %. - **`held_only` / `want_level` / `from_base`:** the existing machinery that copies only the levels views show. This change builds on it.
A first upload the card has no room for is made without its largest level or two; its levels come back once the card has room. Array views of one-layer textures are moved to the copy's levels too.
A host list kept the scratch buffers of its busiest recording for good
(`batch_args` was only pushed to). With about 1,500 lists alive that was
12,719 buffers in eight minutes of play on an RX 7800 XT (16 GB) with
VICTORY_INDIRECT_BATCH=1: 3.2 GB of the card by the system's count
(256 KiB a buffer), past its budget, and 200 ms a frame on the card
from there. No counter saw them, so nothing could let them go.

Now a list gives them back when it is reset (every submission of it
has run, and its last recording left them in the common state), and
the next list to batch takes them, as scratch chunks and preludes
already do. 512 are kept; more than that are retired.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KfgN1FfW7f4Zv2hqXUsNr2
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 23:58:46 +00:00
github-bot closed this pull request 2026-11-29 01:29:35 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1759
No description provided.