Texture blocks: the textures of the emptiest ones made again elsewhere (VICTORY_REPACK, off) #556

Open
voiceovarian1-max wants to merge 1 commit from upstream-pr/556 into main
voiceovarian1-max commented 2026-12-03 09:45:14 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by voiceovarian1-max on 2026-12-03T09:45:14Z.


A texture block goes back to the card only when no texture is left in it, and
textures of every age end up in every block: on a 12 GB card 0.6-1.0 GB stood
free in holes of a few MB within five minutes, while textures went to the PC's
memory for want of room.

With VICTORY_REPACK=1 the emptiest blocks under half full are marked draining
(two at a time, while the free part of the blocks is 256 MiB or more and the
other blocks could hold what they hold): nothing new is cut from them, the host
copies of the title textures in them are made again elsewhere the way
grow_small replaces one (uploaded from title memory at the next texture pass,
the slots showing the old copy until then), and a drained block goes back to the
card at once. Each title texture's block is noted when its host copy is made,
so a pass looks only at the textures of the draining blocks; a first version
that scanned every title texture each pass cost about 10 fps. Textures whose
content the host's shaders or copies wrote, and those made small for want of
room, are left where they are. A draining block that holds no fewer bytes for 15 s
(such a texture lies in it) is given up: it takes new pieces again and is never
marked again (the first version kept two such blocks marked for good, and
repacking stopped about two minutes in).

Measured on a 12 GB RTX card with the same change on a local build of this base
(window scene, 300 s, walking out of the cell from 70 s, two runs each,
alternating): 45.2 / 44.6 fps without, 45.1 / 44.2 with; textures made in the
PC's memory for want of room 1,000+ a run without, 1 with; 180-300 MB fewer
holes; the card's memory in use unchanged (the texture queue fills to its line).

Tests: pool::tests::a_draining_block_takes_nothing_new_and_goes_back_once_empty,
a_draining_block_that_stops_emptying_is_given_up, block_of checks in
a_texture_gives_its_piece_back_when_it_goes.

What is in it

  • crates/victory-gpu/src/draw.rs | 9 ++
  • crates/victory-gpu/src/pool.rs | 241 ++++++++++++++++++++++++++++++++++++-
  • crates/victory-gpu/src/resource.rs | 106 ++++++++++++++++

Tested

  • RTX 4070 Ti 12 GB (driver 617.14), i7-14700K, 32 GB, Windows 11 Pro 26300; release.
  • cargo test -p victory-gpu --lib -- pool:: resource::: 41 passed, 0 failed.
  • cargo check --workspace --tests --locked on main 7dbcdcb: no errors, no warnings.
  • The game numbers above are from the same change on a local build of this base. On main itself: only in one combined build with other PRs (results to follow here before this leaves draft).

Not tested

  • AMD and Intel cards; the Series X profile; play longer than five minutes.

AI use

Claude Code with Claude Opus 5.5 wrote the change and its tests (two sessions: one wrote the repacking, one found and fixed the stalled drain from the first version's logs) and this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:readmet3xt-lab/foxhound:issue:5623955315 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/556). Originally posted by [voiceovarian1-max](https://github.com/voiceovarian1-max) on 2026-12-03T09:45:14Z. --- A texture block goes back to the card only when no texture is left in it, and textures of every age end up in every block: on a 12 GB card 0.6-1.0 GB stood free in holes of a few MB within five minutes, while textures went to the PC's memory for want of room. With VICTORY_REPACK=1 the emptiest blocks under half full are marked draining (two at a time, while the free part of the blocks is 256 MiB or more and the other blocks could hold what they hold): nothing new is cut from them, the host copies of the title textures in them are made again elsewhere the way grow_small replaces one (uploaded from title memory at the next texture pass, the slots showing the old copy until then), and a drained block goes back to the card at once. Each title texture's block is noted when its host copy is made, so a pass looks only at the textures of the draining blocks; a first version that scanned every title texture each pass cost about 10 fps. Textures whose content the host's shaders or copies wrote, and those made small for want of room, are left where they are. A draining block that holds no fewer bytes for 15 s (such a texture lies in it) is given up: it takes new pieces again and is never marked again (the first version kept two such blocks marked for good, and repacking stopped about two minutes in). Measured on a 12 GB RTX card with the same change on a local build of this base (window scene, 300 s, walking out of the cell from 70 s, two runs each, alternating): 45.2 / 44.6 fps without, 45.1 / 44.2 with; textures made in the PC's memory for want of room 1,000+ a run without, 1 with; 180-300 MB fewer holes; the card's memory in use unchanged (the texture queue fills to its line). Tests: pool::tests::a_draining_block_takes_nothing_new_and_goes_back_once_empty, a_draining_block_that_stops_emptying_is_given_up, block_of checks in a_texture_gives_its_piece_back_when_it_goes. **What is in it** - `crates/victory-gpu/src/draw.rs` | 9 ++ - `crates/victory-gpu/src/pool.rs` | 241 ++++++++++++++++++++++++++++++++++++- - `crates/victory-gpu/src/resource.rs` | 106 ++++++++++++++++ **Tested** - RTX 4070 Ti 12 GB (driver 617.14), i7-14700K, 32 GB, Windows 11 Pro 26300; release. - `cargo test -p victory-gpu --lib -- pool:: resource::`: 41 passed, 0 failed. - `cargo check --workspace --tests --locked` on `main` 7dbcdcb: no errors, no warnings. - The game numbers above are from the same change on a local build of this base. On `main` itself: only in one combined build with other PRs (results to follow here before this leaves draft). **Not tested** - AMD and Intel cards; the Series X profile; play longer than five minutes. **AI use** Claude Code with Claude Opus 5.5 wrote the change and its tests (two sessions: one wrote the repacking, one found and fixed the stalled drain from the first version's logs) and this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
voiceovarian1-max commented 2026-12-03 10:04:29 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by voiceovarian1-max on 2026-12-03T10:04:29Z.


Combined test of this PR with #521, #543 and #544-#556, all merged onto main 7dbcdcb (branch fox-all of voiceovarian1-max/foxhound):

  • RTX 4070 Ti 12 GB (driver 617.14), i7-14700K, 32 GB, Windows 11 Pro 26300; release.
  • cargo test --workspace --locked -- --test-threads=4: 1,415 passed, 0 failed, 50 ignored (29 binaries), no SKIPPED.
  • Retail title, Series S profile, DLSS Balanced, 60 fps limit, keys pressed by the layer only (VICTORY_KEYS, no input from the PC): window scene 38-42 fps against 34-37 for main on the same boot; no device removal, no crash; a burst of 67 pictures showed no one-picture flicker of the character's clothes.
  • Not tested: each PR alone in the game; AMD and Intel; the Series X profile; long play.

Tested by Claude Code with Claude Opus 5.5 on the hardware named.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7374695591 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/556#issuecomment-7374695591). Originally posted by [voiceovarian1-max](https://github.com/voiceovarian1-max) on 2026-12-03T10:04:29Z. --- Combined test of this PR with #521, #543 and #544-#556, all merged onto `main` 7dbcdcb (branch fox-all of voiceovarian1-max/foxhound): - RTX 4070 Ti 12 GB (driver 617.14), i7-14700K, 32 GB, Windows 11 Pro 26300; release. - `cargo test --workspace --locked -- --test-threads=4`: 1,415 passed, 0 failed, 50 ignored (29 binaries), no `SKIPPED`. - Retail title, Series S profile, DLSS Balanced, 60 fps limit, keys pressed by the layer only (`VICTORY_KEYS`, no input from the PC): window scene 38-42 fps against 34-37 for `main` on the same boot; no device removal, no crash; a burst of 67 pictures showed no one-picture flicker of the character's clothes. - Not tested: each PR alone in the game; AMD and Intel; the Series X profile; long play. Tested by Claude Code with Claude Opus 5.5 on the hardware named.
tillo88 commented 2026-12-04 03:40:59 +00:00 (Migrated from github.com)

Imported from readmet3xt-lab/foxhound. Originally posted by tillo88 on 2026-12-04T03:40:59Z.


Replay-bench measurement on v0.8.3.5 with VICTORY_REPACK=1: no measurable fps difference

Measured: PR head f4ae795 merged onto release v0.8.3.5 (5e44415), with VICTORY_REPACK=1 set (off by default in the PR), 2 measured runs (after a warm-up run that is not counted), against 7 runs of v0.8.3.5 without the PR, same route (~6.5 min).

run fps CPU prep ms median ms p95 ms p99 ms frames > 100 ms
release, mean of 7 (range) 36.88 (36.45-37.24) 18.85 (18.34-19.38) 28.21 (27.80-28.70) 38.66 (38.14-39.23) 45.70 (44.78-46.46) 14.7 (12-17)
PR #556 run 1 36.94 18.10 28.00 38.73 45.23 11
PR #556 run 2 36.95 18.14 28.50 38.87 45.97 10

Mean fps: release 36.88, PR 36.95 (+0.2%): no measurable difference. CPU prep was below every release run in both PR runs (18.10 / 18.14 ms against 18.34-19.38), about 0.7 ms under the release mean, and frames over 100 ms were 11 and 10, below the release's 12-17. Frame-time percentiles are inside the release's range. With 2 runs these are observations, not results; the bench does not measure texture-memory fragmentation or how much the repack moved.

Crashes: none in the PR runs and none in the release runs (no host GPU failure, no device lost).

Config: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 32 GB, Windows 11; default play-foxhound.ps1 settings (Series X profile, 1440p, DLSS balanced, no frame generation), fullscreen, no frame cap.

Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.

<!-- greyfinch-sync:readmet3xt-lab/foxhound:comment:7400338638 --> Imported from [readmet3xt-lab/foxhound](https://github.com/readmet3xt-lab/foxhound/pull/556#issuecomment-7400338638). Originally posted by [tillo88](https://github.com/tillo88) on 2026-12-04T03:40:59Z. --- **Replay-bench measurement on v0.8.3.5 with `VICTORY_REPACK=1`: no measurable fps difference** Measured: PR head `f4ae795` merged onto release **v0.8.3.5** (`5e44415`), with `VICTORY_REPACK=1` set (off by default in the PR), 2 measured runs (after a warm-up run that is not counted), against 7 runs of v0.8.3.5 without the PR, same route (~6.5 min). | run | fps | CPU prep ms | median ms | p95 ms | p99 ms | frames > 100 ms | |---|---|---|---|---|---|---| | release, mean of 7 (range) | 36.88 (36.45-37.24) | 18.85 (18.34-19.38) | 28.21 (27.80-28.70) | 38.66 (38.14-39.23) | 45.70 (44.78-46.46) | 14.7 (12-17) | | PR #556 run 1 | 36.94 | 18.10 | 28.00 | 38.73 | 45.23 | 11 | | PR #556 run 2 | 36.95 | 18.14 | 28.50 | 38.87 | 45.97 | 10 | Mean fps: release 36.88, PR 36.95 (+0.2%): **no measurable difference**. CPU prep was below every release run in both PR runs (18.10 / 18.14 ms against 18.34-19.38), about 0.7 ms under the release mean, and frames over 100 ms were 11 and 10, below the release's 12-17. Frame-time percentiles are inside the release's range. With 2 runs these are observations, not results; the bench does not measure texture-memory fragmentation or how much the repack moved. Crashes: none in the PR runs and none in the release runs (no host GPU failure, no device lost). Config: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 32 GB, Windows 11; default `play-foxhound.ps1` settings (Series X profile, 1440p, DLSS balanced, no frame generation), fullscreen, no frame cap. Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/556:upstream-pr/556'
git switch 'upstream-pr/556'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/556'
git switch 'upstream-pr/556'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/556'
git switch 'upstream-pr/556'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/556'
git switch 'main'
git merge --squash 'upstream-pr/556'
git switch 'main'
git merge --ff-only 'upstream-pr/556'
git switch 'main'
git merge 'upstream-pr/556'
git push origin 'main'
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
readmet3xt-lab/foxhound!556
No description provided.