gpu(book,indirect): cache AMD adapter check to fix texture-streaming cliff #71
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/71"
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-28T23:10:52Z.
Summary
Fixes the severe texture-streaming regression introduced on non-AMD GPUs in #2 (
e4b05ff), wherecrates/victory-gpu/src/book.rs::texture_addresscalledcrate::indirect::amd(&host.device)uncached on every texture creation (book::made,where_the_card_reads,book::block). Becauseindirect::amd()recreated a DXGI factory and enumerated adapters (CreateDXGIFactory2+EnumAdapterByLuid+GetDesc1) on every call, diagnostics builds stalled for522–1,863 msper 5s making host copies and230–334 msper 5s making slots' views, dropping uploaded textures from ~46k down to ~16.7k–21.9k in 75s and leaving the main house exterior / character model untextured/black.crates/victory-gpu/src/indirect.rs: Cacheamd(device)lock-free by adapter LUID viaamd_cached()+std::sync::OnceLock, falling back to querying directly if a different adapter LUID is supplied; add unit testamd_vendor_query_is_cached_per_adapter_luid.crates/victory-gpu/src/book.rs: CacheIS_AMDonce intexture_address()for the process-wide host device.Rig Specs Tested On
Run Settings & Profile
release&release --features diagnostics@640b8a1series-s(viascripts/verify-world.ps1 -WorldSeconds 75 -AutoNudgeMenu)offDLSS qualityoffVICTORY_*Overrides:verify-world.ps1baseline (VICTORY_THIN=1,VICTORY_TEXTURE_POOL=1,VICTORY_UPLOAD_AHEAD=1,VICTORY_SHOW_AFTER=1, etc.;VICTORY_LEVELS_ON_DEMAND=0)75sin-world (draws >= 500,14windows, max12,556draws/frame)Measurements & Verification
origin/main8dfb64e,bisect-origin-main-8dfb64e/e4b05ff):16,846textures uploaded in75s(21,505final waiting,30,361max waiting) on8dfb64e(16,735uploaded /22,062waiting one4b05ff)548–587 msmaking host copies /265–334 msmaking slots' views per 5s window (522–809 ms/230–301 msone4b05ff)frame-8950.png/frame-7196.png) and solid-black character face/neck (frame-7948.pngone4b05ff)640b8a1,pr-fix-book-amd-cache): 11/11 gates PASS10.8 fpsmedian /9.16 fpsmean (min0.5 fps,+1.90 fpsvs baseline8.9 fps)46,243textures uploaded (2,060 MB),3,153final waiting (-3,968vs baseline7,121)1 msmaking host copies (down from522–1,863 ms),14–15 msmaking slots' views (down from230–334 ms)luma=105.66,near_black=0.0%,edge_energy=7.04,magenta=0.0%(frame-10197.png,frame-11221.pngverified: full exterior siding & normal skin-toned character model)off)5,563 MBmax VRAM /6,496 MBmin budget (0 MBover budget,8.3%room=false)0crashes,0no_host_texture_errorscargo clippy --workspace --all-targets -- -D warningscargo clippy --workspace --all-targets --features diagnostics -- -D warningscargo test -p xtask(6 passed) &cargo run -p xtask -- policy(301 files ok)cargo test -p victory-gpu --lib amd_vendor_query_is_cached_per_adapter_luid -- --test-threads=1(1 passed) &cargo test -p victory-gpu --features diagnostics --lib book:: -- --test-threads=1(3 passed)--releasebuild (objdump -pconfirmed Windows system DLLs only)Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-11-29T00:02:46Z.
Automated triage for the maintainers (not an approval).
Verdict:
merge-candidate· CI (check):passingReview Summary
Clean, minimal fix that memoizes the AMD adapter vendor check so texture creation in diagnostics builds no longer recreates a DXGI factory and enumerates adapters on every call.
Verified changes:
crates/victory-gpu/src/indirect.rs(amd_cached,amd): Caches theVendorId == 0x1002lookup in a lock-freeOnceLock<((i32, u32), bool)>keyed by(luid.HighPart, luid.LowPart). Correctly falls back to querying DXGI directly when a different adapter LUID is passed (e.g. WARP/multi-adapter tests) without poisoning or overwriting the cached entry.crates/victory-gpu/src/indirect.rs(amd_vendor_query_is_cached_per_adapter_luid): Unit test verifies cache hit on matching LUID, direct fallback on mismatched LUID, and preservation of the original cached entry.crates/victory-gpu/src/book.rs(texture_address): CachesIS_AMDonce in aOnceLock<bool>for the process-widemade_host()device (consistent with the existing process-wideSLOTdescriptor heap cache in the same function), avoiding even theGetAdapterLuid()COM call on the hot texture-creation path.Checks & Risk:
Generated with Antigravity CLI (
agy).