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

Merged
tikD1337 merged 1 commit from upstream-pr/1543 into main 2026-11-29 08:16:55 +00:00
tikD1337 commented 2026-11-28 21:26:35 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tikD1337 on 2026-11-28T21:26:35Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5544727950 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1543). Originally posted by [tikD1337](https://github.com/tikD1337) on 2026-11-28T21:26:35Z. --- ## 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)
pickles976 commented 2026-11-29 07:41:58 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by pickles976 on 2026-11-29T07:41:58Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7252634948 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1543#issuecomment-7252634948). Originally posted by [pickles976](https://github.com/pickles976) on 2026-11-29T07:41:58Z. --- 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.
pickles976 commented 2026-11-29 07:57:59 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by pickles976 on 2026-11-29T07:57:59Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7252799819 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1543#issuecomment-7252799819). Originally posted by [pickles976](https://github.com/pickles976) on 2026-11-29T07:57:59Z. --- 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.
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
trustno1-coder/VIctory-NVIDIA!1543
No description provided.