gpu: BAR windows stop under the residency line (severely reduces textures vanishing) #48

Open
GiovanniFadanelli wants to merge 1 commit from upstream-pr/48 into main
GiovanniFadanelli commented 2026-12-04 16:53:35 +00:00 (Migrated from github.com)

Imported from ReTerryDavis/ReVIctory. Originally posted by GiovanniFadanelli on 2026-12-04T16:53:35Z.


Summary

Severely reduces textures vanishing and reappearing in groups when ReBAR windows are on (VICTORY_WINDOWS_BAR_MB; the launcher's "Extra GPU optimizations" ask for 1,024 MB). It does not remove the vanishing completely: some textures still disappear here and there.

Windows in card memory the CPU maps were made up to a fixed 90 % of the VRAM budget, above the residency policy's line (VICTORY_VRAM_TARGET_PERCENT, 85 % by default). Their bytes then made the policy let go of textures the title was still drawing with. This makes the windows' share the policy's line less 5 points (80 % by default), at most the 90 % it was. One function in crates/victory-gpu/src/shadow.rs, a unit test, no new switch.

Evidence

RX 9070 XT (budget ~14.1 GB from Windows), 2560x1440 output, FSR 4 Quality + frame generation, 30 fps cap, scripted walking and camera turns, 10-minute unattended runs. The measure is the card accounting line (VICTORY_STATS_LOG=1, VICTORY_CARD_ACCOUNTING=1, lines forced from the start for the test): due slots of textures shaders pick by index whose host copy was let go, i.e. textures in use missing on the card, every 5 s.

Windows (3,072 MB asked) Runs Missing textures per look (mean ± sd) fps mean 5 % low
share 90 % (before) 6 126 ± 30 ~29.9 28.5-30.0
share 80 % (this change) 8 82 ± 42 (Welch t = 2.3) 29.6-30.0 27.5-30.0
no windows, for reference 5 35 ± 4 29.2-29.7 26.6-28.4

Runs vary a lot (autosaves move the starting point), so the table compares interleaved repeats. In play on the same PC, with this change on a v0.5.0 build, the player reported textures no longer vanishing in groups, only now and then.

Why it happens: textures shaders pick by a computed index are asked for once, when their view is written, so by their last use they all look idle, and the residency sweep (including the urgent one for room) lets go of ones still on screen when the card is short of room. The windows above the line are what made it short.

Test plan

  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings
  • cargo test --locked --no-fail-fast -p victory-gpu
  • In game (RX 9070 XT): numbers above, and the player's own check
  • NVIDIA: not tested (capped_mapped_most is unchanged)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ReTerryDavis/ReVIctory:issue:5650647228 --> Imported from [ReTerryDavis/ReVIctory](https://github.com/ReTerryDavis/ReVIctory/pull/48). Originally posted by [GiovanniFadanelli](https://github.com/GiovanniFadanelli) on 2026-12-04T16:53:35Z. --- ## Summary Severely reduces textures vanishing and reappearing in groups when ReBAR windows are on (`VICTORY_WINDOWS_BAR_MB`; the launcher's "Extra GPU optimizations" ask for 1,024 MB). It does **not** remove the vanishing completely: some textures still disappear here and there. Windows in card memory the CPU maps were made up to a fixed 90 % of the VRAM budget, above the residency policy's line (`VICTORY_VRAM_TARGET_PERCENT`, 85 % by default). Their bytes then made the policy let go of textures the title was still drawing with. This makes the windows' share the policy's line less 5 points (80 % by default), at most the 90 % it was. One function in `crates/victory-gpu/src/shadow.rs`, a unit test, no new switch. ## Evidence RX 9070 XT (budget ~14.1 GB from Windows), 2560x1440 output, FSR 4 Quality + frame generation, 30 fps cap, scripted walking and camera turns, 10-minute unattended runs. The measure is the `card accounting` line (`VICTORY_STATS_LOG=1`, `VICTORY_CARD_ACCOUNTING=1`, lines forced from the start for the test): due slots of textures shaders pick by index whose host copy was let go, i.e. textures in use missing on the card, every 5 s. | Windows (3,072 MB asked) | Runs | Missing textures per look (mean ± sd) | fps mean | 5 % low | |---|---|---|---|---| | share 90 % (before) | 6 | 126 ± 30 | ~29.9 | 28.5-30.0 | | share 80 % (this change) | 8 | 82 ± 42 (Welch t = 2.3) | 29.6-30.0 | 27.5-30.0 | | no windows, for reference | 5 | 35 ± 4 | 29.2-29.7 | 26.6-28.4 | Runs vary a lot (autosaves move the starting point), so the table compares interleaved repeats. In play on the same PC, with this change on a v0.5.0 build, the player reported textures no longer vanishing in groups, only now and then. Why it happens: textures shaders pick by a computed index are asked for once, when their view is written, so by their last use they all look idle, and the residency sweep (including the urgent one for room) lets go of ones still on screen when the card is short of room. The windows above the line are what made it short. ## Test plan - [x] `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` - [x] `cargo test --locked --no-fail-fast -p victory-gpu` - [x] In game (RX 9070 XT): numbers above, and the player's own check - [ ] NVIDIA: not tested (`capped_mapped_most` is unchanged) 🤖 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/48:upstream-pr/48'
git switch 'upstream-pr/48'

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/48'
git switch 'upstream-pr/48'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/48'
git switch 'upstream-pr/48'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/48'
git switch 'main'
git merge --squash 'upstream-pr/48'
git switch 'main'
git merge --ff-only 'upstream-pr/48'
git switch 'main'
git merge 'upstream-pr/48'
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
ReTerryDavis/ReVIctory!48
No description provided.