feat: texture size cap on the Vice-Tay base (VICTORY_TEXTURE_MAX_SIZE), so the 8 GB preset limits VRAM again #506

Merged
KainanP merged 2 commits from upstream-pr/506 into main 2026-11-27 19:38:44 +00:00
KainanP commented 2026-11-27 14:37:42 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-27T14:37:42Z.


Why

On 8 GB cards, going over the VRAM budget is a cliff rather than a slope. Windows moves the overflow into the PC's memory and frames go from tens of ms to hundreds: VIctory #3505 (RTX 4060 Laptop, D3D12 budget about 6.5 GB) saw 300–1200 ms frames once over budget, and a creep from 7,342 to 7,921 MiB over 6 minutes that ended at 3–4 fps.

The launcher's 8 GB preset was meant to prevent that partly by capping the title's textures at 1024 texels (VICTORY_TEXTURE_MAX_SIZE=1024). But since the Vice-Tay base (#454), nothing in third_party/victory reads that variable. The launcher test even listed it in UNREAD_BY_VICE_TAY. So the texture half of the preset did nothing. (My #465 proposed dropping it from the presets for that reason. This PR makes it real instead, and I'm dropping that commit from #465.)

The change

The cap is back, built on Vice-Tay's held levels (VICTORY_HELD_LEVELS, on by default). Take a texture the title places in memory and fills, whose level 0 is over the cap. Its host copy now begins at the first level within the cap (resource.rs cap_base, through base_level, so block-compressed levels stay whole). A 4096² BC7 texture with a full chain is 21.3 MiB on the card uncapped and 1.3 MiB capped at 1024.

  • What the title sees doesn't change: the size, levels, layout and memory it described. Uploads read its memory from the kept level on, as the held levels already do.
  • Views are counted from the kept level (from_base, which now also handles 2D array views of such a texture). A view that starts at a larger level shows the first kept level, so sampling clamps to it. Shaders that ask for the texture's size, or that load by level and texel, see the kept level's size. That is the same as on the Neptune base, where views started at the first level within the cap.
  • No regrowth past the cap: a view of level 0 does not bring the larger levels back (want_level). The texture store's larger levels aren't used for a capped copy.
  • Copies and resolves keep every level. CopyResource, CopyTextureRegion and ResolveSubresource name subresources by level number. So before the host copies are asked for, keep_whole lifts the cap from both textures for good, and a capped copy is replaced by a whole one (the same path want_level uses). The memory line counts these (lifted from N textures).
  • With VICTORY_LEVELS_ON_DEMAND=1, the Neptune behaviour is ported as it was: levels over the cap are never held and get no tiles.
  • Launcher: the 8 GB (1024) and 12 GB (2048) presets set the variable as before. Their description now says how it works on this base. every_variable_an_option_names_exists_in_victorys_sources runs without the UNREAD_BY_VICE_TAY exception again.

Credit: the cap, first_within, over_cap and the held_levels change are ported from the Neptune-base commit 9e878913 by 4276b5yjdw-pixel3 (co-author on the commit, Source: line per rule 10). The held-levels path, keep_whole and the bench are new here.

Measured: synthetic VRAM churn (RTX 4060 Laptop GPU, 8 GB, our target card)

resource::tests::vram_churn (ignored; command in its doc comment) runs the 8 GB preset's settings: VICTORY_TEXTURE_ROOM_PERCENT=85, windows and buffers at 512 MB. It does nothing else on the card. Each cycle (3 s):

  • the title streams in an "area" at new addresses: 4 textures at 4096², 16 at 2048² and 48 at 1024², BC7 with full chains, 237 MB as described;
  • it uses the last N areas every cycle, while older areas stay alive and go idle;
  • four 1920×1080 RGBA16F render targets are made and the previous four released;
  • the sweep (let_go_idle) and the pool's once-a-second look run as in the host's sweep.

Per cycle it reads the process's DXGI QueryVideoMemoryInfo (local), host texture bytes, free space in the texture blocks, and how many copies were let go and made again.

All runs on the same machine, VICTORY_BURY_LAG=0, 3 s cycles. "In use" is the process's own local segment, and the budget was 6.6–7.2 GB (the OS lowers it while we're over).

scenario cap peak in use over budget peak host textures let go / made again second-half mean (1st → 2nd quarter)
28 areas in use (6.6 GB uncapped, more than the budget), 50 cycles unset (as on main) 7,311 MB, 101–108 % 23 of 50 cycles 6,717 MB 1,496 / 0 7,119 → 7,267 MB
same 1024 3,791 MB, 52 % 0 of 50 2,779 MB 1,496 / 0 3,679 → 3,791 MB
20 areas in use (4.7 GB uncapped), 60 cycles unset (as on main) 5,519 MB, 76–84 % 0 of 60 4,817 MB 2,720 / 0 5,442 → 5,421 MB
same 1024 3,791 MB, 52 % 0 of 60 2,779 MB 2,252 / 0 3,791 → 3,791 MB

Per area, the textures take 237 MB on the card uncapped and 90 MB capped (−62 %). Making a cycle's host copies took up to 64 ms uncapped over budget and 26 ms capped (28-area runs). The capped runs' 3,791 MB includes 0.8–1.1 GB of free space in texture blocks the pool keeps while the card has room: blocks made ahead (VICTORY_RIPE_BLOCKS) and freed space waiting for reuse.

What this shows:

  • The cap cuts the texture working set by 59 % (6,717 → 2,779 MB of host textures). With 28 areas in use (the active set bigger than the budget, as an 8 GB card in a dense scene), the uncapped run sits over budget for 23 of 50 cycles and the sweep can't help: everything over the line is in use, so nothing is idle to let go. Capped, the same scene stays at 52 % of the budget.
  • Eviction keeps an idle backlog under budget either way. With 20 areas in use, both runs plateau (uncapped 5.4 GB, capped 3.8 GB) while 40 older areas sit idle, and nothing in use was made again.
  • Creep: none found. Over the second half of each run the mean use moves by less than one 64 MB block (5,442 → 5,421 MB, 3,791 → 3,791 MB). At the end, with everything let go, use was within 12 MB of the start once the empty texture blocks the pool keeps on purpose are subtracted. That's SPARE_KEPT: up to 64 blocks (4 GiB) while the card is under 85 %, dropped to 2 above it. The test fails if anything else is not given back.
    • One thing to know when reading DXGI numbers on 8 GB: those kept-empty blocks (3.7–4.1 GB at the end of these runs) count as "in use" for the system until use passes 85 %. They are not a leak, but they are memory other allocators see as taken.
    • My first version of the bench seemed to show creep. It touched the active textures only once per 3 s cycle, so above 95 % the sweep's 1.5 s rule let them go and they were made again every cycle (23,000 re-makes, 2.5 GB resting in blocks, 104 % of budget). Real frames use them every frame, so the bench now does too.

Not measured

  • No in-game run. I can't say how GTA VI's textures split across sizes, how much of the 8 GB preset's frame time this saves, or how it looks. Capped textures are softer up close: the cap is 1024 on 8 GB and 2048 on 12 GB.
  • The #3505 creep (7.3 → 7.9 GB in 6 min) isn't reproduced by this synthetic run. Texture host copies, render-target churn and the texture pool all gave their memory back. If the creep is real on this base, it's elsewhere: card buffers, windows, by-address copies (VICTORY_MEMORY_CARD_MB, 4096 by default here, gated at 97 % of budget), or pipelines.
  • The cost of keep_whole replacing a capped copy the first time the card copies into it (one re-made, re-uploaded texture).

Also checked (coordinator's question)

  • VICTORY_MEMORY_CARD_MB (the 1024 → 2048 "6×" on #3505's fork): this base reads it with a default of 4096 MB, gated at 97 % of budget (shadow.rs by_address). Neither TUNED nor the 8 GB preset sets it, so the preset doesn't starve the card that way.
  • VICTORY_HEAP_RECHECK is read here (default on). #3505's =0 (prepare 44 → 29 ms) trades correctness for late-filled textures. I left it alone.

Tests (rule 5)

  • resource::tests::a_texture_over_the_size_cap_keeps_the_levels_within_it, on the host device:
    • a placed 4096² BC7 texture under a 1024 cap gets a 1024² host copy with 11 levels and base 2, while the title's texture stays 4096;
    • a view of level 0 keeps the capped copy;
    • a 1024² texture stays whole;
    • keep_whole replaces the copy with a whole 4096 one.
    • It fails before: with the cap unread (main's behaviour), the copy is (0, 4096, 4096, 13), not (2, 1024, 1024, 11).
  • texture::read_marks_tests::a_texture_uncapped_after_a_read_stages_its_whole_copy (after #444, whose reads take a texture's staged first level without the table's lock): a capped texture is read (staged from level 2), then uncapped; the staged level goes back to "none" at the swap, a late staging of the replaced capped copy (HostTexture::replaced) doesn't bring it back, and the same list's next read stages the whole copy. It fails without the reset at the swap, and without the replaced check.
  • tiles::tests::the_size_cap_is_read_and_cuts_the_levels_above_it: parsing (unset, 0, junk, minimum 256) and the first level within the cap.
  • descriptor::host::tests::views_count_from_the_first_level_of_the_host_copy: now also covers a 2D array view.
  • Launcher: every_variable_an_option_names_exists_in_victorys_sources without its exception fails on main (VICTORY_TEXTURE_MAX_SIZE is read nowhere) and passes here.

Run on the rebased head (main a4453083, with #444), cargo test -p victory-gpu --lib, one thread:

this PR main
RTX 4060 Laptop 469 passed 466 passed
Intel UHD (VICTORY_D3D12_ADAPTER=Intel) 468 passed, 1 failed 465 passed, 1 failed
WARP (--features diagnostics) 524 passed, 1 failed 521 passed, 1 failed

The Intel failure (anisotropic_heap_sampler_reads_the_requested_mip, a raw D3D12 sampler test this PR doesn't touch) and the WARP one (timeline::report::tests::real_waits_are_recorded_with_who_ended_them) fail the same way on main. Also: cargo test -p anyxboxx-launcher --release 217 passed, 1 ignored; clippy (--all-targets, with and without diagnostics) no new warnings; cargo xtask policy ok (296 files); CI build step (cargo release workspace build, runtime CMake, TomBox DLLs) ok; ruff (W605,F,E9), test_readme_sync, and pytest test_lanceur_victory, test_rust_native_launcher_parity, test_launch clean (13 passed, 3 skipped). A short vram_churn rerun (15 cycles, 28 areas) on this head: host textures 1,470 MB capped vs 3,630 MB uncapped, budget peak 32 % vs 62 %.

Asking for an A/B on an 8 GB card

@YUYING234 (VIctory #3505) and @lmouz823-lang (VIctory #735), you have RTX 4060 Laptop 8 GB cards. Could one of you run AnyXboxX with the 8 GB card preset on main and on this branch, at the same spot for about 6 minutes? Same build, alternating A/B/A after a first warm-up run.

The useful numbers are:

  • the frame-time median and 10th percentile (VICTORY_FRAMETIME_DUMP=1);
  • the card's memory in use against its budget over time (the log's memory lines);
  • the new line texture size cap 1024 ... lifted from N textures;
  • whether anything looks wrong (black or missing textures, or textures soft enough to matter).

AI use: written with Claude Code (Claude Opus 5.5): code, tests, bench and this text. I reviewed it and ran every test and bench on my own RTX 4060 Laptop / Intel UHD / WARP machine.

🤖 Generated with Claude Code

<!-- greyfinch-sync:LooperSalty/AnyXboxX:issue:5528414218 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/506). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T14:37:42Z. --- ## Why On 8 GB cards, going over the VRAM budget is a cliff rather than a slope. Windows moves the overflow into the PC's memory and frames go from tens of ms to hundreds: VIctory #3505 (RTX 4060 Laptop, D3D12 budget about 6.5 GB) saw 300–1200 ms frames once over budget, and a creep from 7,342 to 7,921 MiB over 6 minutes that ended at 3–4 fps. The launcher's 8 GB preset was meant to prevent that partly by capping the title's textures at 1024 texels (`VICTORY_TEXTURE_MAX_SIZE=1024`). But since the Vice-Tay base (#454), nothing in `third_party/victory` reads that variable. The launcher test even listed it in `UNREAD_BY_VICE_TAY`. So the texture half of the preset did nothing. (My #465 proposed dropping it from the presets for that reason. This PR makes it real instead, and I'm dropping that commit from #465.) ## The change The cap is back, built on Vice-Tay's held levels (`VICTORY_HELD_LEVELS`, on by default). Take a texture the title places in memory and fills, whose level 0 is over the cap. Its host copy now begins at the first level within the cap (`resource.rs` `cap_base`, through `base_level`, so block-compressed levels stay whole). A 4096² BC7 texture with a full chain is 21.3 MiB on the card uncapped and 1.3 MiB capped at 1024. - **What the title sees doesn't change:** the size, levels, layout and memory it described. Uploads read its memory from the kept level on, as the held levels already do. - **Views** are counted from the kept level (`from_base`, which now also handles 2D array views of such a texture). A view that starts at a larger level shows the first kept level, so sampling clamps to it. Shaders that ask for the texture's size, or that load by level and texel, see the kept level's size. That is the same as on the Neptune base, where views started at the first level within the cap. - **No regrowth past the cap:** a view of level 0 does not bring the larger levels back (`want_level`). The texture store's larger levels aren't used for a capped copy. - **Copies and resolves keep every level.** `CopyResource`, `CopyTextureRegion` and `ResolveSubresource` name subresources by level number. So before the host copies are asked for, `keep_whole` lifts the cap from both textures for good, and a capped copy is replaced by a whole one (the same path `want_level` uses). The memory line counts these (`lifted from N textures`). - **With `VICTORY_LEVELS_ON_DEMAND=1`**, the Neptune behaviour is ported as it was: levels over the cap are never held and get no tiles. - **Launcher:** the 8 GB (1024) and 12 GB (2048) presets set the variable as before. Their description now says how it works on this base. `every_variable_an_option_names_exists_in_victorys_sources` runs without the `UNREAD_BY_VICE_TAY` exception again. Credit: the cap, `first_within`, `over_cap` and the `held_levels` change are ported from the Neptune-base commit 9e878913 by 4276b5yjdw-pixel3 (co-author on the commit, `Source:` line per rule 10). The held-levels path, `keep_whole` and the bench are new here. ## Measured: synthetic VRAM churn (RTX 4060 Laptop GPU, 8 GB, our target card) `resource::tests::vram_churn` (ignored; command in its doc comment) runs the 8 GB preset's settings: `VICTORY_TEXTURE_ROOM_PERCENT=85`, windows and buffers at 512 MB. It does nothing else on the card. Each cycle (3 s): - the title streams in an "area" at new addresses: 4 textures at 4096², 16 at 2048² and 48 at 1024², BC7 with full chains, 237 MB as described; - it uses the last N areas every cycle, while older areas stay alive and go idle; - four 1920×1080 RGBA16F render targets are made and the previous four released; - the sweep (`let_go_idle`) and the pool's once-a-second look run as in the host's sweep. Per cycle it reads the process's DXGI `QueryVideoMemoryInfo` (local), host texture bytes, free space in the texture blocks, and how many copies were let go and made again. All runs on the same machine, `VICTORY_BURY_LAG=0`, 3 s cycles. "In use" is the process's own local segment, and the budget was 6.6–7.2 GB (the OS lowers it while we're over). | scenario | cap | peak in use | over budget | peak host textures | let go / made again | second-half mean (1st → 2nd quarter) | |---|---|---|---|---|---|---| | 28 areas in use (6.6 GB uncapped, more than the budget), 50 cycles | unset (as on main) | **7,311 MB, 101–108 %** | **23 of 50 cycles** | 6,717 MB | 1,496 / 0 | 7,119 → 7,267 MB | | same | 1024 | **3,791 MB, 52 %** | **0 of 50** | 2,779 MB | 1,496 / 0 | 3,679 → 3,791 MB | | 20 areas in use (4.7 GB uncapped), 60 cycles | unset (as on main) | 5,519 MB, 76–84 % | 0 of 60 | 4,817 MB | 2,720 / 0 | 5,442 → 5,421 MB | | same | 1024 | 3,791 MB, 52 % | 0 of 60 | 2,779 MB | 2,252 / 0 | 3,791 → 3,791 MB | Per area, the textures take 237 MB on the card uncapped and 90 MB capped (−62 %). Making a cycle's host copies took up to 64 ms uncapped over budget and 26 ms capped (28-area runs). The capped runs' 3,791 MB includes 0.8–1.1 GB of free space in texture blocks the pool keeps while the card has room: blocks made ahead (`VICTORY_RIPE_BLOCKS`) and freed space waiting for reuse. What this shows: - **The cap cuts the texture working set by 59 % (6,717 → 2,779 MB of host textures).** With 28 areas in use (the active set bigger than the budget, as an 8 GB card in a dense scene), the uncapped run sits over budget for 23 of 50 cycles and the sweep can't help: everything over the line is in use, so nothing is idle to let go. Capped, the same scene stays at 52 % of the budget. - **Eviction keeps an idle backlog under budget either way.** With 20 areas in use, both runs plateau (uncapped 5.4 GB, capped 3.8 GB) while 40 older areas sit idle, and nothing in use was made again. - **Creep: none found.** Over the second half of each run the mean use moves by less than one 64 MB block (5,442 → 5,421 MB, 3,791 → 3,791 MB). At the end, with everything let go, use was within 12 MB of the start once the empty texture blocks the pool keeps on purpose are subtracted. That's `SPARE_KEPT`: up to 64 blocks (4 GiB) while the card is under 85 %, dropped to 2 above it. The test fails if anything else is not given back. - One thing to know when reading DXGI numbers on 8 GB: those kept-empty blocks (3.7–4.1 GB at the end of these runs) count as "in use" for the system until use passes 85 %. They are not a leak, but they are memory other allocators see as taken. - My first version of the bench seemed to show creep. It touched the active textures only once per 3 s cycle, so above 95 % the sweep's 1.5 s rule let them go and they were made again every cycle (23,000 re-makes, 2.5 GB resting in blocks, 104 % of budget). Real frames use them every frame, so the bench now does too. ## Not measured - **No in-game run.** I can't say how GTA VI's textures split across sizes, how much of the 8 GB preset's frame time this saves, or how it looks. Capped textures are softer up close: the cap is 1024 on 8 GB and 2048 on 12 GB. - The #3505 creep (7.3 → 7.9 GB in 6 min) isn't reproduced by this synthetic run. Texture host copies, render-target churn and the texture pool all gave their memory back. If the creep is real on this base, it's elsewhere: card buffers, windows, by-address copies (`VICTORY_MEMORY_CARD_MB`, 4096 by default here, gated at 97 % of budget), or pipelines. - The cost of `keep_whole` replacing a capped copy the first time the card copies into it (one re-made, re-uploaded texture). ## Also checked (coordinator's question) - **`VICTORY_MEMORY_CARD_MB`** (the 1024 → 2048 "6×" on #3505's fork): this base reads it with a default of 4096 MB, gated at 97 % of budget (`shadow.rs` `by_address`). Neither TUNED nor the 8 GB preset sets it, so the preset doesn't starve the card that way. - **`VICTORY_HEAP_RECHECK`** is read here (default on). #3505's `=0` (prepare 44 → 29 ms) trades correctness for late-filled textures. I left it alone. ## Tests (rule 5) - `resource::tests::a_texture_over_the_size_cap_keeps_the_levels_within_it`, on the host device: - a placed 4096² BC7 texture under a 1024 cap gets a 1024² host copy with 11 levels and base 2, while the title's texture stays 4096; - a view of level 0 keeps the capped copy; - a 1024² texture stays whole; - `keep_whole` replaces the copy with a whole 4096 one. - **It fails before:** with the cap unread (main's behaviour), the copy is `(0, 4096, 4096, 13)`, not `(2, 1024, 1024, 11)`. - `texture::read_marks_tests::a_texture_uncapped_after_a_read_stages_its_whole_copy` (after #444, whose reads take a texture's staged first level without the table's lock): a capped texture is read (staged from level 2), then uncapped; the staged level goes back to "none" at the swap, a late staging of the replaced capped copy (`HostTexture::replaced`) doesn't bring it back, and the same list's next read stages the whole copy. It fails without the reset at the swap, and without the `replaced` check. - `tiles::tests::the_size_cap_is_read_and_cuts_the_levels_above_it`: parsing (unset, 0, junk, minimum 256) and the first level within the cap. - `descriptor::host::tests::views_count_from_the_first_level_of_the_host_copy`: now also covers a 2D array view. - Launcher: `every_variable_an_option_names_exists_in_victorys_sources` without its exception fails on main (`VICTORY_TEXTURE_MAX_SIZE is read nowhere`) and passes here. Run on the rebased head (main `a4453083`, with #444), `cargo test -p victory-gpu --lib`, one thread: | | this PR | main | |---|---|---| | RTX 4060 Laptop | 469 passed | 466 passed | | Intel UHD (`VICTORY_D3D12_ADAPTER=Intel`) | 468 passed, 1 failed | 465 passed, 1 failed | | WARP (`--features diagnostics`) | 524 passed, 1 failed | 521 passed, 1 failed | The Intel failure (`anisotropic_heap_sampler_reads_the_requested_mip`, a raw D3D12 sampler test this PR doesn't touch) and the WARP one (`timeline::report::tests::real_waits_are_recorded_with_who_ended_them`) fail the same way on main. Also: `cargo test -p anyxboxx-launcher --release` 217 passed, 1 ignored; clippy (`--all-targets`, with and without `diagnostics`) no new warnings; `cargo xtask policy` ok (296 files); CI build step (cargo release workspace build, runtime CMake, TomBox DLLs) ok; ruff (`W605,F,E9`), `test_readme_sync`, and pytest `test_lanceur_victory`, `test_rust_native_launcher_parity`, `test_launch` clean (13 passed, 3 skipped). A short `vram_churn` rerun (15 cycles, 28 areas) on this head: host textures 1,470 MB capped vs 3,630 MB uncapped, budget peak 32 % vs 62 %. ## Asking for an A/B on an 8 GB card @YUYING234 (VIctory #3505) and @lmouz823-lang (VIctory #735), you have RTX 4060 Laptop 8 GB cards. Could one of you run AnyXboxX with the **8 GB card** preset on `main` and on this branch, at the same spot for about 6 minutes? Same build, alternating A/B/A after a first warm-up run. The useful numbers are: - the frame-time median and 10th percentile (`VICTORY_FRAMETIME_DUMP=1`); - the card's memory in use against its budget over time (the log's memory lines); - the new line `texture size cap 1024 ... lifted from N textures`; - whether anything looks wrong (black or missing textures, or textures soft enough to matter). _AI use: written with Claude Code (Claude Opus 5.5): code, tests, bench and this text. I reviewed it and ran every test and bench on my own RTX 4060 Laptop / Intel UHD / WARP machine._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
LooperSalty commented 2026-11-27 15:49:12 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by LooperSalty on 2026-11-27T15:49:12Z.


This now conflicts with main after #444 in third_party/victory/crates/victory-gpu/src/resource.rs, in two places: the Hosted struct and its initializer in the resource-creation path. #444 added host_written: AtomicBool, staged_first: AtomicU32 (u32::MAX) and no_target: AtomicU32 (0); this PR adds whole and capped. Keep all five fields and all five initializers.

After the rebase, please check one interaction: #444 reads staged_first and host_written without the table lock (resource::staged_first, set_staged_first). When cap_base / keep_whole / want_level swap a capped host copy for a whole one (or the reverse), the first level the staging buffer holds changes, so those cached values must be reset or recomputed at the swap. A test that caps a texture, reads it, then uncaps it and checks the staged first level would cover it. Then rerun texture::read_marks_tests and your own tests on the rebased branch.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7222520288 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/506#issuecomment-7222520288). Originally posted by [LooperSalty](https://github.com/LooperSalty) on 2026-11-27T15:49:12Z. --- This now conflicts with main after #444 in `third_party/victory/crates/victory-gpu/src/resource.rs`, in two places: the `Hosted` struct and its initializer in the resource-creation path. #444 added `host_written: AtomicBool`, `staged_first: AtomicU32` (`u32::MAX`) and `no_target: AtomicU32` (0); this PR adds `whole` and `capped`. Keep all five fields and all five initializers. After the rebase, please check one interaction: #444 reads `staged_first` and `host_written` without the table lock (`resource::staged_first`, `set_staged_first`). When `cap_base` / `keep_whole` / `want_level` swap a capped host copy for a whole one (or the reverse), the first level the staging buffer holds changes, so those cached values must be reset or recomputed at the swap. A test that caps a texture, reads it, then uncaps it and checks the staged first level would cover it. Then rerun `texture::read_marks_tests` and your own tests on the rebased branch.
KainanP commented 2026-11-27 16:35:35 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by KainanP on 2026-11-27T16:35:35Z.


Rebased onto main a4453083 (with #444) and force-pushed. Point by point:

1. Conflicts in Hosted and its initializer. I kept all five fields (host_written, staged_first, no_target from #444, then whole, capped) and all five initializers (false, u32::MAX, 0, false, false). These were the only two conflicts.

2. staged_first / host_written when the cap swaps a copy.

  • staged_first was already reset at each swap. keep_whole and want_level (and the idle sweep) call texture::unstage(this) under the texture's made lock, before made.take(). unstage removes the staging buffer and stores u32::MAX under the staging table's lock.
  • The reverse swap (whole back to capped) has no path of its own. whole never goes back to false, and under the cap want_level never grows a copy past cap_base. So a texture only goes back to capped when the sweep lets its copy go and a new one is made later, and the sweep calls unstage too.
  • One gap was left, and it's fixed in a new commit 61cb82ee. A recording thread could take the capped copy (host_copy) just before the swap and call staging for it just after. staging would then store that buffer in the table again and write its first level back (2 for a 4096 texture capped at 1024). A later read in the same list from level 2 or higher would treat the new whole copy as already staged and skip its upload. Now the swap marks the old copy HostTexture::replaced before unstage. staging still gives that copy's buffer to the list that asked for it, but doesn't store it in the table or write its level. The flag is set before unstage takes the table lock, and staging reads it under that same lock, so either the swap's unstage removes the entry or staging sees the flag.
  • host_written needs nothing at the swap. keep_whole runs before the copy or resolve marks the texture (list.rs: keep_whole is called before the host copies are asked for, texture::host_written after). A whole copy (base 0) is never replaced by want_level (it returns when host.base == 0), and the sweep skips textures the host wrote (texture::host_wrote). So no copy is ever swapped after the host wrote it.

3. Test. I added the one you described, texture::read_marks_tests::a_texture_uncapped_after_a_read_stages_its_whole_copy. It caps a placed 4096² BC7 texture at 1024 and reads it in a list: the copy has base 2 and the staged first level is 2. Then it uncaps it (keep_whole): the staged level is u32::MAX and the table has no entry. A late staging of the capped copy doesn't bring the level back. The same list reads again from level 2, which stages the whole copy (the staging's serial is the whole copy's). Another list reads from level 0, and the staged level is 0. I checked that the test fails in both cases it covers:

  • without unstage in keep_whole, it fails with "the swap let the capped copy's staging go" (2 ≠ u32::MAX);
  • without the replaced check in staging, it fails with "not the texture's staging" (2 ≠ u32::MAX).

4. Reruns on the rebased head (61cb82ee), cargo test -p victory-gpu --lib, one thread:

this PR main a4453083
RTX 4060 Laptop 469 passed 466 passed
Intel UHD (VICTORY_D3D12_ADAPTER=Intel) 468 passed, 1 failed 465 passed, 1 failed
WARP (--features diagnostics) 524 passed, 1 failed 521 passed, 1 failed
  • The Intel failure is anisotropic_heap_sampler_reads_the_requested_mip and the WARP one is timeline::report::tests::real_waits_are_recorded_with_who_ended_them. Both fail the same way on main.
  • texture::read_marks_tests (6 tests, the new one included) and the cap tests (a_texture_over_the_size_cap_keeps_the_levels_within_it, the_size_cap_is_read_and_cuts_the_levels_above_it, a_placed_texture_is_kept_from_the_level_viewed) all pass.
  • vram_churn, a short release run (15 cycles, 28 areas, room 85 %): 1,470 MB of host textures and a 32 % budget peak capped, against 3,630 MB and 62 % uncapped. Nothing over budget, and no memory left unreturned.
  • cargo test -p anyxboxx-launcher --release: 217 passed, 1 ignored. Launcher pytest (test_lanceur_victory, test_rust_native_launcher_parity, test_launch): 13 passed, 3 skipped.
  • Clippy (--all-targets, with and without diagnostics) has no new warnings against main. cargo xtask policy passes (296 files), ruff (W605,F,E9) and test_readme_sync are clean, and the CI build step passes (cargo release workspace build, runtime CMake, TomBox DLLs).

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7223441074 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/506#issuecomment-7223441074). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T16:35:35Z. --- Rebased onto main a4453083 (with #444) and force-pushed. Point by point: **1. Conflicts in `Hosted` and its initializer.** I kept all five fields (`host_written`, `staged_first`, `no_target` from #444, then `whole`, `capped`) and all five initializers (`false`, `u32::MAX`, `0`, `false`, `false`). These were the only two conflicts. **2. `staged_first` / `host_written` when the cap swaps a copy.** - **`staged_first` was already reset at each swap.** `keep_whole` and `want_level` (and the idle sweep) call `texture::unstage(this)` under the texture's `made` lock, before `made.take()`. `unstage` removes the staging buffer and stores `u32::MAX` under the staging table's lock. - **The reverse swap (whole back to capped) has no path of its own.** `whole` never goes back to false, and under the cap `want_level` never grows a copy past `cap_base`. So a texture only goes back to capped when the sweep lets its copy go and a new one is made later, and the sweep calls `unstage` too. - **One gap was left, and it's fixed in a new commit `61cb82ee`.** A recording thread could take the capped copy (`host_copy`) just before the swap and call `staging` for it just after. `staging` would then store that buffer in the table again and write its first level back (2 for a 4096 texture capped at 1024). A later read in the same list from level 2 or higher would treat the new whole copy as already staged and skip its upload. Now the swap marks the old copy `HostTexture::replaced` before `unstage`. `staging` still gives that copy's buffer to the list that asked for it, but doesn't store it in the table or write its level. The flag is set before `unstage` takes the table lock, and `staging` reads it under that same lock, so either the swap's `unstage` removes the entry or `staging` sees the flag. - **`host_written` needs nothing at the swap.** `keep_whole` runs before the copy or resolve marks the texture (`list.rs`: `keep_whole` is called before the host copies are asked for, `texture::host_written` after). A whole copy (base 0) is never replaced by `want_level` (it returns when `host.base == 0`), and the sweep skips textures the host wrote (`texture::host_wrote`). So no copy is ever swapped after the host wrote it. **3. Test.** I added the one you described, `texture::read_marks_tests::a_texture_uncapped_after_a_read_stages_its_whole_copy`. It caps a placed 4096² BC7 texture at 1024 and reads it in a list: the copy has base 2 and the staged first level is 2. Then it uncaps it (`keep_whole`): the staged level is `u32::MAX` and the table has no entry. A late `staging` of the capped copy doesn't bring the level back. The same list reads again from level 2, which stages the whole copy (the staging's `serial` is the whole copy's). Another list reads from level 0, and the staged level is 0. I checked that the test fails in both cases it covers: - without `unstage` in `keep_whole`, it fails with "the swap let the capped copy's staging go" (2 ≠ `u32::MAX`); - without the `replaced` check in `staging`, it fails with "not the texture's staging" (2 ≠ `u32::MAX`). **4. Reruns on the rebased head (`61cb82ee`)**, `cargo test -p victory-gpu --lib`, one thread: | | this PR | main a4453083 | |---|---|---| | RTX 4060 Laptop | 469 passed | 466 passed | | Intel UHD (`VICTORY_D3D12_ADAPTER=Intel`) | 468 passed, 1 failed | 465 passed, 1 failed | | WARP (`--features diagnostics`) | 524 passed, 1 failed | 521 passed, 1 failed | - The Intel failure is `anisotropic_heap_sampler_reads_the_requested_mip` and the WARP one is `timeline::report::tests::real_waits_are_recorded_with_who_ended_them`. Both fail the same way on main. - `texture::read_marks_tests` (6 tests, the new one included) and the cap tests (`a_texture_over_the_size_cap_keeps_the_levels_within_it`, `the_size_cap_is_read_and_cuts_the_levels_above_it`, `a_placed_texture_is_kept_from_the_level_viewed`) all pass. - `vram_churn`, a short release run (15 cycles, 28 areas, room 85 %): 1,470 MB of host textures and a 32 % budget peak capped, against 3,630 MB and 62 % uncapped. Nothing over budget, and no memory left unreturned. - `cargo test -p anyxboxx-launcher --release`: 217 passed, 1 ignored. Launcher pytest (`test_lanceur_victory`, `test_rust_native_launcher_parity`, `test_launch`): 13 passed, 3 skipped. - Clippy (`--all-targets`, with and without `diagnostics`) has no new warnings against main. `cargo xtask policy` passes (296 files), ruff (`W605,F,E9`) and `test_readme_sync` are clean, and the CI build step passes (cargo release workspace build, runtime CMake, TomBox DLLs). _AI use: Claude Code (Claude Opus 5.5)._
lmouz823-lang commented 2026-11-28 02:30:03 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by lmouz823-lang on 2026-11-28T02:30:03Z.


@KainanP, here is an RTX 4060 Laptop 8 GB datapoint from the original PR head b8dbb614332ff17c0a43135a286112b60e7b15e4, against its base 14f488bca62f4cb63294a48324e89b548368ea33, in A/B/A order. I see that the rebased 61cb82ee has since been merged. These measurements cover the earlier revision.

The machine has an i9-14900HX with 24 logical processors available, 64 GB RAM, Windows 11 build 26200 and NVIDIA driver 610.88. Both engines used the optimized diag profile with diagnostics, Series X at 1920×1080, and the launcher's Windows/NVIDIA tuned settings plus its 8 GB preset. The preset values were VICTORY_CARD_WINDOWS_MB=512, VICTORY_CARD_BUFFERS_MB=512, VICTORY_TEXTURE_ROOM_PERCENT=85 and VICTORY_TEXTURE_MAX_SIZE=1024.

After warm-up, each run started from a fresh copy of the same prison-mission save and warmed cache, with identical scripted input. Each run had a 600-second limit. The table uses the final approximately 360 seconds with VICTORY_FRAMETIME_DUMP=1. Its quantiles are calculated over the CSV's roughly one-second summary intervals.

Final six minutes A1 base B original PR head A2 base
Summary-interval FPS median 4.8740 4.7485 4.6180
Summary-interval FPS 10th percentile 3.8352 3.8010 2.7608
Summary-interval frame-time median, ms 205.152 210.595 216.536
Total frames / summed interval time, FPS 5.5287 5.2747 5.3123
Peak process DXGI local usage, MiB 6654 6658 6648
Minimum local budget, MiB 7060 7065 7079
Over-budget periodic samples / samples 0 / 65 0 / 64 0 / 63
Peak host textures, MiB 3412 3427 3404
Peak title-filled host textures, MiB 1795 1796 1817

The PR build logged cap=1024, levels_on_demand=false and, by the end, texture size cap 1024 ... lifted from 320 textures the card copies into or out of. All three runs reached their planned cutoff with no launcher cleanup errors. Both builds carried the same local victory-core AppContainer scratch-path compatibility shim for the isolated launcher.

This replay showed little change in texture memory or local VRAM usage. The PR's interval FPS median lies between the two baseline values. Camera and story/QTE events still varied during the sampling windows, so this was a same-start replay with scene variation. Those limits prevent a firm attribution of the small FPS differences. Paired image-quality assessment remains incomplete because the views did not stay aligned. The baseline also remained under budget at the sampled points, leaving behavior in a persistently over-budget scene open.

AI-assisted testing and reporting with Codex. Results were collected on this machine and checked against the original CSVs and runtime logs.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7232403156 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/506#issuecomment-7232403156). Originally posted by [lmouz823-lang](https://github.com/lmouz823-lang) on 2026-11-28T02:30:03Z. --- @KainanP, here is an RTX 4060 Laptop 8 GB datapoint from the original PR head `b8dbb614332ff17c0a43135a286112b60e7b15e4`, against its base `14f488bca62f4cb63294a48324e89b548368ea33`, in A/B/A order. I see that the rebased `61cb82ee` has since been merged. These measurements cover the earlier revision. The machine has an i9-14900HX with 24 logical processors available, 64 GB RAM, Windows 11 build 26200 and NVIDIA driver 610.88. Both engines used the optimized `diag` profile with `diagnostics`, Series X at 1920×1080, and the launcher's Windows/NVIDIA tuned settings plus its 8 GB preset. The preset values were `VICTORY_CARD_WINDOWS_MB=512`, `VICTORY_CARD_BUFFERS_MB=512`, `VICTORY_TEXTURE_ROOM_PERCENT=85` and `VICTORY_TEXTURE_MAX_SIZE=1024`. After warm-up, each run started from a fresh copy of the same prison-mission save and warmed cache, with identical scripted input. Each run had a 600-second limit. The table uses the final approximately 360 seconds with `VICTORY_FRAMETIME_DUMP=1`. Its quantiles are calculated over the CSV's roughly one-second summary intervals. | Final six minutes | A1 base | B original PR head | A2 base | | --- | ---: | ---: | ---: | | Summary-interval FPS median | 4.8740 | 4.7485 | 4.6180 | | Summary-interval FPS 10th percentile | 3.8352 | 3.8010 | 2.7608 | | Summary-interval frame-time median, ms | 205.152 | 210.595 | 216.536 | | Total frames / summed interval time, FPS | 5.5287 | 5.2747 | 5.3123 | | Peak process DXGI local usage, MiB | 6654 | 6658 | 6648 | | Minimum local budget, MiB | 7060 | 7065 | 7079 | | Over-budget periodic samples / samples | 0 / 65 | 0 / 64 | 0 / 63 | | Peak host textures, MiB | 3412 | 3427 | 3404 | | Peak title-filled host textures, MiB | 1795 | 1796 | 1817 | The PR build logged `cap=1024`, `levels_on_demand=false` and, by the end, `texture size cap 1024 ... lifted from 320 textures the card copies into or out of`. All three runs reached their planned cutoff with no launcher cleanup errors. Both builds carried the same local `victory-core` AppContainer scratch-path compatibility shim for the isolated launcher. This replay showed little change in texture memory or local VRAM usage. The PR's interval FPS median lies between the two baseline values. Camera and story/QTE events still varied during the sampling windows, so this was a same-start replay with scene variation. Those limits prevent a firm attribution of the small FPS differences. Paired image-quality assessment remains incomplete because the views did not stay aligned. The baseline also remained under budget at the sampled points, leaving behavior in a persistently over-budget scene open. _AI-assisted testing and reporting with Codex. Results were collected on this machine and checked against the original CSVs and runtime logs._
lmouz823-lang commented 2026-11-28 15:49:54 +00:00 (Migrated from github.com)

Imported from LooperSalty/AnyXboxX. Originally posted by lmouz823-lang on 2026-11-28T15:49:54Z.


@KainanP, a follow-up to my RTX 4060 Laptop A/B/A results above. I also tried the official trustno1-coder/VIctory-NVIDIA release v2026.11.28.01 (source 63b902fe, Streamline 2.14.16). These latest results come from that fork.

Machine and current setup

  • RTX 4060 Laptop 8 GB, i9-14900HX with 24 logical processors available, 64 GB RAM, Windows 11 build 26200, NVIDIA 610.88.
  • Series S, 1920×1080 output, DLSS Quality at 1280×720 internally, DLSS frame generation 2×.
  • VICTORY_VRAM_BUDGET_MB=6144, default render-target reserve, VICTORY_JOIN_PARTS=8, default 8 refresh helpers. The FG path uses texture room 80%.
  • The game is playable for me and the Quality run felt good, but I would like to improve the low base frame rate.

Longer gameplay result

A manually played session accumulated 900.298 seconds of effective 3D frame-time coverage after excluding pause/loading intervals. It averaged 12.47 application Present FPS / 24.62 SDK-reported shown FPS. Later outdoor/driving sections were around 7.4–10.2 base FPS. The selected window logged no NGX out-of-memory, device-loss or crash events, although stalls remained (22.94% of base frames exceeded 100 ms).

Earlier Series X / 1440p / DLSS Performance / FG2 attempts hit NGX SetOptions 39 (out of VRAM), including a device-removed failure with device-hung reason. This led to the current 1080p setup.

What I tried next

I froze the latest boat checkpoint and warmed cache, verified matching save/cache content hashes for every run, and ran six 420-second trials with the same scripted startup input. The comparison window was seconds 300–420.

Configuration Application Present FPS SDK shown FPS
Quality, JOIN 8, default helpers 13.193 26.386
Balanced, JOIN 8 13.535 27.071
Quality, JOIN 8, return run 11.613 23.225
Quality, JOIN 8, 4 refresh helpers 11.686 23.371

JOIN 16 did not increase the median actual joins per frame (about 21 in both cases). Its window also mixed FG-off/low-draw intervals, so it did not establish a benefit. A further FG-off trial kept DLSS Quality and explicitly kept texture room at 80%, but progressed into a different binocular-view scene, preventing a clean attribution of FG overhead.

The route and camera progressed differently between runs. Those differences and the same-setting return run prevent a firm claim for the small Balanced or helper-count changes. I also ran warm --used --jobs 8 on 4,069 used pipelines (4 had no host pipeline, 0 child-process failures), with its steady-state benefit unquantified.

For context, the first Quality boat window logged medians of about 28.0 ms preparing / 9.3 ms CPU copies, and about 73.2 ms submission-worker wall time. The copies timing is included in preparation. Time inside proxy Present averaged about 22.6 ms in that window and 14.0 ms in the return run. These overlapping wall-clock counters include waiting.

Which optimization direction would you prioritize for this particular 8 GB laptop? Is there a specific engine setting, profiler counter, or reproducible scene/test you would suggest to isolate the remaining bottleneck? I would also appreciate your view on whether testing current AnyXboxX main and its 8 GB preset would be the most useful next comparison after the merged VRAM fixes.

AI-assisted testing and reporting with Codex. Figures were checked against local frame-time and runtime logs.

<!-- greyfinch-sync:LooperSalty/AnyXboxX:comment:7241768682 --> Imported from [LooperSalty/AnyXboxX](https://github.com/LooperSalty/AnyXboxX/pull/506#issuecomment-7241768682). Originally posted by [lmouz823-lang](https://github.com/lmouz823-lang) on 2026-11-28T15:49:54Z. --- @KainanP, a follow-up to my RTX 4060 Laptop A/B/A results above. I also tried the official `trustno1-coder/VIctory-NVIDIA` release `v2026.11.28.01` (source `63b902fe`, Streamline 2.14.16). These latest results come from that fork. **Machine and current setup** - RTX 4060 Laptop 8 GB, i9-14900HX with 24 logical processors available, 64 GB RAM, Windows 11 build 26200, NVIDIA 610.88. - Series S, 1920×1080 output, DLSS Quality at 1280×720 internally, DLSS frame generation 2×. - `VICTORY_VRAM_BUDGET_MB=6144`, default render-target reserve, `VICTORY_JOIN_PARTS=8`, default 8 refresh helpers. The FG path uses texture room 80%. - The game is playable for me and the Quality run felt good, but I would like to improve the low base frame rate. **Longer gameplay result** A manually played session accumulated 900.298 seconds of effective 3D frame-time coverage after excluding pause/loading intervals. It averaged **12.47 application Present FPS / 24.62 SDK-reported shown FPS**. Later outdoor/driving sections were around **7.4–10.2 base FPS**. The selected window logged no NGX out-of-memory, device-loss or crash events, although stalls remained (22.94% of base frames exceeded 100 ms). Earlier Series X / 1440p / DLSS Performance / FG2 attempts hit NGX SetOptions 39 (out of VRAM), including a device-removed failure with device-hung reason. This led to the current 1080p setup. **What I tried next** I froze the latest boat checkpoint and warmed cache, verified matching save/cache content hashes for every run, and ran six 420-second trials with the same scripted startup input. The comparison window was seconds 300–420. | Configuration | Application Present FPS | SDK shown FPS | | --- | ---: | ---: | | Quality, JOIN 8, default helpers | 13.193 | 26.386 | | Balanced, JOIN 8 | 13.535 | 27.071 | | Quality, JOIN 8, return run | 11.613 | 23.225 | | Quality, JOIN 8, 4 refresh helpers | 11.686 | 23.371 | JOIN 16 did not increase the median actual joins per frame (about 21 in both cases). Its window also mixed FG-off/low-draw intervals, so it did not establish a benefit. A further FG-off trial kept DLSS Quality and explicitly kept texture room at 80%, but progressed into a different binocular-view scene, preventing a clean attribution of FG overhead. The route and camera progressed differently between runs. Those differences and the same-setting return run prevent a firm claim for the small Balanced or helper-count changes. I also ran `warm --used --jobs 8` on 4,069 used pipelines (4 had no host pipeline, 0 child-process failures), with its steady-state benefit unquantified. For context, the first Quality boat window logged medians of about **28.0 ms preparing / 9.3 ms CPU copies**, and about **73.2 ms submission-worker wall time**. The copies timing is included in preparation. Time inside proxy Present averaged about 22.6 ms in that window and 14.0 ms in the return run. These overlapping wall-clock counters include waiting. **Which optimization direction would you prioritize for this particular 8 GB laptop?** Is there a specific engine setting, profiler counter, or reproducible scene/test you would suggest to isolate the remaining bottleneck? I would also appreciate your view on whether testing current AnyXboxX main and its 8 GB preset would be the most useful next comparison after the merged VRAM fixes. _AI-assisted testing and reporting with Codex. Figures were checked against local frame-time and runtime logs._
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!506
No description provided.