victory-gpu: honor on-demand level bounds when staging textures #17
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17"
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-28T05:56:18Z.
Summary
Honor
VICTORY_LEVELS_ON_DEMANDmip bounds andVICTORY_LEVELS_MAX_DIMcaps when sizing and copying staging buffers incrates/victory-gpu/src/texture.rs:firstmip inupload_listedandupload_fromwhenevercrate::tiles::wanted()is active (not onlyresource::held_only()).judgement_at,held_levels_of, andon_demand_firstsostaging()computes the lowest held/capped mip before lockingSTAGING(preserving lock ordering), skipping unheld/capped coarse mips and falling back to the smallest mip whenheld == 0.heldinStaging::detileby!0u32 << self.firstbefore storingdetiled.CopyTextureRegioncalls inPreludeUpload::recordwhenself.staging.on_demandis enabled (afterdetile()populatesdetiled).on_demand_staging_tests::on_demand_first_tracks_committed_levels_and_max_dimoverVirtualAlloc(MEM_RESERVE/ partialMEM_COMMIT/max_dim = Some(512)).Note: PR #17 eliminates the staging bloat introduced under
VICTORY_LEVELS_ON_DEMAND=1and depends on PR #12 (fc23fb3) to exercise tiledon_demandallocations cleanly.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 --features victory-gpu/diagnosticsA/B binary built on detachedorigin/main+ PR #12 (fc23fb3) + PR #17 (f910dae), plus clean--releasebuild @f910daea4b34c9178f96336c2236e8a754b7f098(0non-system MinGW DLLs)series-soffDLSS qualityoffVICTORY_*Overrides:D:\victory-build\verify-tools\verify-world.ps1with-LevelsOnDemand(VICTORY_LEVELS_ON_DEMAND=1),-GoldenDataDir 'D:\victory-data\golden-data-minivi',-WorldSeconds 75,-AutoNudgeMenudock->balcony), 75s in-world telemetry (14world windows, up to11,659draws/frame)Measurements & Verification
4.4 fpsmedian /5.76 fpsmean across all 14 windows (9.1–10.0 fpson the steady balcony; dock streaming windows2.2–2.9 fpswhile PSOs compiled).pr12-lod(PR #12alone,VICTORY_LEVELS_ON_DEMAND=1): median FPS2.9 -> 4.4 fps(+52%), staging blocks2,816 MB -> 256–320 MB, uploaded bytes11,337 MB -> 2,264 MB, staging uploads1,730 ms/5s -> 42–55 ms/5s, unmapped mips median120.0 -> 75.0 MB,final_waiting26,190 -> 11,252,0host memory pressure warnings.baseline-main(VICTORY_LEVELS_ON_DEMAND=0,8.9 fpsmedian,5,864 MBVRAM): dock windows still ran slower (2.2–2.9 fpsvs6.1–7.2 fps) and peak VRAM reached6,266 MB(1,111 MBin tile heaps).off5,886.5 MBmedian /6,266 MBpeak VRAM of6,939 MBbudget (over=0 MB,room_false=0.0%,9,188tiled alive max); visualslit=18/24,luma=105.47,edge_energy=6.96,magenta=0.0%(inspectedframe-8136.png&frame-8668.png)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(449 passed; 0 failed; 36 ignored, includingon_demand_staging_tests::on_demand_first_tracks_committed_levels_and_max_dim)cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu levels_on_demand -- --ignored(1 passed: tiles::tests::levels_on_demand_on_the_card)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-28T06:04:11Z.
Automated triage for the maintainers (not an approval).
Verdict:
needs-gpu-test· CI (check):passingReview Summary
PR #17 narrows
VICTORY_LEVELS_ON_DEMANDtexture staging buffers andPreludeUpload::recordcopies incrates/victory-gpu/src/texture.rsto the mip levels that are actually committed and withinVICTORY_LEVELS_MAX_DIM.What looks solid
upload_listed,upload_from): Keeping the caller'sfirstmip whencrate::tiles::wanted()is active avoids forcingfirst = 0for tiled on-demand textures.staging,staging_layout,judgement_at,held_levels_of,on_demand_first): Computing the lowest held/capped mip before lockingSTAGINGpreserves the existing lock order, falls back to the smallest mip whenheld == 0, and naturally re-stages when finer mips later become committed (s.first <= first.max(copy.base)fails and replaces the entry).Staging::judge_levels,PreludeUpload::record): Maskingheld &= if self.first < 32 { !0u32 << self.first } else { 0 }preventson_demand.uploaded(...)from backing finer mips that are not present inself.footprints, and skipping unheld subresources inPreludeUpload::recordavoids redundantCopyTextureRegioncalls into unbacked mips.VirtualAlloc/VirtualFreehits are confined to#[cfg(test)] mod on_demand_staging_testsusingPAGE_READWRITEanonymous memory with properDropcleanup to verifyon_demand_firstacross commit boundaries andmax_dim.Minor non-blocking note
staging(), whenon_demandis true,staging_layout+judgement_at+on_demand_first(includingVirtualQuerycalls inheld_levels_of) now execute before theSTAGINGcache lookup on everyupload_fromcall, even when a cached entry already satisfiess.first <= requested.max(copy.base). This is safe and preserves lock ordering, though a fast-path check could avoid repeated layout/query work if it shows up in hot command lists.Verdict
needs-gpu-test— Logic, edge cases, security, and CI look clean; because this changes D3D12 texture staging andCopyTextureRegionbehavior underVICTORY_LEVELS_ON_DEMAND, a local real-GPU smoke test is warranted before merging.Generated with Antigravity CLI (
agy).Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T01:01:39Z.
Rebased onto
origin/main(6e935d7->54553eb):Changes
crates/victory-gpu/src/texture.rsconflicts inPreludeUpload::recordandjudge_levels/detile:self.staging.detiledmip-masking alongsideself.staging.cpu.get()inPreludeUpload::record.held &= if self.first < 32 { !0u32 << self.first } else { 0 }directly insideStaging::judge_levelsso both CPU and GPU detiling paths honoron_demandlevel bounds.Verification (
54553eb)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 texture::(11 passed; 0 failed; 4 ignored, includingon_demand_first_tracks_committed_levels_and_max_dim).--release(2m 14s,objdump -pconfirmed Windows system DLLs only, zero non-system MinGW runtime DLLs) and--release --features diagnostics(3m 48s).pr17-rebased) — 11/11 gates PASS:11.3 fpsmedian (88.2 ms/frame, baseline8.9 fps),12323max draws across15world windows5570 MBmax VRAM /6565 MBmin budget (0 MBover, baseline5864 MB)42660textures uploaded,2814final waiting (baseline7121),0–1 msmaking host copies /7–14 msmaking slots' views in the final 5s windowsmapped()rate31.3 ms/s(32200calls,3117.8 mstotal, longest60.2 ms),0crashes19/24lit PNGs (104.27median luma vs103.2baseline,1.43%near-black,7.0edge energy,0.0%magenta); visually verified clean exterior geometry, lighting, textures, foliage, water, and UI.