Large title textures are made without their most detailed levels when the card is short of room (VICTORY_TEXTURE_DROP_LEVELS) #1216

Open
Steenax6 wants to merge 6 commits from upstream-pr/1219 into main
Steenax6 commented 2026-11-26 00:26:07 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Steenax6 on 2026-11-26T00:26:07Z.


What

On a 12 GB card the title's textures do not all fit beside the targets and the buffer copies. In our runs some 22,000 textures picked by index waited for room in every run, and which ones were there differed from run to run: the first room came up lit in one run and dark in the next.

Placed, title-filled, block-compressed 2D textures of 1024 and more a side are now made as reserved textures (tiles.rs, the machinery of VICTORY_LEVELS_ON_DEMAND) and, past a line of host-copy bytes, without their one or two most detailed levels. Their views keep the title's first level and clamp the level of detail, so the sizes shaders read stay the title's. Levels come back while there is room (VICTORY_TEXTURE_PROMOTE_MB).

VICTORY_TEXTURE_DROP_LEVELS=0 turns it off; force1 / force2 leave levels out whatever the room.

This is a different answer to the same shortage than spilling into system memory or the Series S profile, and it does not exclude either.

Commits

The first commit is #1218 (lists hold the textures they read); this branch is stacked on it, and it drops out of the diff once that one is merged. Then:

  1. Large title textures are made without their most detailed levels when the card is short of room. The feature itself. Also: show_from no longer lowers the title's level-of-detail clamp when it moves a view (the clamp counts the texture's levels, not the view's).
  2. Swept host textures and their staging are released off the submitting thread (host::retire_later): the sweep let go of hundreds of host copies in one call, 20 ms a frame of the submitting thread in the cutscene for reserved textures, 6 ms for staging state.
  3. Reserved textures and staging buffers are reused; left-out levels are not staged. With nothing held back for room the cutscene made twice as many host copies and uploaded three times as many: 210 ms a frame against 107. Staging buffers up to 64 MiB from a pool of VICTORY_STAGING_POOL_MB (1,024), a reused one zeroed only if nothing has filled it by its first check; reserved textures kept by description (VICTORY_RESERVED_REUSE); tiles mapped a heap at a time; only the levels an upload writes are staged (VICTORY_STAGE_LEFT_OUT=1: all). 210 -> 158 ms.
  4. Views of reduced textures follow their tiles after the landing; slots are remade with nothing in flight. The second cause of the device loss described in #1218: a view slot was rewritten from the texture pass while lists already sent might read it, and widened to a level whose tiles were mapped but whose upload had not run (15,000 such rewrites a run). A view now follows its tiles once the submission that gave them has landed (VICTORY_TILED_VIEW_PUBLISH=0: at once), slots are remade by the sweep when no submission is in flight, and a view of a reduced texture changes in its clamp alone (VICTORY_TEXTURE_DROP_VIEWS=keep|shift: the earlier ways).
  5. README entry.

Measured (in our tree, RTX 4070 Ti 12 GB, Ryzen 7 9800X3D)

  • Two runs with commit 1: both lit and complete, 17,458 title textures alive in 2,964 MB (9,521 in 3,932 MB before), no slot held back for room, the card at 8.5 of 10.3 GB.
  • A/B on the lighting: with the switch every run since came up lit; =0 is dark again.
  • First room 86.8 ms a frame with all of it; the room is bound by the card, so this is not a frame-rate change there.
  • Device: 3 losses in about 30 runs with commits 1 to 3 alone, none in nine runs through the fault point with commit 4 and #1218.

What I can and cannot say for this tree

  • Compiled and linted on 4aa6e8c: cargo clippy --workspace --all-targets --locked and the same with --all-features give exactly the warnings main gives (11 there, none new). cargo test --workspace --locked: the tests of the modules touched pass; indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields fails here on main as well, and two WARP tests in watch.rs / inplace.rs failed once in a full run and pass when run by name (other builds were running on the machine). The tests of tiles.rs cover the view shapes and the publish order on the software adapter.
  • Not run with the title on this base. The commits applied with one conflict, in texture.rs: this tree's VICTORY_STAGING_POOL=alt is kept, the pool's sizes are the new ones. In our tree commit 3 also carried hooks for placed textures (#903, not ours, still open here); they are taken out, so this stands without it.
  • Two things here touch choices this tree made on purpose, please look at them:
    • On by default. New paths here are usually off by default. It only acts past a line of host-copy bytes, but it does change how every large compressed texture is made (reserved instead of committed). Say so and I flip the default.
    • The staging pool grows from 256 MB / 8 MiB buffers to 1,024 MB / 64 MiB, and a buffer taken from it is no longer zeroed at once. The README says the pool is off in the test runs since run 224 lost the device with it; I have no evidence either way about that loss.
  • Shader cache: nothing in the translator changes.

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:6616642755 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1219). Originally posted by [Steenax6](https://github.com/Steenax6) on 2026-11-26T00:26:07Z. --- ## What On a 12 GB card the title's textures do not all fit beside the targets and the buffer copies. In our runs some 22,000 textures picked by index waited for room in every run, and which ones were there differed from run to run: the first room came up lit in one run and dark in the next. Placed, title-filled, block-compressed 2D textures of 1024 and more a side are now made as reserved textures (`tiles.rs`, the machinery of `VICTORY_LEVELS_ON_DEMAND`) and, past a line of host-copy bytes, **without their one or two most detailed levels**. Their views keep the title's first level and clamp the level of detail, so the sizes shaders read stay the title's. Levels come back while there is room (`VICTORY_TEXTURE_PROMOTE_MB`). `VICTORY_TEXTURE_DROP_LEVELS=0` turns it off; `force1` / `force2` leave levels out whatever the room. This is a different answer to the same shortage than spilling into system memory or the Series S profile, and it does not exclude either. ## Commits The first commit is #1218 (lists hold the textures they read); this branch is stacked on it, and it drops out of the diff once that one is merged. Then: 1. **Large title textures are made without their most detailed levels when the card is short of room.** The feature itself. Also: `show_from` no longer lowers the title's level-of-detail clamp when it moves a view (the clamp counts the texture's levels, not the view's). 2. **Swept host textures and their staging are released off the submitting thread** (`host::retire_later`): the sweep let go of hundreds of host copies in one call, 20 ms a frame of the submitting thread in the cutscene for reserved textures, 6 ms for staging state. 3. **Reserved textures and staging buffers are reused; left-out levels are not staged.** With nothing held back for room the cutscene made twice as many host copies and uploaded three times as many: 210 ms a frame against 107. Staging buffers up to 64 MiB from a pool of `VICTORY_STAGING_POOL_MB` (1,024), a reused one zeroed only if nothing has filled it by its first check; reserved textures kept by description (`VICTORY_RESERVED_REUSE`); tiles mapped a heap at a time; only the levels an upload writes are staged (`VICTORY_STAGE_LEFT_OUT=1`: all). 210 -> 158 ms. 4. **Views of reduced textures follow their tiles after the landing; slots are remade with nothing in flight.** The second cause of the device loss described in #1218: a view slot was rewritten from the texture pass while lists already sent might read it, and widened to a level whose tiles were mapped but whose upload had not run (15,000 such rewrites a run). A view now follows its tiles once the submission that gave them has landed (`VICTORY_TILED_VIEW_PUBLISH=0`: at once), slots are remade by the sweep when no submission is in flight, and a view of a reduced texture changes in its clamp alone (`VICTORY_TEXTURE_DROP_VIEWS=keep|shift`: the earlier ways). 5. README entry. ## Measured (in our tree, RTX 4070 Ti 12 GB, Ryzen 7 9800X3D) - Two runs with commit 1: both lit and complete, 17,458 title textures alive in 2,964 MB (9,521 in 3,932 MB before), no slot held back for room, the card at 8.5 of 10.3 GB. - A/B on the lighting: with the switch every run since came up lit; `=0` is dark again. - First room 86.8 ms a frame with all of it; the room is bound by the card, so this is not a frame-rate change there. - Device: 3 losses in about 30 runs with commits 1 to 3 alone, none in nine runs through the fault point with commit 4 and #1218. ## What I can and cannot say for this tree - Compiled and linted on 4aa6e8c: `cargo clippy --workspace --all-targets --locked` and the same with `--all-features` give exactly the warnings `main` gives (11 there, none new). `cargo test --workspace --locked`: the tests of the modules touched pass; `indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields` fails here on `main` as well, and two WARP tests in `watch.rs` / `inplace.rs` failed once in a full run and pass when run by name (other builds were running on the machine). The tests of `tiles.rs` cover the view shapes and the publish order on the software adapter. - **Not run with the title on this base.** The commits applied with one conflict, in `texture.rs`: this tree's `VICTORY_STAGING_POOL=alt` is kept, the pool's sizes are the new ones. In our tree commit 3 also carried hooks for placed textures (#903, not ours, still open here); they are taken out, so this stands without it. - Two things here touch choices this tree made on purpose, please look at them: - **On by default.** New paths here are usually off by default. It only acts past a line of host-copy bytes, but it does change how every large compressed texture is made (reserved instead of committed). Say so and I flip the default. - **The staging pool** grows from 256 MB / 8 MiB buffers to 1,024 MB / 64 MiB, and a buffer taken from it is no longer zeroed at once. The README says the pool is off in the test runs since run 224 lost the device with it; I have no evidence either way about that loss. - Shader cache: nothing in the translator changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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/1219:upstream-pr/1219'
git switch 'upstream-pr/1219'

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