Iter 27: Fix VICTORY_LEVELS_ON_DEMAND bypassed by texture pool (2.6 GB VRAM leak) and tile eviction accounting #12
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12"
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 Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T04:06:11Z.
Summary
Fixes a critical bug where
VICTORY_LEVELS_ON_DEMAND=1created 0 reserved/tiled textures whenVICTORY_TEXTURE_POOL=1(the default), wasting 2.5–2.6 GB VRAM on unmapped mip levels and causing double allocation of full-size textures.Root Cause & Diagnosis
In a 6+ minute interactive open-world playtest on an 8 GiB RTX 4060 Ti (
playtest-20261128-043800.err.log, combined PRs #2–#10 build,VICTORY_TEXTURE_POOL=1,VICTORY_LEVELS_ON_DEMAND=1,VICTORY_LEVELS_ALL=1,VICTORY_LEVELS_MAX_DIM=2048):5.9–7.3 fps,78–102 mson GPU).card accountingreported 7,629 alive host copies (3,455 MB), of which 2,540–2,622 MB were unmapped mip levels, and0copies made level by level (0 MBof tiles).crates/victory-gpu/src/resource.rs::host_texture_as(..., reserved), thecrate::pool::texture(...)fast path ran without checking!reserved:hosted()requestedhost_texture_as(..., true)expecting aCreateReservedResourcetexture.host_texture_asallocated a full-size placed texture from a 64 MiB pool block instead.Tiled::make()rejected that non-reserved texture (GetResourceTilingreturnedtotal == 0).hosted()discarded the pool allocation and immediately calledhost_texture(..., false)to allocate the same full-size texture a second time (base = 0, becauseheld_only()isfalsewhentiles::wanted()istrue).Changes
crates/victory-gpu/src/resource.rs:use_texture_pool(reserved, filled, sample_count, has_clear, readable_layout)soreserved == truealways bypassescrate::pool::textureand creates aCreateReservedResourcetexture.HostTexture::card_bytes()(tiled.given_bytes()when tiled, elseself.bytes) solet_go_idleandslot_evictcount tiled VRAM accurately against sweep/eviction caps instead of treating every tiled texture as0bytes. (KeepsHostTexture::bytes == 0forHOST_TEXTURES[1]/KINDS[1]/room()soKINDS[1] + tiles::given_total()never double-counts.)reserved_textures_bypass_texture_poolandreserved_host_texture_is_tiled_even_with_texture_pool.crates/victory-gpu/src/tiles.rs:take()withcrate::host::not_resident(),crate::residency::allocation_error,crate::host::resident(), andcrate::host::mapped()on the livehost()device (matchingpool.rs) so newly mapped tile heaps are VA-mapped beforeUpdateTileMappings.Rig Specs Tested On
10.0.26300/ Driver32.0.16.2124Run Settings & Profile
release+diag@fc23fb3612b0866da92f77f309e6dbdeb6c71740series-s(unit + D3D12 device/WARP verification; full-game live smoke deferred while user's active playtest PID 33604 is occupying the RTX 4060 Ti)VICTORY_*Overrides: Targetedvictory-gpulive device testreserved_host_texture_is_tiled_even_with_texture_pool(with defaultVICTORY_TEXTURE_POOL=1) +levels_on_demandWARP D3D12 debug-layer testplaytest-20261128-043800.err.log, 6m+ interactive open world)Measurements & Verification
PID 33604) is running on the GPU; baseline combined PRs #2–#10 open-world playtest telemetry was5.9–7.3 fpswith2.5–2.6 GBunmapped mips and0tiled textures.off7,979–8,026 MB / 6,904 MB; live tiled smoke verification will be appended as a PR comment once the GPU is free.0across all D3D12 device & WARP tests (D3D12 debug layer on WARP reported 0 errors).cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy(asset policy: 294 files ok)cargo +1.98.1-x86_64-pc-windows-gnu test -p xtask(6 passed; 0 failed)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings(0 warnings)cargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings(0 warnings)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu -- --test-threads=1(450 passed; 0 failed; 36 ignored, includingreserved_textures_bypass_texture_poolandreserved_host_texture_is_tiled_even_with_texture_poolon RTX 4060 Ti)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu -- --ignored levels_on_demand --nocapture(1 passed; 0 failedon WARPTiledResourcesTier 3, 47UpdateTileMappingscalls in596 us)release&diag(--features diagnostics) builds (non_system_mingw_dlls=0viaobjdump -p)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T04:11:49Z.
Verification summary for
@fc23fb3(feat/iter27-levels-on-demand-pool-fix):46105962803):successin 5m14s (Clippy,Clippy, diagnostics build,Tests)Androtim/MiniVI): PRs#1–#12all reportMERGEABLEi7-13700F,RTX 4060 Ti 8 GiB,32 GiB RAM, Win1110.0.26300, Driver32.0.16.2124):cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy:294 files okcargo +1.98.1-x86_64-pc-windows-gnu test -p xtask:6 passed; 0 failedcargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings:0 warningscargo +1.98.1-x86_64-pc-windows-gnu clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings:0 warningscargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu -- --test-threads=1:450 passed; 0 failed; 36 ignored(includingreserved_textures_bypass_texture_pooland live RTX 4060 Tireserved_host_texture_is_tiled_even_with_texture_pool)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu -- --ignored levels_on_demand --nocapture:1 passed; 0 failedon WARP (TiledResourcesTier 3, debug layer on, 47UpdateTileMappingsin596 us)release&diag(--features diagnostics) builds:non_system_mingw_dlls=0(objdump.exe -p)verify-live.ps1deferred because the user's active playtest (PID 33604) is currently running on the GPU.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T04:46:36Z.
## Real In-World A/B Verification (
origin/mainvs PR #12 on RTX 4060 Ti 8 GiB, Mission-1 Golden Save)Tested
diagnosticsbuilds (main-diag.exevspr12-diag.exe) unattended through the Mission-1 dock/balcony 3D world (~11,024draws/frame).What PR #12 Fixed
VICTORY_TEXTURE_POOL=1now works in-world:levels_on_demand_alivewent from0(prior pre-PR12 bug where pool allocation bypassedTiled) to7,799tiled textures holding1,024 MBof card tiles (room_falsedropped33.3% -> 0.0%,unmapped_mipsmedian dropped486.5 -> 120.0 MB,mapped()stall rate dropped26.99 -> 14.26 ms/world_sec).0crashes,0no host textureerrors,15/24lit frames cleanly textured (median luma 103.25,0.0%near-black,edge_energy 13.58).Observed Finding with
VICTORY_LEVELS_ON_DEMAND=1+VICTORY_LEVELS_ALL=1play.rsdefaults (VICTORY_LEVELS_ON_DEMAND=0),baseline-mainran the11k-draw dock scene at6.1-7.2 fps(8.9 fpsoverall median across dock + balcony).VICTORY_LEVELS_ON_DEMAND=1+VICTORY_LEVELS_ALL=1dropped the same11k-draw dock scene to2.9 fps(26,190waiting textures vs7,121), inflatedmemory in blocksstaging buffers from384 MBto2,816 MB, and inflated total uploads from1,778 MBto11,337 MB(crates/victory-gpu/src/texture.rs::staging()still stages full mip chains fromfirst=0and pinson_demandstaging buffers becauseonce = once() && !on_demand).VICTORY_LEVELS_ON_DEMAND=0as the default inapps/victory/src/play.rsavoids that regression while PR #12 safely fixes theuse_texture_pool/HostTexture::card_bytes()/tiles::takeaccounting bugs;on_demandstaging bloat will be addressed in a separate follow-up PR.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T05:03:08Z.
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingAutomated Review Summary
Verdict:
needs-gpu-test— CI is passing, the root-cause fix and tile eviction accounting look sound, and full-game live GPU verification is still needed (and noted as deferred in the PR description) since this activatesCreateReservedResource+ 64 MiB tile heap allocation under defaultVICTORY_TEXTURE_POOL=1.Verified Changes
crates/victory-gpu/src/resource.rs(use_texture_pool,host_texture_as):host_texture_as(..., reserved)enteredcrate::pool::texture(...)without checking!reserved, returning a placed non-reserved texture thatTiled::makerejected and causing a fallback full-size allocation.use_texture_pool(reserved, filled, sample_count, has_clear, readable_layout)with!reservedcleanly bypasses the texture pool for reserved textures while preserving existing pool conditions.reserved_textures_bypass_texture_poolandreserved_host_texture_is_tiled_even_with_texture_poolcover the predicate and live D3D12Tiled::makepath. (Minor note:assert!(crate::pool::on(), ...)in the latter test will fail ifcargo testis run withVICTORY_TEXTURE_POOL=0in the environment.)crates/victory-gpu/src/resource.rs(HostTexture::card_bytes,let_go_idle,slot_evict):HostTexture::new_tiledkeepsbytes: 0to avoid double-counting againstHOST_TEXTURES[1]/tiles::STATS[2]. UsingHostTexture::card_bytes()(tiled.given_bytes()when tiled, elseself.bytes) inlet_go_idleandslot_evictfixesoldest_covering(copies, need)so tiled textures count toward the eviction byte cap rather than contributing0bytes and over-evicting.crates/victory-gpu/src/tiles.rs(take):D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES | crate::host::not_resident(), reportsCreateHeapfailures tocrate::residency::allocation_error, and ensurescrate::host::resident+crate::host::mapped(when matchinghost().device) succeed before inserting the heap intoPOOLor incrementingSTATS[3].Local GPU Smoke Test Needed
Because
VICTORY_LEVELS_ON_DEMAND=1was previously a no-op withVICTORY_TEXTURE_POOL=1, this change exercises reserved textures,UpdateTileMappings, andPOOL-lockedCreateHeap/resident/mappedcalls in real gameplay for the first time:VICTORY_TEXTURE_POOL=1(default) andVICTORY_LEVELS_ON_DEMAND=1(plusVICTORY_LEVELS_ALL=1/VICTORY_LEVELS_MAX_DIM=2048if matching the baseline).tiles::take, no black/missing mip visuals, and clean eviction underVICTORY_SLOT_EVICT=1.(This is an automated triage review, not formal maintainer approval.)
Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T21:11:11Z.
Real-GPU Playtest Report (Combined Build 1 Stack — RT OFF)
Tested in combined Build 1 (
origin/main+ Build 1 PRs#2, #3, #4, #6, #7, #9, #10, #11, #12, #14, #15, #18, #19, #22, #25, #26, #27, #33, #34, #36, #40, #43, #44, #46) on NVIDIA GeForce RTX 4060 Ti (8 GB), Windows, Series S (quality-720p, DLSS Quality):1a-build1-world.log) — 0 crashes, 0 DRED resets, clean exit.28.2 fps(35.4 ms/frame) mid-run,16.9 fps(59.3 ms/frame,4,446draws/frame) in heavy scene.tearing=true,0refused presents.926c46bab3b86bd6): Translated and built host PSO cleanly.VICTORY_THIN_GATE): Active (0no free dynamic descriptor slotswarnings).6,934 MBin use (33texture blocks =2,112 MB,1,036 MBfree),0bogusPOOL:errors.16,577upscalings (0failed).8,802textures were still queued /206non-RT draws dropped without a host pipeline; no D3D12 errors.