fix: the card room kept for render targets follows the card's budget (8 GB cards get textures) #536

Merged
KainanP merged 1 commit from upstream-pr/536 into main 2026-11-27 19:38:44 +00:00
KainanP commented 2026-11-27 17:52:28 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-27T17:52:28Z.


Change

resource::targets_room_kept held a fixed 3,072 MB (VICTORY_CARD_ROOM_FOR_TARGETS_MB) of the card out of the texture queue's reach until the render targets are made. That value was measured on a card with a ~10,200 MB in-world budget (runs 193-198 in the comment). On an 8 GB card the system gives 6,700-7,200 MB, so the reserve takes up to half of the 90 % that room() allows, and textures picked by index wait for most of the game (black textures that come back).

The reserve now follows the budget that card_use (used by room() and let_go_idle()) already reads:

reserve = max(512 MB, 3,072 MB − (10,000 MB − budget) / 2). It stays 3,072 MB from 10,000 MB up and when the budget is unknown.

VICTORY_CARD_ROOM_FOR_TARGETS_MB still overrides it exactly as before (0 = none, capped at 8,192). Nothing else changes.

Budget in the world Card Before After
3,400 MB 4 GB 3,072 512
6,550 MB 8 GB laptop 3,072 1,347
6,680-6,981 MB RTX 2070 SUPER 8 GB (avatarmanz#407) 3,072 1,412-1,562
7,188 MB RTX 4060 Laptop 8 GB (this PC) 3,072 1,666
10,200 / ~11,000 / ~23,000 MB, unknown measured card, 12 GB, 24 GB 3,072 3,072

Where the numbers come from. avatarmanz/VIctory-7900XTX#407 (Jesper-Andersson, RTX 2070 SUPER 8 GB, budget 7,221 MB at the start and 6,680-6,981 MB in the world, about two minutes in the world per run, measured in game). That repository is no longer reachable, so here are the figures as I recorded them:

3,072 (default) 512 1,280
passes that made none for lack of room 0 → 1,001 0 → 15 0
textures picked by index uploaded 56,947 (2,807 MB), 12,550 waiting 102,380 (5,180 MB), 9,571 waiting 92,668 (4,771 MB), 9,076 waiting
card memory, highest 6,576 of 6,949 MB 7,076 of 6,993 MB, over in 12 of 35 lines 6,955 of 6,928, over once by 27 MB
median frame in the world 472 ms 386 ms 378 ms

A second report there (RTX 3050 Laptop 4 GB) found the texture copies stuck at the floor with 3,072.

A flat share of the budget can't fit both measurements: 1,280 on ~6.9 GB is 18 %, and 3,072 on ~10.2 GB is 30 %. A line from 512 up to 3,072 at 10,000 MB fits both and keeps every 10 GB+ budget where it was. On 8 GB it gives 1,412-1,562, a little above #407's 1,280, because going over the budget did more harm than a few lack-of-room passes.

Interplay with our presets and PRs.

  • LowVram ("8 GB card") preset: it doesn't set VICTORY_CARD_ROOM_FOR_TARGETS_MB, so it gets the new reserve automatically. Its VICTORY_TEXTURE_ROOM_PERCENT=85 lowers the line itself, and the two stack (numbers below).
  • #465 (merged): it introduced card_use, and this change only adds the budget argument to it.
  • #506 (texture size cap): it doesn't touch card_use or targets_room_kept. Its tests go at the end of resource.rs's test module, and the new test sits next to texture_floor_scales_with_vram_budget, so they shouldn't conflict textually. The two do different things: #506 shrinks the textures, this lets more of them be made.

Linked issue: Refs avatarmanz/VIctory-7900XTX#407 (repository gone).

Verification

RTX 4060 Laptop 8 GB, Intel UHD (a78b), WARP; third_party/victory, CARGO_TARGET_DIR outside the tree.

cargo test -p victory-gpu --lib -- room_for_targets texture_floor   → 2 passed
  with the old fixed value (function returning 3,072)               → FAILED: left: 3221225472, right: 1412431872
full victory-gpu suite single-threaded (RTX, Intel, WARP diagnostics) → NOT RUN YET: a game was using the RTX; results will follow in a comment
cargo clippy -p victory-gpu --all-targets [--all-features]          → 1 warning each, overlay.rs is_multiple_of (file not touched, same on main); none in resource.rs
cargo xtask policy                                                  → asset policy: 296 files ok
python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools → All checks passed!
python -m pytest tests/test_sync_voisins.py tests/test_readme_sync.py → 19 passed, 1 skipped

Device check on the RTX 4060 Laptop 8 GB (local #[ignore] test, not in this PR). It makes 64 MiB committed textures one by one on the real device and evaluates room()'s line (card_use with the real card_room_kept() = 512 MB, targets not made yet) with the old and the new reserve. Budget 7,188 MB; same result in two runs each:

VICTORY_TEXTURE_ROOM_PERCENT textures before the line closes, 3,072 reserve with the new 1,666 in use at the new stop
90 (default) 2,880 MB 4,288 MB (+1,408) 4,299 of 7,188 MB
85 (LowVram preset) 2,560 MB 3,968 MB (+1,408) 3,979 of 7,188 MB

In both cases the card stays well under its budget at the stop, with room left for the targets. On the Intel UHD (shared budget 15,483 MB) both reserves are 3,072 and close at the same point, which is expected.

Oracle and test data

  • New unit test resource::tests::the_room_for_targets_follows_the_budget. It checks the budgets in the table, the switch over the budget, that on 8 GB the reserve sits between 512 MB and a quarter of the budget, and that on 4 GB the floor plus the reserve stay under 80 % of the budget. It fails with the old fixed 3,072 (shown above).
  • No test data from a title. The in-game figures are #407's, measured by its author.

Not measured: I haven't run the game with this change. Request: could someone on an 8 GB card (RTX 4060 / 3070 / 2070 class) run an A/B: this branch against main, LowVram preset or not, two minutes in the world each, and post the log's "passes that made none for lack of room", the "the card: N MB in use of a budget of M MB" lines, the median frame, and whether textures go black? Setting VICTORY_CARD_ROOM_FOR_TARGETS_MB=3072 on this branch gives the old behaviour for the B side.

Checklist

  • The PR covers a single reviewable behaviour.
  • A test fails without this change and passes with it.
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (E_NOTIMPL), never a fake success. (n/a)
  • README: no README change.
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: only counts and budgets from #407, labelled as measured by its author.
  • Code taken from another project: 101Leafy/victory-leafy#26 (Altorru, GPL-3.0; the shape of the function, with a different formula) and my own KainanP/VIctory-7900XTX 6e76be9: Source: and Co-authored-by: in the commit, row in THIRD_PARTY.md.

Made with AI assistance (Claude Code, Claude Opus 5.5): code reading, the change, the tests and this description. I ran the tests and the device check on my machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:5530950461 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/536). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T17:52:28Z. --- ## Change `resource::targets_room_kept` held a fixed **3,072 MB** (`VICTORY_CARD_ROOM_FOR_TARGETS_MB`) of the card out of the texture queue's reach until the render targets are made. That value was measured on a card with a ~10,200 MB in-world budget (runs 193-198 in the comment). On an 8 GB card the system gives 6,700-7,200 MB, so the reserve takes up to half of the 90 % that `room()` allows, and textures picked by index wait for most of the game (black textures that come back). The reserve now follows the budget that `card_use` (used by `room()` and `let_go_idle()`) already reads: `reserve = max(512 MB, 3,072 MB − (10,000 MB − budget) / 2)`. It stays 3,072 MB from 10,000 MB up and when the budget is unknown. `VICTORY_CARD_ROOM_FOR_TARGETS_MB` still overrides it exactly as before (0 = none, capped at 8,192). Nothing else changes. | Budget in the world | Card | Before | After | |---|---|---:|---:| | 3,400 MB | 4 GB | 3,072 | 512 | | 6,550 MB | 8 GB laptop | 3,072 | 1,347 | | 6,680-6,981 MB | RTX 2070 SUPER 8 GB (avatarmanz#407) | 3,072 | 1,412-1,562 | | 7,188 MB | RTX 4060 Laptop 8 GB (this PC) | 3,072 | 1,666 | | 10,200 / ~11,000 / ~23,000 MB, unknown | measured card, 12 GB, 24 GB | 3,072 | 3,072 | **Where the numbers come from.** avatarmanz/VIctory-7900XTX#407 (Jesper-Andersson, RTX 2070 SUPER 8 GB, budget 7,221 MB at the start and 6,680-6,981 MB in the world, about two minutes in the world per run, measured in game). That repository is no longer reachable, so here are the figures as I recorded them: | | 3,072 (default) | 512 | 1,280 | |---|---|---|---| | passes that made none for lack of room | 0 → 1,001 | 0 → 15 | 0 | | textures picked by index uploaded | 56,947 (2,807 MB), 12,550 waiting | 102,380 (5,180 MB), 9,571 waiting | 92,668 (4,771 MB), 9,076 waiting | | card memory, highest | 6,576 of 6,949 MB | 7,076 of 6,993 MB, over in 12 of 35 lines | 6,955 of 6,928, over once by 27 MB | | median frame in the world | 472 ms | 386 ms | 378 ms | A second report there (RTX 3050 Laptop 4 GB) found the texture copies stuck at the floor with 3,072. A flat share of the budget can't fit both measurements: 1,280 on ~6.9 GB is 18 %, and 3,072 on ~10.2 GB is 30 %. A line from 512 up to 3,072 at 10,000 MB fits both and keeps every 10 GB+ budget where it was. On 8 GB it gives 1,412-1,562, a little above #407's 1,280, because going over the budget did more harm than a few lack-of-room passes. **Interplay with our presets and PRs.** - **LowVram ("8 GB card") preset:** it doesn't set `VICTORY_CARD_ROOM_FOR_TARGETS_MB`, so it gets the new reserve automatically. Its `VICTORY_TEXTURE_ROOM_PERCENT=85` lowers the line itself, and the two stack (numbers below). - **#465** (merged): it introduced `card_use`, and this change only adds the budget argument to it. - **#506** (texture size cap): it doesn't touch `card_use` or `targets_room_kept`. Its tests go at the end of `resource.rs`'s test module, and the new test sits next to `texture_floor_scales_with_vram_budget`, so they shouldn't conflict textually. The two do different things: #506 shrinks the textures, this lets more of them be made. Linked issue: Refs avatarmanz/VIctory-7900XTX#407 (repository gone). ## Verification RTX 4060 Laptop 8 GB, Intel UHD (a78b), WARP; `third_party/victory`, `CARGO_TARGET_DIR` outside the tree. ``` cargo test -p victory-gpu --lib -- room_for_targets texture_floor → 2 passed with the old fixed value (function returning 3,072) → FAILED: left: 3221225472, right: 1412431872 full victory-gpu suite single-threaded (RTX, Intel, WARP diagnostics) → NOT RUN YET: a game was using the RTX; results will follow in a comment cargo clippy -p victory-gpu --all-targets [--all-features] → 1 warning each, overlay.rs is_multiple_of (file not touched, same on main); none in resource.rs cargo xtask policy → asset policy: 296 files ok python -m ruff check --select W605,F,E9 PrototypeScarlett tests tools → All checks passed! python -m pytest tests/test_sync_voisins.py tests/test_readme_sync.py → 19 passed, 1 skipped ``` **Device check on the RTX 4060 Laptop 8 GB** (local `#[ignore]` test, not in this PR). It makes 64 MiB committed textures one by one on the real device and evaluates `room()`'s line (`card_use` with the real `card_room_kept()` = 512 MB, targets not made yet) with the old and the new reserve. Budget 7,188 MB; same result in two runs each: | `VICTORY_TEXTURE_ROOM_PERCENT` | textures before the line closes, 3,072 reserve | with the new 1,666 | in use at the new stop | |---|---:|---:|---:| | 90 (default) | 2,880 MB | **4,288 MB** (+1,408) | 4,299 of 7,188 MB | | 85 (LowVram preset) | 2,560 MB | **3,968 MB** (+1,408) | 3,979 of 7,188 MB | In both cases the card stays well under its budget at the stop, with room left for the targets. On the Intel UHD (shared budget 15,483 MB) both reserves are 3,072 and close at the same point, which is expected. ## Oracle and test data - New unit test `resource::tests::the_room_for_targets_follows_the_budget`. It checks the budgets in the table, the switch over the budget, that on 8 GB the reserve sits between 512 MB and a quarter of the budget, and that on 4 GB the floor plus the reserve stay under 80 % of the budget. It fails with the old fixed 3,072 (shown above). - No test data from a title. The in-game figures are #407's, measured by its author. **Not measured:** I haven't run the game with this change. **Request:** could someone on an 8 GB card (RTX 4060 / 3070 / 2070 class) run an A/B: this branch against `main`, LowVram preset or not, two minutes in the world each, and post the log's "passes that made none for lack of room", the "the card: N MB in use of a budget of M MB" lines, the median frame, and whether textures go black? Setting `VICTORY_CARD_ROOM_FOR_TARGETS_MB=3072` on this branch gives the old behaviour for the B side. ## Checklist - [x] The PR covers a single reviewable behaviour. - [x] A test fails without this change and passes with it. - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`E_NOTIMPL`), never a fake success. (n/a) - [x] README: no README change. - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: only counts and budgets from #407, labelled as measured by its author. - [x] Code taken from another project: 101Leafy/victory-leafy#26 (Altorru, GPL-3.0; the shape of the function, with a different formula) and my own KainanP/VIctory-7900XTX `6e76be9`: `Source:` and `Co-authored-by:` in the commit, row in `THIRD_PARTY.md`. Made with AI assistance (Claude Code, Claude Opus 5.5): code reading, the change, the tests and this description. I ran the tests and the device check on my machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
KainanP commented 2026-11-27 19:45:22 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-27T19:45:22Z.


Full victory-gpu suite on this branch (single-threaded, cargo test -p victory-gpu --locked -- --test-threads=1):

Adapter Result
RTX 4060 Laptop 467 passed, 0 failed, 43 ignored
Intel UHD (VICTORY_D3D12_ADAPTER=Intel) 466 passed, 1 failed — anisotropic_heap_sampler_reads_the_requested_mip, which fails the same way on main on this iGPU (seen on #506/#443 runs too)
WARP (VICTORY_D3D12_WARP=1, --all-features) 523 passed, 0 failed, 43 ignored

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7226839614 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/536#issuecomment-7226839614). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T19:45:22Z. --- Full `victory-gpu` suite on this branch (single-threaded, `cargo test -p victory-gpu --locked -- --test-threads=1`): | Adapter | Result | |---|---| | RTX 4060 Laptop | 467 passed, 0 failed, 43 ignored | | Intel UHD (`VICTORY_D3D12_ADAPTER=Intel`) | 466 passed, 1 failed — `anisotropic_heap_sampler_reads_the_requested_mip`, which fails the same way on `main` on this iGPU (seen on #506/#443 runs too) | | WARP (`VICTORY_D3D12_WARP=1`, `--all-features`) | 523 passed, 0 failed, 43 ignored | _AI use: Claude Code (Claude Opus 5.5)._
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
LooperSalty/AnyXboxX!536
No description provided.