Reclaim idle textures when the texture budget fills #512
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!512
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-512"
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?
@suren1013 on GitHub · 2026-11-27 07:58 UTC · original
suren1013:codex/texture-budget-eviction→a-publier· +152 −26 · 2 files · 2 commits · draftNo description provided.
@MamaLeVrai on GitHub · 2026-11-27 11:40 UTC · original
Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At
d58c262:victory-gpu398 passed, 1 failed, 34 ignored. The failure,watch::tests::a_view_mapped_beside_a_guarded_one_makes_it_check_again, did not come back in 10 runs alone, here or on the base. It is awatchflake (#450 fixes them), not this PR.AI-assisted (Claude Code); no game data.
@gut0to on GitHub · 2026-11-27 13:08 UTC · original · reviewed
AI-assisted review. I checked the texture-budget boundary handling and left one input-validation edge case inline.
@ -1766,0 +1782,4 @@static LIMIT: std::sync::OnceLock<Option<u64>> = std::sync::OnceLock::new();*LIMIT.get_or_init(|| {let mb = std::env::var("VICTORY_TEXTURE_BUDGET_MB").ok()?;mb.trim().parse::<u64>().ok().map(|mb| mb << 20)@gut0to on GitHub · 2026-11-27 13:08 UTC · original
AI-assisted review: A left shift here silently discards high bits when the parsed MiB value exceeds u64::MAX / (1 << 20), so an extreme but valid u64 input can become a much smaller budget (or zero) and change eviction behavior. Could this use checked_mul(1 << 20) and treat overflow as an invalid setting, with a boundary test?
@Gabriel-Ramaldes on GitHub · 2026-11-27 13:33 UTC · original
In-game test on AMD RDNA 4 with 32 GB, at
d58c262(a-publier4eb6cfd+ this PR).Setup:
cargo test --locked -p victory-gpu --lib -- --test-threads=1: 399 passed, 0 failed, 34 ignored.scripts\play.ps1's settings (Series X), the same manual save restored before each run (balcony, ~6,500 draws), 300 s, warm-up first, mirrored order.VICTORY_TEXTURE_BUDGET_MB=6144. That is below the ~7-8 GB of host textures this scene ends with on4eb6cfdwithout a budget.VICTORY_TEXTURE_BUDGET_MB=6144)memory:line)4eb6cfd* The second run of the PR ended on another camera (11,100 draws against ~6,500), so its frame time is not comparable.
filled_texture_bytes(), so this may be expected, but on this PC the switch did not lower memory.victory-image-…dll+0x2215c35, write 0x0, before the world). #386's build had one too, the same day.AI-assisted (Claude Code); no game files.
@suren1013 on GitHub · 2026-11-27 14:17 UTC · original
Thanks for the detailed run. The shorter stalls in both completed runs are noted, though two runs aren't enough to conclude much.
How did you pass the budget? It looks like play.ps1 clears inherited VICTORY_* variables, so it may need -More @{ VICTORY_TEXTURE_BUDGET_MB = '6144' }. If you already did that, please ignore this.
If the budget was active, it would also help to compare the budget's own counter with DXGI memory usage on a fixed camera, if the build can print them. I'm keeping this PR as a draft until the budget is shown to hold.
@suren1013 on GitHub · 2026-11-27 14:20 UTC · original
On
crates/victory-gpu/src/resource.rsline 1785 (outdated):Fixed in
5ad5246: the conversion now uses checked_mul, and an out-of-range value falls back to the default budget behavior, like any other invalid setting. The new test covers the largest valid MiB value and the first overflowing value. Unit tests only so far; the full GPU suite hasn't been run on Windows yet, and this hasn't been run in-game.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.