GPU: the per-frame eviction pass is counted, and its census reads a flag instead of GetDesc per texture #3252
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3254"
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 Marvisak/VIctory. Originally posted by borosf on 2026-11-26T14:41:29Z.
The per-frame eviction census now costs nothing when nothing is evictable, and reads a flag instead of a COM call per texture when it does run.
What it cost
evict_unusedruns once per presented frame and callscandidates(), which locksTEXTURES_ATand walks every title texture there is (~20,000–50,000 in the world), taking each resource'shostmutex, cloning theArc, and callingGetDescper texture to answer "may this be given up?" — all under the sameTEXTURES_ATlock thatalias_sourceneeds per texture view per draw, so title threads queue behind it once a frame.What changes
HostTexturecarries anevictable: AtomicBool— fed from title memory (has aMemoryKey, not a render/depth/unordered target) and not written by the host — maintained exactly where its inputs change:EVICTABLEcounter),HostTexture::note_host_written()(the existing deferredhost_writtenstore intexture.rsnow calls it),Drop, alongside the existingTEXTURES/TEXTURE_BYTEScounter maintenance.candidates()reads the flag instead ofGetDesc, andevict_unusedreturns immediately whenEVICTABLE == 0— the steady state between shots, and any frame where the host has written everything fed from title memory.The old
evictable(t)helper (theGetDesc-per-texture predicate) is gone; the flag is its memo.Verification
cargo clippy -p victory-gpu --all-targets --locked -- -D warnings— clean;--all-featurestoo.cargo test -p victory-gpu --lib --locked --no-fail-fast— 229 passed, 2 failed, both the known Intel baseline failures pristinemainalso fails (#1744/#1829). I checked the counts against amainworktree run twice, identical; one earlier run showed a third,shadow::tests::marked_pages_go_back_by_the_bytes_the_gpu_changed, which passes 3/3 in isolation and did not recur in three further full runs — a parallel-run flake, not this change.evict_among, idle/budget/evict_among-driven cases inresource::tests) pass.rustfmt --edition 2024 --checkhunk counts againstmain:resource.rs64→63,texture.rs25→24 (both one fewer).Synthetic tests only; no game data.
Part of the fifteen gaps claimed for this sweep on #1633. AI-assisted.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T14:48:29Z.
Review: APPROVED
Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090):
ote_host_written or Drop) avoids per-texture GetDesc calls during candidates() and skips the per-frame census when EVICTABLE == 0. Confirmed exture::host_writes is the sole mutator of host_written.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by borosf on 2026-11-26T14:59:14Z.
Thanks — no change needed, head stays
14b3ff6710a9086a33a1e3e0a413a573fccfc480. Your check thattexture::host_writesis the sole mutator ofhost_writtenmatches mine (singlestore(true)site, now routed throughnote_host_written). Synthetic tests only; no game data.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.