Textures on a full card: small levels instead of waiting (VICTORY_SMALL_WHEN_FULL) #2493

Manually merged
github merged 1 commit from github-bot/gh-2493 into main 2026-11-30 14:14:47 +00:00 AGit
Owner

@⁠cxchhh on GitHub · 2026-11-29 13:36 UTC · original
cxchhh:pr-small-textures → main · +508 −18 · 4 files · 1 commits · merged 2026-11-30 14:12 UTC

Problem

With the card past the texture queue's line, a texture the title fills that has no host copy yet waits for room, and its slot shows the neutral texture or whatever it showed before. room_for_first_upload lets some of these through just over the line; the rest wait. On an RTX 4070 (12 GB, 4K output, DLSS performance, frame generation 2x), that showed up as white and green faces, black models indoors, and wrong textures in long sessions.

Change

A texture that is not admitted whole now gets a host copy of its small levels only, instead of waiting:

  • make_small: the copy starts at the first level whose console layout fits in VICTORY_SMALL_COPY_KB (256 KiB by default). A single-level texture that small is made whole. Works for placed views (through texture_at) and shader views alike. At most 512 per pass, and only while the card is under 97 % of its budget.
  • grow_small: with room again, or into free texture-pool blocks above 512 MiB, small copies are marked due (64 MB of console layout per pass). The next pass then remakes them with the levels their views ask for, and the slots keep showing the small copy until that upload has run.
  • A texture that already has a host copy is shown from it, and is marked small when the copy lacks levels, so its views don't keep replacing it before there is room.
  • from_base: views count from the first level of their host copy for 2D array views too, and never ask for more levels than the copy has.

VICTORY_SMALL_WHEN_FULL=0 restores the old waiting. The memory line counts the textures made small, the ones that grew, and why a texture was not made small.

Testing

  • cargo test -p victory-gpu --lib: 918 passed, 0 failed. New tests: a_small_copy_keeps_only_the_small_levels and the from_base cases.
    • To compile the test target I temporarily added a type annotation at texture.rs:3491 (wrapping_mul on an ambiguous integer). That error is pre-existing on main and the change is not part of this PR.
  • cargo clippy -p victory-gpu --lib: no new warnings from these lines. victory-shader on main already has three clippy findings.
  • cargo xtask policy: the only violation is the existing one in heap_sites/frame_users.rs.
  • In game:
    • The same small-copy code has been running in my fork (cxchhh/victory-gta6, an older base of this tree) on an RTX 4070. No white, green or black models once the card filled, all 5,276 small copies grew back within the session, and the frame rate was unchanged.
    • On this branch, one short run on the 4070 did not reach the line (8.0 of 9.0 GB), so the path did not trigger there yet. The fallback only applies when room_for_first_upload refuses, so below the line nothing changes.

Note: a separate regression (not addressed here)

While testing, I compared v2026.11.28.03 with v2026.11.29.01 on the same save, standing in the same indoor room, with the same launcher switches (play-foxhound defaults):

  • 11.28.03 renders the room cleanly.
  • 11.29.01 shows large acid-green and magenta glows (an aquarium, a kitchen light, the floor) and more white sparkles.
  • The glows stay with VICTORY_AMBIENT_CHROMA_SCRUB=1, and they also stay with VICTORY_AMBIENT=0. So they are not the light estimate; they come from something in the merge waves between the two releases. Translator changes there (quad reads in divergent flow, the wave64 wave-wide form, the LDS fallback) are the likeliest candidates. I haven't bisected it yet.

🤖 Generated with Claude Code

**@⁠cxchhh** on GitHub · 2026-11-29 13:36 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2493) `cxchhh:pr-small-textures` → `main` · +508 −18 · 4 files · 1 commits · merged 2026-11-30 14:12 UTC ## Problem With the card past the texture queue's line, a texture the title fills that has no host copy yet waits for room, and its slot shows the neutral texture or whatever it showed before. `room_for_first_upload` lets some of these through just over the line; the rest wait. On an RTX 4070 (12 GB, 4K output, DLSS performance, frame generation 2x), that showed up as white and green faces, black models indoors, and wrong textures in long sessions. ## Change A texture that is not admitted whole now gets a host copy of its **small levels only**, instead of waiting: - `make_small`: the copy starts at the first level whose console layout fits in `VICTORY_SMALL_COPY_KB` (256 KiB by default). A single-level texture that small is made whole. Works for placed views (through `texture_at`) and shader views alike. At most 512 per pass, and only while the card is under 97 % of its budget. - `grow_small`: with room again, or into free texture-pool blocks above 512 MiB, small copies are marked due (64 MB of console layout per pass). The next pass then remakes them with the levels their views ask for, and the slots keep showing the small copy until that upload has run. - A texture that already has a host copy is shown from it, and is marked small when the copy lacks levels, so its views don't keep replacing it before there is room. - `from_base`: views count from the first level of their host copy for 2D array views too, and never ask for more levels than the copy has. `VICTORY_SMALL_WHEN_FULL=0` restores the old waiting. The memory line counts the textures made small, the ones that grew, and why a texture was not made small. ## Testing - `cargo test -p victory-gpu --lib`: 918 passed, 0 failed. New tests: `a_small_copy_keeps_only_the_small_levels` and the `from_base` cases. - To compile the test target I temporarily added a type annotation at `texture.rs:3491` (`wrapping_mul` on an ambiguous integer). That error is pre-existing on `main` and the change is not part of this PR. - `cargo clippy -p victory-gpu --lib`: no new warnings from these lines. `victory-shader` on `main` already has three clippy findings. - `cargo xtask policy`: the only violation is the existing one in `heap_sites/frame_users.rs`. - In game: - The same small-copy code has been running in my fork (cxchhh/victory-gta6, an older base of this tree) on an RTX 4070. No white, green or black models once the card filled, all 5,276 small copies grew back within the session, and the frame rate was unchanged. - On this branch, one short run on the 4070 did not reach the line (8.0 of 9.0 GB), so the path did not trigger there yet. The fallback only applies when `room_for_first_upload` refuses, so below the line nothing changes. ## Note: a separate regression (not addressed here) While testing, I compared v2026.11.28.03 with v2026.11.29.01 on the same save, standing in the same indoor room, with the same launcher switches (play-foxhound defaults): - 11.28.03 renders the room cleanly. - 11.29.01 shows large acid-green and magenta glows (an aquarium, a kitchen light, the floor) and more white sparkles. - The glows stay with `VICTORY_AMBIENT_CHROMA_SCRUB=1`, and they also stay with `VICTORY_AMBIENT=0`. So they are not the light estimate; they come from something in the merge waves between the two releases. Translator changes there (quad reads in divergent flow, the wave64 wave-wide form, the LDS fallback) are the likeliest candidates. I haven't bisected it yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
With the card past the texture queue's line, a texture the title fills
that has no host copy yet waits for room, and its slot shows the neutral
texture or what it showed before. First uploads just over the line
(room_for_first_upload) let some through; the rest waited. On an RTX 4070
(12 GB, 4K output, DLSS performance, frame generation 2x) that was white
and green faces, black models indoors and wrong textures in long sessions.

Now a texture not admitted whole gets a host copy of its small levels
only (VICTORY_SMALL_COPY_KB, 256 KiB of console layout by default; a
texture of one level that small is made whole), for placed views
(through texture_at) as for shader views, up to 512 a pass and while the
card is under 97 % of its budget. Its slots show it blurred until it
grows: with room again, or into free texture-pool blocks over 512 MiB,
64 MB of console layout a pass (grow_small), its slots are made due and
the next pass makes the copy with the levels its views ask for.

A texture that has a host copy already is shown from it, marked small
when the copy lacks levels, so its views do not replace it before there
is room. Views count from the first level of their host copy for 2D
array views too, and never ask for more levels than the copy has
(from_base).

VICTORY_SMALL_WHEN_FULL=0 restores waiting. The memory line counts the
textures made small, grown and why one was not made small.

Measured on the RTX 4070 in the author's fork (cxchhh/victory-gta6,
the same small-copy code on an older base of this tree): no white, green
or black models once the card filled; all 5,276 small copies grew within
the session; frame rate unchanged (14.9 fps rendered). victory-gpu's 918
library tests pass, with the new a_small_copy_keeps_only_the_small_levels
and from_base cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 13:39:20 +00:00
Author
Owner

@⁠spook40 on GitHub · 2026-11-29 16:32 UTC · original · edited 2026-11-29 16:36 UTC

Tested this branch on an RTX 3060 Ti (8 GB) / 32 GB RAM / Windows 11 (--res 1080to1440, VICTORY_POOL_SMALL=1, VICTORY_TEXTURE_FIRST_UPLOAD_MB=64) since your 4070 didn't hit the 80% line yet.

On 8 GB in the city, VRAM quickly oversubscribes (7,527 MB used of a 6,933 MB budget), which keeps the card permanently past the 97% cutoff so make_small never fires:

  • textures made from their small levels for want of room (VICTORY_SMALL_WHEN_FULL), since the start: 0
  • not made small: switch off 247371 ... the card past 97 % 1031409

At the same time, VICTORY_SLOT_EVICT evicted 0 textures (19385 not to be taken), shared GPU memory climbed to 8,080 MB, system RAM dropped to 306 MB free (24.5 GB private / 37.4 GB committed), and 102 mesh pipelines failed with 0x8007000E (E_OUTOFMEMORY). Performance sat at 6.7 fps (148.8 ms/frame).

**@⁠spook40** on GitHub · 2026-11-29 16:32 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2493#issuecomment-7258990464) · edited 2026-11-29 16:36 UTC Tested this branch on an **RTX 3060 Ti (8 GB) / 32 GB RAM / Windows 11** (`--res 1080to1440`, `VICTORY_POOL_SMALL=1`, `VICTORY_TEXTURE_FIRST_UPLOAD_MB=64`) since your 4070 didn't hit the 80% line yet. On 8 GB in the city, VRAM quickly oversubscribes (`7,527 MB` used of a `6,933 MB` budget), which keeps the card permanently past the **97% cutoff** so `make_small` never fires: - `textures made from their small levels for want of room (VICTORY_SMALL_WHEN_FULL), since the start: 0` - `not made small: switch off 247371 ... the card past 97 % 1031409` At the same time, `VICTORY_SLOT_EVICT` evicted `0` textures (`19385 not to be taken`), shared GPU memory climbed to `8,080 MB`, system RAM dropped to `306 MB` free (`24.5 GB` private / `37.4 GB` committed), and `102` mesh pipelines failed with `0x8007000E` (`E_OUTOFMEMORY`). Performance sat at `6.7 fps` (`148.8 ms/frame`).
Author
Owner

@⁠Mikey970 on GitHub · 2026-11-30 05:57 UTC · original

Data point in favour of this approach, from a fork that runs the same idea (independently written, VICTORY_SMALL_WHEN_FULL; branch wp/perf-a on Mikey970/VIctory-NVIDIA).

Setup: RTX 4080 16 GB, 32 GB RAM, Series X profile, 1080p rendered to 4K (DLSS), ray tracing off, the 375 s Chapter 1 route (interrogation, therapist, flyover, boat, shore), warm pipeline cache.

  • It fires on a 16 GB card. In one full run 10,901 textures refused for room got a small copy instead of the neutral texture, and 10,852 of them grew back to their full levels once room returned. In the boat cutscene (around 190–221 s) faces, beards and patterned shirts that were flat grey/white before are textured (blurred for a moment) with it.
  • A fixed total is too small. With a 384 MB cap, 102,031 small copies were refused "at their total" in the 16 s after the card first filled (the flyover entry). We now let the total grow with the room actually available — what is alive + free bytes in texture blocks + room up to 95 % of the budget, at most 4× the switch — and that count went to 0 over the same route, with peak card memory about 250 MB higher (15,099 against 14,849 MiB). Worth considering here too.
  • Where the 97 % gate matters: our card sits at 85–90 % of budget when admission refuses (that is where the room line is), so a gate at 97 % would rarely be reached on this card; we gate on "fits in free texture-block bytes, or in use + bytes < budget − 256 MiB" instead.

Happy to turn the adaptive total into a follow-up PR on top of this one if it is wanted.

🤖 Generated with Claude Code

**@⁠Mikey970** on GitHub · 2026-11-30 05:57 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2493#issuecomment-7270172413) Data point in favour of this approach, from a fork that runs the same idea (independently written, `VICTORY_SMALL_WHEN_FULL`; branch `wp/perf-a` on Mikey970/VIctory-NVIDIA). Setup: RTX 4080 16 GB, 32 GB RAM, Series X profile, 1080p rendered to 4K (DLSS), ray tracing off, the 375 s Chapter 1 route (interrogation, therapist, flyover, boat, shore), warm pipeline cache. - **It fires on a 16 GB card.** In one full run 10,901 textures refused for room got a small copy instead of the neutral texture, and 10,852 of them grew back to their full levels once room returned. In the boat cutscene (around 190–221 s) faces, beards and patterned shirts that were flat grey/white before are textured (blurred for a moment) with it. - **A fixed total is too small.** With a 384 MB cap, 102,031 small copies were refused "at their total" in the 16 s after the card first filled (the flyover entry). We now let the total grow with the room actually available — what is alive + free bytes in texture blocks + room up to 95 % of the budget, at most 4× the switch — and that count went to 0 over the same route, with peak card memory about 250 MB higher (15,099 against 14,849 MiB). Worth considering here too. - **Where the 97 % gate matters:** our card sits at 85–90 % of budget when admission refuses (that is where the room line is), so a gate at 97 % would rarely be reached on this card; we gate on "fits in free texture-block bytes, or in use + bytes < budget − 256 MiB" instead. Happy to turn the adaptive total into a follow-up PR on top of this one if it is wanted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠ballsimulation on GitHub · 2026-11-30 10:50 UTC · original

With this PR in a build, the prologue crashes with a host command list did not close (0x80070057) on an RTX 4070 12 GB. Without it, it doesn't.

Setup: RTX 4070 12 GB (driver 32.0.21030.2001), 32 GB RAM with a system-managed pagefile, Windows 11. Series X profile, DLSS Performance, frame generation off, ray tracing off. Diagnostics builds, run by scripts/bench.ps1 from the same save each time: the prologue for 130 s after the world's first frame.

Base: main 41adb551 (v2026.11.29.05) plus #2392, #3474, #3398, #2478, #2591, #2549 and #2305. I took parts out one at a time to find which one crashes:

Build Prologue runs Crashed
base + this PR 2 2 (101 s and 27 s into the world)
base + this PR, #2305 left out 2 2 (16 s and 10 s)
base + this PR, #2305 and #2478 left out 1 1 (16 s)
base, this PR left out (#2305 and #2478 also out) 2 0
base, this PR left out (#2305 and #2478 back in) 1 prologue + 1 five-minute free-roam 0
plain v2026.11.29.05 (none of these PRs) 7 0

Yesterday a branch on 829188e9 that also carried this PR crashed the same way in 3 of the 4 runs that reached the world.

In every crash, the lines just before the error are this PR's situation, a card with no room for textures:

INFO victory_gpu::draw: a texture already on the card is brought up to date although the card has no room for new ones so_far=8500 slot=46764
INFO victory_gpu::draw: a first host texture was admitted just over the room line (black face fix) so_far=3000 slot=74924 bytes=90112
INFO victory_gpu::host: memory now: committed 27730 MB, the card's own 9294 MB in use of a budget of 10362 MB, the PC's shared with the card 7939 MB in use
ERROR victory_gpu::host: a host command list did not close (The parameter is incorrect. (0x80070057)): a command recorded into it was invalid

A guess from reading the change, not confirmed: a small copy is a texture with fewer levels than its title texture. If a copy or a view still names a level the small copy doesn't have, it would be an invalid command, and Close fails exactly like this. The D3D12 debug layer isn't installed on this PC, so I couldn't get the exact command.

The same error also happens without this PR (#2237, #2276; plain v2026.11.29.01 hit it once in my runs yesterday), but far less often here. This PR makes it near certain on this PC.

🤖 Generated with Claude Code

**@⁠ballsimulation** on GitHub · 2026-11-30 10:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2493#issuecomment-7276155409) With this PR in a build, the prologue crashes with `a host command list did not close (0x80070057)` on an RTX 4070 12 GB. Without it, it doesn't. **Setup:** RTX 4070 12 GB (driver 32.0.21030.2001), 32 GB RAM with a system-managed pagefile, Windows 11. Series X profile, DLSS Performance, frame generation off, ray tracing off. Diagnostics builds, run by `scripts/bench.ps1` from the same save each time: the prologue for 130 s after the world's first frame. **Base:** main `41adb551` (v2026.11.29.05) plus #2392, #3474, #3398, #2478, #2591, #2549 and #2305. I took parts out one at a time to find which one crashes: | Build | Prologue runs | Crashed | |---|---|---| | base + this PR | 2 | 2 (101 s and 27 s into the world) | | base + this PR, #2305 left out | 2 | 2 (16 s and 10 s) | | base + this PR, #2305 and #2478 left out | 1 | 1 (16 s) | | base, this PR left out (#2305 and #2478 also out) | 2 | 0 | | base, this PR left out (#2305 and #2478 back in) | 1 prologue + 1 five-minute free-roam | 0 | | plain v2026.11.29.05 (none of these PRs) | 7 | 0 | Yesterday a branch on `829188e9` that also carried this PR crashed the same way in 3 of the 4 runs that reached the world. In every crash, the lines just before the error are this PR's situation, a card with no room for textures: ``` INFO victory_gpu::draw: a texture already on the card is brought up to date although the card has no room for new ones so_far=8500 slot=46764 INFO victory_gpu::draw: a first host texture was admitted just over the room line (black face fix) so_far=3000 slot=74924 bytes=90112 INFO victory_gpu::host: memory now: committed 27730 MB, the card's own 9294 MB in use of a budget of 10362 MB, the PC's shared with the card 7939 MB in use ERROR victory_gpu::host: a host command list did not close (The parameter is incorrect. (0x80070057)): a command recorded into it was invalid ``` A guess from reading the change, not confirmed: a small copy is a texture with fewer levels than its title texture. If a copy or a view still names a level the small copy doesn't have, it would be an invalid command, and `Close` fails exactly like this. The D3D12 debug layer isn't installed on this PC, so I couldn't get the exact command. The same error also happens without this PR (#2237, #2276; plain v2026.11.29.01 hit it once in my runs yesterday), but far less often here. This PR makes it near certain on this PC. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github manually merged commit 52bce79156 into main 2026-11-30 14:14:47 +00:00
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!2493
No description provided.