victory-gpu: enable texture readback buffer pool by default (64 MiB cap) #21
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21"
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-28T06:33:03Z.
Summary
Enable texture readback buffer pooling by default with a
64 MiBidle cap and pressure trimming incrates/victory-gpu/src/host.rs:parse_texture_readback_idle_limitand defaultVICTORY_READBACK_POOLto enabled (VICTORY_READBACK_POOL=0disables pooling) with a default idle cap of64 MiB(overridable viaVICTORY_READBACK_POOL_MB).ReadbackPool::trim()and invoke it fromtrim_spare_chunks()so idle readback buffers are drained wheneverresidency::pressured()triggers (even whenSPAREscratch chunks are empty), while active leases remain untouched.readback_pool_defaults_on_at_64_mib_and_respects_overridesandreadback_pool_trim_releases_idle_buffers_without_disturbing_active_leases.Rig Specs Tested On
13th Gen Intel(R) Core(TM) i7-13700FNVIDIA GeForce RTX 4060 Ti(8 GiBVRAM)32 GiBWindows 11 Home (Build 26300)/ NVIDIA Driver32.0.16.2124Run Settings & Profile
release&--release --features victory-gpu/diagnostics@8878f5eb96c9356874815e240f316135896803d9(0non-system MinGW DLLs each)series-soffDLSS qualityoffVICTORY_*Overrides:D:\victory-build\verify-tools\verify-world.ps1withpr21-diag.exe,-GoldenDataDir 'D:\victory-data\golden-data-minivi',-WorldSeconds 75,-AutoNudgeMenu(VICTORY_READBACK_POOLleft unset to exercise the new default)dock->balcony), 75s in-world telemetry (14world windows, max11,197draws/frame)Measurements & Verification
copied=7,168readbacks vs unpooledpr19-typed-uav):pr19-typed-uav):created=8,029,reused=0,allocation_us=4,117,872(4.12 s),peak_allocation_us=16,807,active_bytes=10,289,152pr21-readback-pool):created=1,364,reused=6,681(83.0% reuse),allocation_us=717,980(0.72 s, 5.7x reduction),peak_allocation_us=6,348,active_bytes=7,602,176,idle_bytes=8,126,464(7.75 MiB),peak_idle_bytes=17,301,504(16.50 MiB),allocation_failures=09.2–10.9 fps(peaking at10.9 fps/91.9 ms/frame, vsbaseline-main8.9–10.6 fps),final_waiting=4,197(vs7,121baseline). Raw 14-window median was5.05 fpsdue to-AutoNudgeMenuentering the dock while pipelines were compiling (waiting for pipelines = 421.3–429.4 ms/frameduring dock windows). VisualsPASS:lit=9/24,luma=103.04,edge_energy=6.97,magenta=0.0%(inspectedframe-8097.pngwater/dock &frame-9345.pngbalcony).off5,749.0 MBmedian /5,923 MBpeak of6,924 MBbudget (over=0 MB,room_false=7.1%vs33.3%baseline)0(crashes=0,no_host_texture_errors=0)cargo +1.98.1-x86_64-pc-windows-gnu xtask 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(0warnings)cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features victory-gpu/diagnostics -- -D warnings(0warnings)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu(450 passed; 0 failed; 36 ignored, includingreadback_pool_defaults_on_at_64_mib_and_respects_overridesandreadback_pool_trim_releases_idle_buffers_without_disturbing_active_leases)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T06:44:01Z.
Follow-up commit
a78e9bc08a8c34b90901abcf9695ed4d5a4512f5: switchedReadbackPool::trim()from wiping all idle buffers on every pressure tick toSpare::trim()(low-watermark eviction).In the
pr21-readback-pool75s telemetry run,createdstayed flat at66(100% cache hit acrosscopied=128..512) untilresidency::pressured()fired at frame8029and cleared activeidle_bytes, drivingcreatedfrom66to1,364acrosscopied=512..7,168. WithSpare::trim(), actively cycled readback buffers resetlowontake()and survive pressure ticks while only genuinely idle buffers are evicted. Verified viareadback_pool_tests(6 passed),xtask policy(294 files ok), both workspaceclippypasses (0warnings), and clean--releasebuild (0non-system MinGW DLLs).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T07:03:06Z.
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
This PR enables the texture readback buffer pool by default in
crates/victory-gpu/src/host.rswith a64 MiBidle cap (VICTORY_READBACK_POOL=0to disable,VICTORY_READBACK_POOL_MBto override), addsReadbackPool::trim()invoked fromtrim_spare_chunks(), and adds unit tests for both.Verified Findings
parse_texture_readback_idle_limit): Cleanly handles default64 MiB, explicit disable viaVICTORY_READBACK_POOL=0, and customVICTORY_READBACK_POOL_MB(including0and overflow viachecked_mul), cached intexture_readback_idle_limit().ReadbackPool::trim): Updatesstats.idle_bytesunder the pool mutex and drops the evictedID3D12Resources outside the lock, consistent withReadbackLease::drop. Active leases are untouched.trim_spare_chunks): UnlikeSPAREandSPARE_LIST_UPLOAD(which are drained completely intrim_spare_chunks()),ReadbackPool::trim()delegates toSpare::trim(), which uses a two-window low-watermark policy. As tested inreadback_pool_trim_releases_idle_buffers_without_disturbing_active_leases, the first pressure call only recordslowand frees0bytes, and subsequent calls only evict buffers that stayed continuously idle across calls. That avoids thrashing actively cycled pools, though it will not immediately reclaim readback memory on a single sudden pressure spike.texture_readback_idle_limit() != 0by default also activatesHost::verify_texture_readback_fence()on synchronous wait paths by default, enforcing that pooled buffers are not retired before GPU fence completion.Verdict
needs-gpu-test— CI is passing and the implementation/tests are sound, but changing the D3D12 host's default texture readback pooling and memory-budget behavior warrants a local real-GPU smoke test before merging.Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T00:49:03Z.
Rebased onto
origin/main(6e935d7->777e90f):Changes
crates/victory-gpu/src/host.rs(trim_spare_chunks).Verification (
777e90f)cargo run -p xtask -- policy(301 files ok),cargo test -p xtask(6 passed),clippy --workspace --all-targets -- -D warnings(0warnings, both plain and--features diagnostics).victory-gpu --lib host::(127 passed; 0 failed; 16 ignored, includingreadback_pool_tests).--release(2m 13s,objdump -pconfirmed Windows system DLLs only, zero non-system MinGW runtime DLLs) and--release --features diagnostics(3m 45s).pr21-rebased) — 11/11 gates PASS:11.55 fpsmedian (86.6 ms/frame, baseline8.9 fps),11173max draws across14world windows5501 MBmax VRAM /6616 MBmin budget (0 MBover, baseline5864 MB)43686textures uploaded,3328final waiting (baseline7121),1–2 msmaking host copies /13–16 msmaking slots' views in the final 5s windowsmapped()rate33.88 ms/s(35000calls,3393.0 mstotal, longest14.7 ms),0crashes17/24lit PNGs (106.05median luma vs103.2baseline,0.01%near-black,7.03edge energy,0.0%magenta); visually verified clean exterior geometry, lighting, textures, foliage, water, and UI.Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T04:45:30Z.
Automated RTX 4060 Ti 8 GB A/B hardware verification passed (
playtest/wave2vsorigin/main1ab5d84):cargo test(RTX 4060 Ti):victory-shaderlds_sub(1/1),emit::wave64_tests(14/14),victory-gpu(505/505) — 520 passed, 0 failed.scripts/verify-world.ps1, DLSS Quality + golden autosave):77.25 ms) vs 3.20 fps (308.8 ms) baseline (+10.25 fps / 4.2x faster)max_draws=3122vs29940crashes /0DRED6174 / 6903 MB(-25 MBvs baseline,0 MBover budget)final_waiting=7638vs12258(-4620)frame-7969.png,frame-8409.png), no regressions vsorigin/main.