GPU: small textures are cut from texture blocks of their own #1543

Manually merged
github merged 1 commit from github-bot/gh-1543 into main 2026-11-29 08:20:40 +00:00 AGit
Owner

@⁠tikD1337 on GitHub · 2026-11-28 21:26 UTC · original
tikD1337:tik/small-texture-pool → main · +54 −15 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC

Summary

With VICTORY_POOL_SMALL=1, textures that may lie at multiples of 4 KiB were cut from the same pool blocks as textures at multiples of 64 KiB. On an RTX 4070 Ti SUPER (Series S profile) the walls of the house in the prologue were black from their first frame, on every run, with nothing in the log.

This gives the small textures a pool of their own (SMALL beside TEXTURES):

  • room() reclaims both pools; texture_room() and the memory line count both;
  • a released piece goes back to the pool it came from (Reclaim::to, which main already carries);
  • VICTORY_POOL_SMALL_APART=0 restores the old behaviour (same blocks).

Without VICTORY_POOL_SMALL=1 nothing changes: no texture is placed at 4 KiB, so nothing goes to the new pool.

Related: #1491 turns VICTORY_POOL_SMALL on in the launcher. On this card, that switch on its own gives the black walls described here.

Why separate blocks

To find the cause I wrote a probe (not part of this PR): it placed ten kinds of the title's small textures side by side at 4 KiB in one heap on the card, eight of a kind and one of each, and read them back. All of them kept their own bytes, so 4 KiB placement as such is fine on this card. What was left was a small texture sharing a 64 KiB stretch of a block with a 64 KiB-aligned texture. With the two kinds kept apart, the walls were correct on every run.

Before / after

Same build, same save and settings, Series S, run to the prison and 60 s past it:

POOL_SMALL=0 POOL_SMALL=1, same blocks POOL_SMALL=1, this PR
House walls ok black ok
Prison, faces ok ok ok
VRAM use, max 12.5 GB - 10.1 GB
Process private bytes, max 27.2 GB - 24.7 GB
Frame rate in the prison 21.1 fps - 21.3 fps

The VRAM and private-bytes figures come from a build that also had the soft texture budget (I'll send that as a separate PR). The difference between the last two columns is this change alone. No device loss or driver event in any of these runs.

Test plan

  • cargo test --release --locked -p victory-gpu: 551 passed
  • cargo test --profile diag --locked -p victory-gpu --features diagnostics: 605 passed
  • new unit test small_textures_are_cut_from_blocks_of_their_own
  • cargo clippy gives no new findings in pool.rs
  • played on RTX 4070 Ti SUPER, driver 621.01, Ryzen 5 7600, 32 GB, Windows 11: prologue house, prison, open world

AI-assisted: the investigation, the code and this description were written with Claude Code; the runs were played on the setup above.

Labels: pr-fix, rendering, memory, NVIDIA, series-s

🤖 Generated with Claude Code

**@⁠tikD1337** on GitHub · 2026-11-28 21:26 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1543) `tikD1337:tik/small-texture-pool` → `main` · +54 −15 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC ## Summary With `VICTORY_POOL_SMALL=1`, textures that may lie at multiples of 4 KiB were cut from the same pool blocks as textures at multiples of 64 KiB. On an RTX 4070 Ti SUPER (Series S profile) the walls of the house in the prologue were black from their first frame, on every run, with nothing in the log. This gives the small textures a pool of their own (`SMALL` beside `TEXTURES`): - `room()` reclaims both pools; `texture_room()` and the memory line count both; - a released piece goes back to the pool it came from (`Reclaim::to`, which main already carries); - `VICTORY_POOL_SMALL_APART=0` restores the old behaviour (same blocks). Without `VICTORY_POOL_SMALL=1` nothing changes: no texture is placed at 4 KiB, so nothing goes to the new pool. Related: #1491 turns `VICTORY_POOL_SMALL` on in the launcher. On this card, that switch on its own gives the black walls described here. ## Why separate blocks To find the cause I wrote a probe (not part of this PR): it placed ten kinds of the title's small textures side by side at 4 KiB in one heap on the card, eight of a kind and one of each, and read them back. All of them kept their own bytes, so 4 KiB placement as such is fine on this card. What was left was a small texture sharing a 64 KiB stretch of a block with a 64 KiB-aligned texture. With the two kinds kept apart, the walls were correct on every run. ## Before / after Same build, same save and settings, Series S, run to the prison and 60 s past it: | | `POOL_SMALL=0` | `POOL_SMALL=1`, same blocks | `POOL_SMALL=1`, this PR | |---|---|---|---| | House walls | ok | **black** | ok | | Prison, faces | ok | ok | ok | | VRAM use, max | 12.5 GB | - | **10.1 GB** | | Process private bytes, max | 27.2 GB | - | 24.7 GB | | Frame rate in the prison | 21.1 fps | - | 21.3 fps | The VRAM and private-bytes figures come from a build that also had the soft texture budget (I'll send that as a separate PR). The difference between the last two columns is this change alone. No device loss or driver event in any of these runs. ## Test plan - [x] `cargo test --release --locked -p victory-gpu`: 551 passed - [x] `cargo test --profile diag --locked -p victory-gpu --features diagnostics`: 605 passed - [x] new unit test `small_textures_are_cut_from_blocks_of_their_own` - [x] `cargo clippy` gives no new findings in `pool.rs` - [x] played on RTX 4070 Ti SUPER, driver 621.01, Ryzen 5 7600, 32 GB, Windows 11: prologue house, prison, open world AI-assisted: the investigation, the code and this description were written with Claude Code; the runs were played on the setup above. Labels: `pr-fix`, `rendering`, `memory`, `NVIDIA`, `series-s` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
With VICTORY_POOL_SMALL=1 the textures that may lie at multiples of 4 KiB
were cut from the same blocks as those at multiples of 64 KiB. On an RTX
4070 Ti SUPER (driver 621.01, Series S) that made the walls of the house in
the prologue black from their first frame, every time, with nothing in the
log. A probe on the card placed ten kinds of the title's small textures side
by side at 4 KiB, eight of a kind and one of each, and all kept their own
bytes: what is left is a small texture in the same 64 KiB of a block as a
texture of 64 KiB multiples (the card maps a block's memory in pages of one
size or the other).

The small ones now come from a pool of their own (SMALL beside TEXTURES):
room() reclaims both, texture_room() and the memory line count both, and a
released piece goes back to the pool it came from (Reclaim::to). With it the
walls, the prison and the faces were clean, and the saving of the switch
stayed: the card's use at most 10.1 GB against 12.5 GB with the switch off.
VICTORY_POOL_SMALL_APART=0 cuts them from the same blocks, as before.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 21:31:00 +00:00
github-bot changed title from [pr-fix][rendering][memory][series-s] GPU: small textures are cut from texture blocks of their own to GPU: small textures are cut from texture blocks of their own 2026-11-28 21:37:35 +00:00
Author
Owner

@⁠pickles976 on GitHub · 2026-11-29 07:41 UTC · original

Adapted f590af8b93 onto our older Wine performance branch, retaining its configurable block size and original retirement/submission-age rules: github.com/pickles976/VIctory-NVIDIA@fb92449bd3 . This is not an exact-head test. The adaptation also combines both pools in the existing census.

Wine 11 / Linux 6.17 / RTX 4060 Laptop 8 GiB / NVIDIA 590.48.1 / stock app-local vkd3d 2576c0b4adfae4a, raw-access chains disabled as in our title configuration. Fresh intended-tree build17.86s. Fourteen pool ownership/copy tests pass (0 ignored, 0.81s), including original-pool COM release, live/resting reuse exclusion and full texture updates.

A separate strict physical-NVIDIA test passes1/1 in0.66s: production texture/staging allocation, actual 4 KiB native alignment and non-64-KiB small offset, distinct small/ordinary native heaps, two256x256 BC1 textures with7mips, native-footprint uploads, and14 finite HLSL Texture2D.Load dispatches. All349504 packed RGBA texel results match across two rounds; rewriting only the first texture preserves every neighboring texel. Final HELD/LIVE and each pool’s free/resting ownership return correctly. The large64-KiB-aligned texture is allocated for heap-separation proof, not sampled. No physical GPU stall, original-title shader execution, concurrent descriptor-publication certification or title memory/FPS result claimed.

The initial compile-only attempt had a local fixture reference-comparison typo, corrected before these runs. Existing play defaults remain unchanged pending a guarded title observation with small placement and separation enabled together; all resource guards remain.

Local evidence: verify-nvidia-small-pool-build-fixed-20261129T073838Z, verify-nvidia-small-pool-lifetime-stock-20261129T073936Z, verify-nvidia-small-pool-mips-stock-20261129T073938Z. Fixture source is in the linked commit; no assets or game imagery published.

**@⁠pickles976** on GitHub · 2026-11-29 07:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1543#issuecomment-7252634948) Adapted f590af8b933b6dca2946cee6bd2e7fce36b7350d onto our older Wine performance branch, retaining its configurable block size and original retirement/submission-age rules: https://github.com/pickles976/VIctory-NVIDIA/commit/fb92449bd340ba8b794d9ad7458c56b7ff8b5b82 . This is not an exact-head test. The adaptation also combines both pools in the existing census. Wine 11 / Linux 6.17 / RTX 4060 Laptop 8 GiB / NVIDIA 590.48.1 / stock app-local vkd3d 2576c0b4adfae4a, raw-access chains disabled as in our title configuration. Fresh intended-tree build17.86s. Fourteen pool ownership/copy tests pass (0 ignored, 0.81s), including original-pool COM release, live/resting reuse exclusion and full texture updates. A separate strict physical-NVIDIA test passes1/1 in0.66s: production texture/staging allocation, actual 4 KiB native alignment and non-64-KiB small offset, distinct small/ordinary native heaps, two256x256 BC1 textures with7mips, native-footprint uploads, and14 finite HLSL Texture2D.Load dispatches. All349504 packed RGBA texel results match across two rounds; rewriting only the first texture preserves every neighboring texel. Final HELD/LIVE and each pool’s free/resting ownership return correctly. The large64-KiB-aligned texture is allocated for heap-separation proof, not sampled. No physical GPU stall, original-title shader execution, concurrent descriptor-publication certification or title memory/FPS result claimed. The initial compile-only attempt had a local fixture reference-comparison typo, corrected before these runs. Existing play defaults remain unchanged pending a guarded title observation with small placement and separation enabled together; all resource guards remain. Local evidence: verify-nvidia-small-pool-build-fixed-20261129T073838Z, verify-nvidia-small-pool-lifetime-stock-20261129T073936Z, verify-nvidia-small-pool-mips-stock-20261129T073938Z. Fixture source is in the linked commit; no assets or game imagery published.
Author
Owner

@⁠pickles976 on GitHub · 2026-11-29 07:57 UTC · original

Changed-title follow-through on the disclosed adaptation is incomplete, not a rendering verdict. The 30 s startup showed the picker with no kernel fault. The later loading trial stopped at ~99 s on our unchanged 2 s native-NVML deadline, before any high-draw report. The independent native observer also took 3670 ms across that interval, so this is not merely nvidia-smi process-start overhead.

A 379362704-byte submission-upload allocation began at07:45:41.018312Z and had no return log before termination. During the overlap the submission thread was sampled in mempool_alloc_noprof then rq_qos_wait; telemetry waited in os_acquire_rwlock_read. This does not prove the native lock writer, allocation result, or that pool isolation caused it. The same deadline class had occurred on an earlier build without this port. No Xid was observed; an ioctl-copy error followed scope kill. Scope peak9GiB/max317/oom0; last successful guard GPU4079MiB/RAM available4757MiB. All safety limits retained, no unchanged retry.

Last completed pool census before the stop:25122textures/1319MiB held,22×64MiB blocks/85MiB free/2MiB resting/0empty. This is not a matched-stage saving or proof of correct world rendering. The offscreen sampling/lifetime passes above remain valid. Next separate gate is retired-upload reuse for the large native allocation, not relaxing telemetry deadlines. Local evidence nvidia-fork-trial-20261129T074407Z/{verified-summary,allocation-wait-window,backing-cleanup}.json; identified stopped backing cleanup completed.

**@⁠pickles976** on GitHub · 2026-11-29 07:57 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1543#issuecomment-7252799819) Changed-title follow-through on the disclosed adaptation is incomplete, not a rendering verdict. The 30 s startup showed the picker with no kernel fault. The later loading trial stopped at ~99 s on our unchanged 2 s native-NVML deadline, before any high-draw report. The independent native observer also took 3670 ms across that interval, so this is not merely nvidia-smi process-start overhead. A 379362704-byte submission-upload allocation began at07:45:41.018312Z and had no return log before termination. During the overlap the submission thread was sampled in mempool_alloc_noprof then rq_qos_wait; telemetry waited in os_acquire_rwlock_read. This does not prove the native lock writer, allocation result, or that pool isolation caused it. The same deadline class had occurred on an earlier build without this port. No Xid was observed; an ioctl-copy error followed scope kill. Scope peak9GiB/max317/oom0; last successful guard GPU4079MiB/RAM available4757MiB. All safety limits retained, no unchanged retry. Last completed pool census before the stop:25122textures/1319MiB held,22×64MiB blocks/85MiB free/2MiB resting/0empty. This is not a matched-stage saving or proof of correct world rendering. The offscreen sampling/lifetime passes above remain valid. Next separate gate is retired-upload reuse for the large native allocation, not relaxing telemetry deadlines. Local evidence nvidia-fork-trial-20261129T074407Z/{verified-summary,allocation-wait-window,backing-cleanup}.json; identified stopped backing cleanup completed.
github manually merged commit bbaf9932ed into main 2026-11-29 08:20:40 +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!1543
No description provided.