Texture sweep: the card's rule frees idle textures under RAM pressure too, backs off instead of churning, and keeps textures shown through slots #3475
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!3475
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3475"
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?
@nyxctura on GitHub · 2026-11-29 23:44 UTC · original
nyxctura:pr-texture→main· +1268 −13 · 4 files · 3 commits · closed without mergingRelated: #1772, #3206.
What it changes
With the card over its texture budget and the PC short of RAM at the same time (normal on a 12 GB card with 32 GB of RAM), the sweep found ~7.5 GB of textures idle for 30 s and more and freed ~90 MB every 5 s. The texture queue said "no room, new textures wait" in 95 % of its reports: late and blurry textures, frame generation failing with "out of VRAM", and Windows paging.
Three commits:
resource.rs,host.rs,VICTORY_SWEEP_CAPPED). It frees no more than idle textures can give, pauses when too many of the textures it freed come back within 10 s (VICTORY_SWEEP_CAPPED_BACK_PERCENT), and slows down only when nothing is left to free. This ends the free-and-reload loop (#1772).VICTORY_SWEEP_CARD_MAPPED). A second "wholly unmapped" gate in the free loop, left over after3246d252changed the first one, skipped nearly every candidate whenever RAM was short. Also: copies the streamed-out pass freed no longer count as idle (VICTORY_SWEEP_STALE), and a 5-s "why kept" line says what holds the rest (VICTORY_SWEEP_WHY).resource.rs,descriptor/host.rs,VICTORY_SWEEP_HELD_GRACE_S). A texture picked by index never asks for its host copy again, so itsusedstamp goes stale while it is on screen. When the title moves its view to another slot, the old slot lets go before the new one is made, and a look in between freed it: the texture flickered (a character's arm, every few seconds). Copies held by a slot or list within the grace time stay, ones that came back are protected longer (VICTORY_SWEEP_BACK_PROTECT_S), and the back-off also counts bytes.VICTORY_SWEEP_BACK_WHOlogs which code asked for a copy again.Every change has its switch;
=0restores the old behaviour.Screenshots
fps in the world, before vs with this PR:

With this PR: card under its budget, RAM free, frame generation running:

How it was tested
VICTORY_SWEEP_HELD_GRACE_S(60 s used here).mainthe branch builds and thevictory-gpulib suite passes (apart fromevery_switch_of_the_translator_is_in_the_key, which fails the same way onmainwithout this PR).cargo testpassed for the crates it touches: yes. New unit tests for the back-off, capping and grace rules.Checked for overlap
More charts
Free RAM while playing:

Textures in use minus their line (above 0, new textures wait):

All three PRs at a glance:

🤖 Generated with Claude Code
github-bot referenced this pull request2026-11-30 09:34:54 +00:00
@advxrsary on GitHub · 2026-11-30 20:03 UTC · original
@nyxctura I think I see the flicker that your third commit describes, on current main. Could you rebase this pull request on main?
What I see. Objects are drawn white for exactly one frame: plants, a palm trunk, a whole flowering tree, bushes. The frame before and the frame after are correct. In play it looks like the object flickers or disappears.
How I found it. I used a diagnostics build with
VICTORY_CAPTURE_WORLD_SECONDS=20,200,1, so every presented frame was saved. Then I compared each frame with its neighbours. A blink is a block that is the same in frames k-1 and k+1, but different in frame k. Most of the strongest blinks in about 500 frames were this white object.What I ruled out.
VICTORY_SLOT_EVICTline)VICTORY_DYNAMIC_SLOTS=262144, 737,855 title slots instead of 606,783)This matches what your commit 3 says: a view moves to another slot, the old slot lets go of it, and a sweep finds the copy idle before the new slot is made.
Why I cannot test it now. I tried to merge it on main
84bd61e2. There are 9 conflicts inresource.rs,descriptor.rsanddescriptor/host.rs, because main has rewritten the sweep since then. I did not want to resolve the sweep logic by guessing.Setup: RTX 5080 16 GB, driver 621.24, Ryzen 7 9800X3D, Windows 11. Series X, 2560x1440 output, DLSS performance, frame generation x3, ray tracing off. Main
84bd61e2with #3918 and my light commits (#4348). None of them touch the sweep.When it is rebased, I will run the same capture and post the blink counts before and after.
Pull request closed