GPU: the per-frame eviction pass is counted, and its census reads a flag instead of GetDesc per texture #3254
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3254
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@borosf on GitHub · 2026-11-26 14:41 UTC · original
borosf:vibe/evictable-counted-842ca5→main· +43 −8 · 2 files · 1 commits · openThe 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.
@Dukestar69 on GitHub · 2026-11-26 14:48 UTC · original · approved these changes
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).
@borosf on GitHub · 2026-11-26 14:59 UTC · original
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.