VRAM accounting and eviction count the mapped tiles of levels-on-demand textures (port of LooperSalty/AnyXboxX#287) #468

Open
GiovanniFadanelli wants to merge 1 commit from upstream-pr/468 into main
GiovanniFadanelli commented 2026-11-27 14:00:44 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by GiovanniFadanelli on 2026-11-27T14:00:44Z.


This is a port of Mauro Alvarez's LooperSalty/AnyXboxX#287 (commit 806d1419), cherry-picked through zocram4cc/victory-linux-perf f9e8f84. The authorship is kept.

What and why

Levels-on-demand host textures (HostTexture::new_tiled) set host.bytes = 0, because their VRAM lives in crate::tiles::Tiled. Several accounting and eviction paths in crates/victory-gpu/src/resource.rs still read host.bytes directly, so they see 0 bytes for every tiled texture. The budget then under-counts VRAM, and eviction never picks those textures. These paths now read card_bytes(): the mapped tiles' given_bytes() for reserved textures, and host.bytes otherwise. There is no switch; this is an accounting fix only. Only resource.rs changes (+76/−11).

Testing (Windows 11, Ryzen 7 9800X3D, RX 9070 XT, Rust 1.98.1)

  • New test resource::tests::reserved_texture_copy_state_counts_mapped_tiles: passes.
  • cargo test -p victory-gpu --all-features --locked --no-fail-fast -- --test-threads=1: 444 passed, 1 failed, 36 ignored. Unmodified main (014d52de) gives 443 passed, 1 failed, with the same failing test: timeline::report::tests::real_waits_are_recorded_with_who_ended_them. It fails only inside the full run and passes on its own on both, so the failure predates this PR.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings stops at 4 transmute used without annotations errors in victory-loader's tests. These are the same on unmodified main, and this PR does not touch that crate.
  • Not done: a red-first run of the new test (it relies on card_bytes(), which this PR adds), and no in-game measurement of VRAM or eviction.

🤖 Generated with Claude Code

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:5527884040 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/468). Originally posted by [GiovanniFadanelli](https://github.com/GiovanniFadanelli) on 2026-11-27T14:00:44Z. --- This is a port of Mauro Alvarez's LooperSalty/AnyXboxX#287 (commit `806d1419`), cherry-picked through zocram4cc/victory-linux-perf `f9e8f84`. The authorship is kept. ## What and why Levels-on-demand host textures (`HostTexture::new_tiled`) set `host.bytes = 0`, because their VRAM lives in `crate::tiles::Tiled`. Several accounting and eviction paths in `crates/victory-gpu/src/resource.rs` still read `host.bytes` directly, so they see 0 bytes for every tiled texture. The budget then under-counts VRAM, and eviction never picks those textures. These paths now read `card_bytes()`: the mapped tiles' `given_bytes()` for reserved textures, and `host.bytes` otherwise. There is no switch; this is an accounting fix only. Only `resource.rs` changes (+76/−11). ## Testing (Windows 11, Ryzen 7 9800X3D, RX 9070 XT, Rust 1.98.1) - New test `resource::tests::reserved_texture_copy_state_counts_mapped_tiles`: passes. - `cargo test -p victory-gpu --all-features --locked --no-fail-fast -- --test-threads=1`: 444 passed, 1 failed, 36 ignored. **Unmodified `main` (`014d52de`) gives 443 passed, 1 failed**, with the same failing test: `timeline::report::tests::real_waits_are_recorded_with_who_ended_them`. It fails only inside the full run and passes on its own on both, so the failure predates this PR. - `cargo clippy --workspace --all-targets --all-features -- -D warnings` stops at 4 `transmute used without annotations` errors in `victory-loader`'s tests. These are the same on unmodified `main`, and this PR does not touch that crate. - Not done: a red-first run of the new test (it relies on `card_bytes()`, which this PR adds), and no in-game measurement of VRAM or eviction. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/468:upstream-pr/468'
git switch 'upstream-pr/468'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/468'
git switch 'upstream-pr/468'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/468'
git switch 'upstream-pr/468'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/468'
git switch 'main'
git merge --squash 'upstream-pr/468'
git switch 'main'
git merge --ff-only 'upstream-pr/468'
git switch 'main'
git merge 'upstream-pr/468'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
avatarmanz/VIctory-7900XTX!468
No description provided.