GPU: a texture pass with no room gives up the oldest slots' host copies #140

Open
undeadhuman37 wants to merge 9 commits from upstream-pr/140 into main
undeadhuman37 commented 2026-11-24 21:48:55 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by undeadhuman37 on 2026-11-24T21:48:55Z.


What

The index pass keeps a host copy for every slot it uploads, and a slot's copy is never idle to the sweep, so only unmapping frees it. Once the card passed 90% of its budget, room() stayed false: the pass refused 256 slots and stopped every frame for the rest of the run, and uploads froze (about 14 GB, thousands of slots still due).

Now, when a pass finds no room, up to 256 slots the pass made more than 4 s ago, oldest first, are made null so the sweep can free their copies. The memory line gets a count of slots given up. Marked shortcut: in the code: oldest made first, not least sampled, because a draw reading a texture by index leaves no trace. A slot given up stays empty until the title writes or maps it again, so a texture still on screen may draw empty meanwhile.

Tested

  • cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace (499 passed, 0 failed) and cargo xtask policy pass.
  • New test eviction_takes_the_oldest_made_slots_and_spares_the_recent (synthetic, no game files).
  • Two 12-minute runs of the title, no device loss or errors. Textures waiting: about 5,250-7,260 without this change, 2,577 with it (2,314 with the descriptor-data fix as well). Frame rates were 4.5 and 4.2 against 5.1, but the runs differ in cache warmth, so they are not comparable.
  • Not tested: whether any scenery blinks out from a slot given up, and any other GPU. "Passed over, memory not mapped" stays high (10,472 and 13,924), so unmapped placed textures are the remaining blocker.
  • No game files, data, logs or captures are included.

AI use: an AI tool (Claude Code) wrote this change; a person ran and reviewed the checks.

Note on this branch: it is based on fx-main, so besides this change (one commit, 3 files) the diff also carries the other commits merged there. A one-commit version on main is prepared and not yet pushed. Eviction can leave a slot drawing empty; see the test comment below about visual differences, whose cause is not isolated.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6592089257 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/140). Originally posted by [undeadhuman37](https://github.com/undeadhuman37) on 2026-11-24T21:48:55Z. --- ## What The index pass keeps a host copy for every slot it uploads, and a slot's copy is never idle to the sweep, so only unmapping frees it. Once the card passed 90% of its budget, `room()` stayed false: the pass refused 256 slots and stopped every frame for the rest of the run, and uploads froze (about 14 GB, thousands of slots still due). Now, when a pass finds no room, up to 256 slots the pass made more than 4 s ago, oldest first, are made null so the sweep can free their copies. The memory line gets a count of slots given up. Marked `shortcut:` in the code: oldest made first, not least sampled, because a draw reading a texture by index leaves no trace. A slot given up stays empty until the title writes or maps it again, so a texture still on screen may draw empty meanwhile. ## Tested - `cargo clippy --workspace --all-targets -- -D warnings`, `cargo test --workspace` (499 passed, 0 failed) and `cargo xtask policy` pass. - New test `eviction_takes_the_oldest_made_slots_and_spares_the_recent` (synthetic, no game files). - Two 12-minute runs of the title, no device loss or errors. Textures waiting: about 5,250-7,260 without this change, 2,577 with it (2,314 with the descriptor-data fix as well). Frame rates were 4.5 and 4.2 against 5.1, but the runs differ in cache warmth, so they are not comparable. - Not tested: whether any scenery blinks out from a slot given up, and any other GPU. "Passed over, memory not mapped" stays high (10,472 and 13,924), so unmapped placed textures are the remaining blocker. - No game files, data, logs or captures are included. AI use: an AI tool (Claude Code) wrote this change; a person ran and reviewed the checks. **Note on this branch:** it is based on `fx-main`, so besides this change (one commit, 3 files) the diff also carries the other commits merged there. A one-commit version on `main` is prepared and not yet pushed. Eviction can leave a slot drawing empty; see the test comment below about visual differences, whose cause is not isolated.
m335671 commented 2026-11-24 23:09:41 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by m335671 on 2026-11-24T22:59:09Z.


Test run on an RTX 4070: the texture queue stays short for the whole run. Note that this branch also carries #25, #32 and #24 (merged into fx-main under the commit), so what follows is the four of them together, not this commit alone.

Tested

  • RTX 4070 12 GB (32-lane waves), driver 32.0.16.2124, Ryzen 9 7900, 32 GB, Windows 11 Pro 26300, Series X profile, diagnostics build.
  • This PR's head cc69162, merged with #77, #218, #51 and #81 on 2119b0e (no other conflict than both adding tests to waterfall_tests.rs).
  • Prologue checkpoint, about 11 minutes, VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024.
  • No device removal. Counts from the log lines only.

Texture queue, last 30 samples (~3 minutes) of each run

without (1684989-based + #77, ~11 min) with this branch (~11 min)
slots in the queue median 3,850, max 5,031 median 2,451, max 3,022
due median 1,702, max 4,008 median 122, max 2,069
oldest written median 134, max 2,805 frames ago median 50, max 3,523 frames ago
fps / draws (median) 4.2 / 5,069 4.1 / 5,240
  • At the end: passes that made none for lack of room: 63 (14086 slots given up to make room), card 8,277 MB of a 10,808 MB budget.
  • Without the change, textures visibly went missing or stale as the run went on. With it they stayed current.

Visual differences I saw, cause not isolated (any of the four PRs could be behind them):

  • In the first gameplay room, the wire mesh in front of the window is missing. The window shows a shimmering frosted texture, and the yard behind it is washed out. With #77/#218/#51/#81 alone, in the same spot, the mesh and the yard were there.
  • The small window in the cell door draws in front of the guard standing behind it, which cuts a hole in his torso.

Not tested: this commit without #25/#32/#24, process memory (still about 23 GB committed), other GPUs.

AI use: the run was done on my machine. Claude Code (Claude Opus 5.5) built and ran it, read the logs, worked out the figures and wrote this comment.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7146876389 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/140#issuecomment-7146876389). Originally posted by [m335671](https://github.com/m335671) on 2026-11-24T22:59:09Z. --- Test run on an RTX 4070: the texture queue stays short for the whole run. Note that this branch also carries #25, #32 and #24 (merged into `fx-main` under the commit), so what follows is the four of them together, not this commit alone. **Tested** - RTX 4070 12 GB (32-lane waves), driver 32.0.16.2124, Ryzen 9 7900, 32 GB, Windows 11 Pro 26300, Series X profile, diagnostics build. - This PR's head `cc69162`, merged with #77, #218, #51 and #81 on `2119b0e` (no other conflict than both adding tests to `waterfall_tests.rs`). - Prologue checkpoint, about 11 minutes, `VICTORY_LATE_WAIT=3 VICTORY_WIDE_BACK=1 VICTORY_CARD_BUFFERS_MIN_MB=1 VICTORY_CARD_BUFFERS_MB=1024`. - No device removal. Counts from the log lines only. **Texture queue, last 30 samples (~3 minutes) of each run** | | without (`1684989`-based + #77, ~11 min) | with this branch (~11 min) | |---|---|---| | slots in the queue | median 3,850, max 5,031 | median **2,451**, max 3,022 | | due | median **1,702**, max 4,008 | median **122**, max 2,069 | | oldest written | median 134, max 2,805 frames ago | median 50, max 3,523 frames ago | | fps / draws (median) | 4.2 / 5,069 | 4.1 / 5,240 | - At the end: `passes that made none for lack of room: 63 (14086 slots given up to make room)`, card 8,277 MB of a 10,808 MB budget. - Without the change, textures visibly went missing or stale as the run went on. With it they stayed current. **Visual differences I saw, cause not isolated** (any of the four PRs could be behind them): - In the first gameplay room, the wire mesh in front of the window is missing. The window shows a shimmering frosted texture, and the yard behind it is washed out. With #77/#218/#51/#81 alone, in the same spot, the mesh and the yard were there. - The small window in the cell door draws in front of the guard standing behind it, which cuts a hole in his torso. **Not tested:** this commit without #25/#32/#24, process memory (still about 23 GB committed), other GPUs. AI use: the run was done on my machine. Claude Code (Claude Opus 5.5) built and ran it, read the logs, worked out the figures and wrote this comment.
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/140:upstream-pr/140'
git switch 'upstream-pr/140'

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/140'
git switch 'upstream-pr/140'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/140'
git switch 'upstream-pr/140'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/140'
git switch 'main'
git merge --squash 'upstream-pr/140'
git switch 'main'
git merge --ff-only 'upstream-pr/140'
git switch 'main'
git merge 'upstream-pr/140'
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
fxceless/victory-fork!140
No description provided.