Textures: add an opt-in maximum dimension (VICTORY_TEXTURE_MAX_DIM) #63

Merged
Evan-Lowry merged 1 commit from upstream-pr/63 into beta 2026-11-26 09:58:03 +00:00
Evan-Lowry commented 2026-11-26 05:43:00 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by Evan-Lowry on 2026-11-26T05:43:00Z.


Summary

Add an opt-in VICTORY_TEXTURE_MAX_DIM limit for eligible sampled, block-compressed placed textures. The host uses an existing smaller mip chain and remaps shader views and uploads to match. Unset or 0 leaves the cap off. Diagnostics report cap savings and, with VICTORY_VRAM_TEXTURE_CENSUS=1, texture allocation buckets.

Measurements

RX 6800, 16 GB RAM; same gameplay scene, moving camera, ABBA-style comparisons. No game assets are included.

Maximum dimension Private memory Local VRAM Capped textures
Off 22.4–22.5 GB 11.3–11.4 GB 0
512 18.2–18.5 GB 7.1 GB 3,900
1024 20.4 GB 9.4 GB 753
256 17.3 GB — —

At 256 the frame pacing got worse (p95 1183 ms vs 383 ms at 512 with VICTORY_STAGING_BUDGET_MB=384), so 512 looks like the practical floor on a 16 GB PC.

The cap makes textures softer. Observed lettering, posters and walls retained correct materials, with no dark, grey or wrong materials. Frame times were noisy on the paging-bound PC, with no consistent regression.

Validated on this branch itself (current beta + this commit, same PC, camera moving; this build's first runs start from a fresh shader cache, so they reach the cell later and frame times aren't comparable to the table above):

VICTORY_TEXTURE_MAX_DIM Private median / peak System commit median
0 21.4 / 22.3 GB 50.5 GB
512 18.7 / 18.9 GB 46.6 GB

Screenshots in the cell show correct materials with the cap. They're softer, with no dark or wrong textures.

Test plan

  • Release build of victory, with and without diagnostics.
  • victory-gpu tests on D3D12 WARP, excluding depth_bounds_pipeline_loads_and_filters_draws; run the cap-specific WARP test with VICTORY_TEXTURE_MAX_DIM=512.
  • Clippy for the touched crate, including diagnostics: strict runs report existing dead-code and unnecessary_sort_by warnings in unrelated code; both configurations pass with those two lint categories allowed.

🤖 Generated with Claude Code

<!-- greyfinch-sync:PastiiJay/klbf-lab:issue:6620361068 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/63). Originally posted by [Evan-Lowry](https://github.com/Evan-Lowry) on 2026-11-26T05:43:00Z. --- ## Summary Add an opt-in `VICTORY_TEXTURE_MAX_DIM` limit for eligible sampled, block-compressed placed textures. The host uses an existing smaller mip chain and remaps shader views and uploads to match. Unset or `0` leaves the cap off. Diagnostics report cap savings and, with `VICTORY_VRAM_TEXTURE_CENSUS=1`, texture allocation buckets. ## Measurements RX 6800, 16 GB RAM; same gameplay scene, moving camera, ABBA-style comparisons. No game assets are included. | Maximum dimension | Private memory | Local VRAM | Capped textures | | --- | --- | --- | --- | | Off | 22.4–22.5 GB | 11.3–11.4 GB | 0 | | 512 | 18.2–18.5 GB | 7.1 GB | 3,900 | | 1024 | 20.4 GB | 9.4 GB | 753 | | 256 | 17.3 GB | — | — | At 256 the frame pacing got worse (p95 1183 ms vs 383 ms at 512 with `VICTORY_STAGING_BUDGET_MB=384`), so 512 looks like the practical floor on a 16 GB PC. The cap makes textures softer. Observed lettering, posters and walls retained correct materials, with no dark, grey or wrong materials. Frame times were noisy on the paging-bound PC, with no consistent regression. Validated on this branch itself (current beta + this commit, same PC, camera moving; this build's first runs start from a fresh shader cache, so they reach the cell later and frame times aren't comparable to the table above): | `VICTORY_TEXTURE_MAX_DIM` | Private median / peak | System commit median | | --- | --- | --- | | 0 | 21.4 / 22.3 GB | 50.5 GB | | 512 | 18.7 / 18.9 GB | 46.6 GB | Screenshots in the cell show correct materials with the cap. They're softer, with no dark or wrong textures. ## Test plan - Release build of `victory`, with and without `diagnostics`. - `victory-gpu` tests on D3D12 WARP, excluding `depth_bounds_pipeline_loads_and_filters_draws`; run the cap-specific WARP test with `VICTORY_TEXTURE_MAX_DIM=512`. - Clippy for the touched crate, including diagnostics: strict runs report existing dead-code and `unnecessary_sort_by` warnings in unrelated code; both configurations pass with those two lint categories allowed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PastiiJay commented 2026-11-26 05:43:41 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-26T05:43:41Z.


Thanks @Evan-Lowry, a clear opt-in with real numbers on a 16 GB PC. We'll try 512 on our RX 9070 XT and report here.

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7183750594 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/63#issuecomment-7183750594). Originally posted by [PastiiJay](https://github.com/PastiiJay) on 2026-11-26T05:43:41Z. --- Thanks @Evan-Lowry, a clear opt-in with real numbers on a 16 GB PC. We'll try 512 on our RX 9070 XT and report here.
HandshakeHackin commented 2026-11-26 05:54:54 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by HandshakeHackin on 2026-11-26T05:54:54Z.


I tested 56d62d0 on Windows WARP using a synthetic 768×512 BC1 texture with four mip levels. Each row and level had a distinct byte pattern. With the cap off, I compared all 261,120 active bytes across four staged levels. With VICTORY_TEXTURE_MAX_DIM=256, I compared all 15,360 active bytes in the two retained levels, including rows with padding in the host footprint. Both runs matched the original title mip data byte for byte. This checks staging and mip offsets; in-game VRAM and frame pacing remain for the hardware comparison. Reproducible fixture and results

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7183919578 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/63#issuecomment-7183919578). Originally posted by [HandshakeHackin](https://github.com/HandshakeHackin) on 2026-11-26T05:54:54Z. --- I tested `56d62d0` on Windows WARP using a synthetic 768×512 BC1 texture with four mip levels. Each row and level had a distinct byte pattern. With the cap off, I compared all 261,120 active bytes across four staged levels. With `VICTORY_TEXTURE_MAX_DIM=256`, I compared all 15,360 active bytes in the two retained levels, including rows with padding in the host footprint. Both runs matched the original title mip data byte for byte. This checks staging and mip offsets; in-game VRAM and frame pacing remain for the hardware comparison. [Reproducible fixture and results](https://github.com/HandshakeHackin/klbf-lab/actions/runs/45764302258/job/139721392506)
PastiiJay commented 2026-11-26 06:05:29 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-26T06:05:29Z.


Result on our RX 9070 XT (16 GB, Windows 11, Series S mode, same scene, current beta + this PR, 5 min per run, dedicated VRAM sampled every 10 s after the first minute):

VICTORY_TEXTURE_MAX_DIM Dedicated VRAM median (max) Private RAM
unset 10,609 MB (10,795) 22,919 MB
512 8,269 MB (8,375) 21,015 MB

So about 2.3 GB less VRAM (-22%) and 1.9 GB less RAM. The log shows limiting the host size of sampled placed BC textures max_dim=512, no crash. Room fps: 7.5 without, 8.0 and 6.4 with (two passes), no clear difference beyond this build's usual run-to-run spread.

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7184083474 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/63#issuecomment-7184083474). Originally posted by [PastiiJay](https://github.com/PastiiJay) on 2026-11-26T06:05:29Z. --- Result on our RX 9070 XT (16 GB, Windows 11, Series S mode, same scene, current beta + this PR, 5 min per run, dedicated VRAM sampled every 10 s after the first minute): | `VICTORY_TEXTURE_MAX_DIM` | Dedicated VRAM median (max) | Private RAM | | --- | --- | --- | | unset | 10,609 MB (10,795) | 22,919 MB | | 512 | 8,269 MB (8,375) | 21,015 MB | So about 2.3 GB less VRAM (-22%) and 1.9 GB less RAM. The log shows `limiting the host size of sampled placed BC textures max_dim=512`, no crash. Room fps: 7.5 without, 8.0 and 6.4 with (two passes), no clear difference beyond this build's usual run-to-run spread.
PastiiJay commented 2026-11-26 09:58:30 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-11-26T09:58:30Z.


Merged, thanks @Evan-Lowry. It saved about 2 GB of VRAM on our RX 9070 XT.

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7188733560 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/63#issuecomment-7188733560). Originally posted by [PastiiJay](https://github.com/PastiiJay) on 2026-11-26T09:58:30Z. --- Merged, thanks @Evan-Lowry. It saved about 2 GB of VRAM on our RX 9070 XT.
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
PastiiJay/klbf-lab!63
No description provided.