Texture pass: a backlog gets three times the time also on a full card or with RAM pressure #3478

Open
paales wants to merge 1 commit from upstream-pr/3478 into main
paales commented 2026-11-29 23:45:54 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by paales on 2026-11-29T23:45:54Z.


Written by 🤖:

What it changes

After a scene cut, thousands of textures picked by index are due at once. texspk_cap_ms gives a frame's runs of the texture pass three times VICTORY_TEXSPK_PASS_MS for such a backlog, but only while the card has room and the PC's RAM is not under pressure. At a scene cut the two come together: the new scene fills the card, and the title's streaming takes the PC's free RAM under 3 GB. So the pass kept 8 ms a frame when the backlog was largest, and surfaces showed the neutral texture for 15 to 20 s. Leaf cards then show as flat white-gray quads (the neutral texture's alpha is 0.5).

The cap is CPU time on the recording thread. What needs memory has its own limits, and this change keeps them: the byte budget per frame (residency::prefetch_limit, 64 MB under pressure) and the room check before a new host copy. A backlog (1,024 or more slots due) now gets three times the cap in all cases. Calm frames keep the cap they had (twice the cap only on cards over 12 GiB with room and free RAM). The early check of what a frame spent compares with the most a frame can take (catchup).

How it was tested

  • GPU and profile: RTX 5070 Ti 16 GB (budget about 14 GB), 32 GB RAM, Windows 11; Series X 2560x1440, DLSS Performance, DLSS frame generation 2X, ray tracing off. Build: v2026.11.29.04 with this change (draw.rs is the same as on main 41adb551 apart from this change) and #1727 (HDR10 output, off in these runs).
  • Each run: the intro cutscene with replayed input, 170 s from its first scene frame, saves restored first. From the log: the slots due in the queue line every 5 s, summed over the run (slot-seconds), and the most due at the cut to the boat.
  • Before (5 runs): 229k to 381k slot-seconds; at most 9,655 to 16,894 due; fps median 25.6 to 26.4, 10th percentile 17.5 to 20.1. In every run each room line said "no room, new textures wait", and from the cut on the PC was under RAM pressure (host memory pressure: limiting texture prefetch). In each 5 s, 124 to 198 runs of the pass stopped at their time, none at their bytes.
  • After (2 runs): 132k and 152k slot-seconds; at most 2,786 and 7,682 due; fps median 24.7 and 24.0, 10th percentile 12.5 and 15.8. The frames of the cut take the extra pass time, so the 10th percentile is lower. The second run took window captures every 5 s around the cut.
  • Without this change and with VICTORY_TEXSPK_PASS_MS=24 (24 ms in every frame): 101k and 162k slot-seconds. So the result follows the time the pass gets. With VICTORY_TEXSPK_PASS_MS=24 and VICTORY_SAMPLED_EVICT=1: 66k.
  • For shader changes, the wave sizes tested: no shader change.
  • cargo test passed for the crates it touches: cargo test -p victory-gpu --lib texspk, with new cases for a full card and for RAM pressure. cargo clippy -p victory-gpu --all-targets: nothing in draw.rs. With -D warnings, main stops before that, in victory-shader (3 errors in emit/lower).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #532 (the cap that scales with the card and the catch-up; this keeps both), #1497 (VICTORY_DUE_INDEX), #3128 and #3454 (slot eviction, which makes room on the card).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5556451445 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3478). Originally posted by [paales](https://github.com/paales) on 2026-11-29T23:45:54Z. --- _Written by 🤖:_ ## What it changes After a scene cut, thousands of textures picked by index are due at once. `texspk_cap_ms` gives a frame's runs of the texture pass three times `VICTORY_TEXSPK_PASS_MS` for such a backlog, but only while the card has room and the PC's RAM is not under pressure. At a scene cut the two come together: the new scene fills the card, and the title's streaming takes the PC's free RAM under 3 GB. So the pass kept 8 ms a frame when the backlog was largest, and surfaces showed the neutral texture for 15 to 20 s. Leaf cards then show as flat white-gray quads (the neutral texture's alpha is 0.5). The cap is CPU time on the recording thread. What needs memory has its own limits, and this change keeps them: the byte budget per frame (`residency::prefetch_limit`, 64 MB under pressure) and the room check before a new host copy. A backlog (1,024 or more slots due) now gets three times the cap in all cases. Calm frames keep the cap they had (twice the cap only on cards over 12 GiB with room and free RAM). The early check of what a frame spent compares with the most a frame can take (`catchup`). ## How it was tested - GPU and profile: RTX 5070 Ti 16 GB (budget about 14 GB), 32 GB RAM, Windows 11; Series X 2560x1440, DLSS Performance, DLSS frame generation 2X, ray tracing off. Build: v2026.11.29.04 with this change (`draw.rs` is the same as on `main` 41adb551 apart from this change) and #1727 (HDR10 output, off in these runs). - Each run: the intro cutscene with replayed input, 170 s from its first scene frame, saves restored first. From the log: the slots due in the queue line every 5 s, summed over the run (slot-seconds), and the most due at the cut to the boat. - Before (5 runs): 229k to 381k slot-seconds; at most 9,655 to 16,894 due; fps median 25.6 to 26.4, 10th percentile 17.5 to 20.1. In every run each room line said "no room, new textures wait", and from the cut on the PC was under RAM pressure (`host memory pressure: limiting texture prefetch`). In each 5 s, 124 to 198 runs of the pass stopped at their time, none at their bytes. - After (2 runs): 132k and 152k slot-seconds; at most 2,786 and 7,682 due; fps median 24.7 and 24.0, 10th percentile 12.5 and 15.8. The frames of the cut take the extra pass time, so the 10th percentile is lower. The second run took window captures every 5 s around the cut. - Without this change and with `VICTORY_TEXSPK_PASS_MS=24` (24 ms in every frame): 101k and 162k slot-seconds. So the result follows the time the pass gets. With `VICTORY_TEXSPK_PASS_MS=24` and `VICTORY_SAMPLED_EVICT=1`: 66k. - For shader changes, the wave sizes tested: no shader change. - `cargo test` passed for the crates it touches: `cargo test -p victory-gpu --lib texspk`, with new cases for a full card and for RAM pressure. `cargo clippy -p victory-gpu --all-targets`: nothing in `draw.rs`. With `-D warnings`, `main` stops before that, in `victory-shader` (3 errors in `emit/lower`). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #532 (the cap that scales with the card and the catch-up; this keeps both), #1497 (`VICTORY_DUE_INDEX`), #3128 and #3454 (slot eviction, which makes room on the card).
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/3478:upstream-pr/3478'
git switch 'upstream-pr/3478'

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/3478'
git switch 'upstream-pr/3478'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3478'
git switch 'upstream-pr/3478'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3478'
git switch 'main'
git merge --squash 'upstream-pr/3478'
git switch 'main'
git merge --ff-only 'upstream-pr/3478'
git switch 'main'
git merge 'upstream-pr/3478'
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
trustno1-coder/VIctory-NVIDIA!3478
No description provided.