feat: texture size cap on the Vice-Tay base (VICTORY_TEXTURE_MAX_SIZE), so the 8 GB preset limits VRAM again #506
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/506"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 inthird_party/victoryreads that variable. The launcher test even listed it inUNREAD_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.rscap_base, throughbase_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.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.want_level). The texture store's larger levels aren't used for a capped copy.CopyResource,CopyTextureRegionandResolveSubresourcename subresources by level number. So before the host copies are asked for,keep_wholelifts the cap from both textures for good, and a capped copy is replaced by a whole one (the same pathwant_leveluses). The memory line counts these (lifted from N textures).VICTORY_LEVELS_ON_DEMAND=1, the Neptune behaviour is ported as it was: levels over the cap are never held and get no tiles.every_variable_an_option_names_exists_in_victorys_sourcesruns without theUNREAD_BY_VICE_TAYexception again.Credit: the cap,
first_within,over_capand theheld_levelschange are ported from the Neptune-base commit9e878913by 4276b5yjdw-pixel3 (co-author on the commit,Source:line per rule 10). The held-levels path,keep_wholeand 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):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).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:
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.Not measured
VICTORY_MEMORY_CARD_MB, 4096 by default here, gated at 97 % of budget), or pipelines.keep_wholereplacing 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.rsby_address). Neither TUNED nor the 8 GB preset sets it, so the preset doesn't starve the card that way.VICTORY_HEAP_RECHECKis 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:keep_wholereplaces the copy with a whole 4096 one.(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 thereplacedcheck.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.every_variable_an_option_names_exists_in_victorys_sourceswithout 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:VICTORY_D3D12_ADAPTER=Intel)--features diagnostics)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 --release217 passed, 1 ignored; clippy (--all-targets, with and withoutdiagnostics) no new warnings;cargo xtask policyok (296 files); CI build step (cargo release workspace build, runtime CMake, TomBox DLLs) ok; ruff (W605,F,E9),test_readme_sync, and pytesttest_lanceur_victory,test_rust_native_launcher_parity,test_launchclean (13 passed, 3 skipped). A shortvram_churnrerun (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
mainand 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:
VICTORY_FRAMETIME_DUMP=1);texture size cap 1024 ... lifted from N textures;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
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: theHostedstruct and its initializer in the resource-creation path. #444 addedhost_written: AtomicBool,staged_first: AtomicU32(u32::MAX) andno_target: AtomicU32(0); this PR addswholeandcapped. Keep all five fields and all five initializers.After the rebase, please check one interaction: #444 reads
staged_firstandhost_writtenwithout the table lock (resource::staged_first,set_staged_first). Whencap_base/keep_whole/want_levelswap 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 reruntexture::read_marks_testsand your own tests on the rebased branch.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
Hostedand its initializer. I kept all five fields (host_written,staged_first,no_targetfrom #444, thenwhole,capped) and all five initializers (false,u32::MAX,0,false,false). These were the only two conflicts.2.
staged_first/host_writtenwhen the cap swaps a copy.staged_firstwas already reset at each swap.keep_wholeandwant_level(and the idle sweep) calltexture::unstage(this)under the texture'smadelock, beforemade.take().unstageremoves the staging buffer and storesu32::MAXunder the staging table's lock.wholenever goes back to false, and under the capwant_levelnever grows a copy pastcap_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 callsunstagetoo.61cb82ee. A recording thread could take the capped copy (host_copy) just before the swap and callstagingfor it just after.stagingwould 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 copyHostTexture::replacedbeforeunstage.stagingstill 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 beforeunstagetakes the table lock, andstagingreads it under that same lock, so either the swap'sunstageremoves the entry orstagingsees the flag.host_writtenneeds nothing at the swap.keep_wholeruns before the copy or resolve marks the texture (list.rs:keep_wholeis called before the host copies are asked for,texture::host_writtenafter). A whole copy (base 0) is never replaced bywant_level(it returns whenhost.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 isu32::MAXand the table has no entry. A latestagingof the capped copy doesn't bring the level back. The same list reads again from level 2, which stages the whole copy (the staging'sserialis 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:unstageinkeep_whole, it fails with "the swap let the capped copy's staging go" (2 ≠u32::MAX);replacedcheck instaging, 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:a4453083VICTORY_D3D12_ADAPTER=Intel)--features diagnostics)anisotropic_heap_sampler_reads_the_requested_mipand the WARP one istimeline::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.--all-targets, with and withoutdiagnostics) has no new warnings against main.cargo xtask policypasses (296 files), ruff (W605,F,E9) andtest_readme_syncare clean, and the CI build step passes (cargo release workspace build, runtime CMake, TomBox DLLs).AI use: Claude Code (Claude Opus 5.5).
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 base14f488bca62f4cb63294a48324e89b548368ea33, in A/B/A order. I see that the rebased61cb82eehas 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
diagprofile withdiagnostics, Series X at 1920×1080, and the launcher's Windows/NVIDIA tuned settings plus its 8 GB preset. The preset values wereVICTORY_CARD_WINDOWS_MB=512,VICTORY_CARD_BUFFERS_MB=512,VICTORY_TEXTURE_ROOM_PERCENT=85andVICTORY_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.The PR build logged
cap=1024,levels_on_demand=falseand, 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 localvictory-coreAppContainer 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.
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-NVIDIAreleasev2026.11.28.01(source63b902fe, Streamline 2.14.16). These latest results come from that fork.Machine and current setup
VICTORY_VRAM_BUDGET_MB=6144, default render-target reserve,VICTORY_JOIN_PARTS=8, default 8 refresh helpers. The FG path uses texture room 80%.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.
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 8on 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.