shadow: credit free texture-pool space in window_room_for up to real budget margin #2940

Open
github-bot wants to merge 1 commit from github-bot/gh-2940 into main AGit
Owner

@⁠Maverick0351a on GitHub · 2026-11-29 18:54 UTC · original
Maverick0351a:fix/shadow-window-room-credits-texture-pool → main · +57 −13 · 1 files · 1 commits · open

Fixes #

What it changes

  • Adds window_fits_in_vram in crates/victory-gpu/src/shadow.rs so window_room_for credits crate::pool::texture_room() (free space inside committed texture-pool blocks) when weighing DXGI used against window_line and room_line, while preserving the 256 MiB real-budget margin guard (REAL_MARGIN, matching resource::room's VICTORY_ROOM_REAL from #1888).
  • Previously, resource::room() subtracted crate::pool::texture_room() (typically 300-500 MB) from used when admitting textures up to room_line(budget), whereas shadow::window_room_for() compared raw used against window_line (89% - kept, ~1,100 MB below room_line on a 16 GB card).
  • Once texture streaming filled VRAM so that used - pool::texture_room() < room_line while raw used > window_line, every idle buffer window evicted by shadow::let_go_idle() had its VRAM permanently taken by textures and no new buffer window could enter VRAM (host copies in the card's memory bled from 5,234 MB down to 2,395 MB over 12 minutes of play on an RTX 5080 16 GB, spilling 1.6-2.8 GB of vertex/index/constant windows into system-RAM UPLOAD heaps over PCIe).

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): NVIDIA GeForce RTX 5080 Laptop GPU (16 GB GDDR7, 15,235 MB DXGI budget, driver 621.24.0), Windows 11, Series S (1080p) and Series X (1440p), DLSS Quality, DLSS Frame Generation 4x, ray tracing off.
  • Before: With the card's own 13,292-13,371 MB in use of a budget of 15,235 MB and 417 MB free in texture blocks, resource::room reported 13,404 MB against a line of 14,016 MB: room, while window_room_for compared raw 13,371 MB > window_line (12,916 MB) and refused all new windows; host copies in the card's memory fell from 5,941 copies (5,234 MB) at 18:12:30 to 4,702 copies (2,395 MB) at 18:28:11.
  • After: window_fits_in_vram credits pool::texture_room() while used + size < budget - 256 MiB, keeping buffer windows on equal footing with texture admissions under window_line.
  • cargo test passed for the crates it touches: yes (cargo test -p victory-gpu --lib window_fits_in_vram, 1 passed; window_line_keeps_the_room_held_for_targets, 1 passed).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1888
**@⁠Maverick0351a** on GitHub · 2026-11-29 18:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2940) `Maverick0351a:fix/shadow-window-room-credits-texture-pool` → `main` · +57 −13 · 1 files · 1 commits · open Fixes # ## What it changes - Adds `window_fits_in_vram` in `crates/victory-gpu/src/shadow.rs` so `window_room_for` credits `crate::pool::texture_room()` (free space inside committed texture-pool blocks) when weighing DXGI `used` against `window_line` and `room_line`, while preserving the 256 MiB real-budget margin guard (`REAL_MARGIN`, matching `resource::room`'s `VICTORY_ROOM_REAL` from #1888). - Previously, `resource::room()` subtracted `crate::pool::texture_room()` (typically 300-500 MB) from `used` when admitting textures up to `room_line(budget)`, whereas `shadow::window_room_for()` compared raw `used` against `window_line` (`89% - kept`, ~1,100 MB below `room_line` on a 16 GB card). - Once texture streaming filled VRAM so that `used - pool::texture_room() < room_line` while raw `used > window_line`, every idle buffer window evicted by `shadow::let_go_idle()` had its VRAM permanently taken by textures and no new buffer window could enter VRAM (`host copies in the card's memory` bled from `5,234 MB` down to `2,395 MB` over 12 minutes of play on an RTX 5080 16 GB, spilling 1.6-2.8 GB of vertex/index/constant windows into system-RAM `UPLOAD` heaps over PCIe). ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): NVIDIA GeForce RTX 5080 Laptop GPU (16 GB GDDR7, 15,235 MB DXGI budget, driver 621.24.0), Windows 11, Series S (1080p) and Series X (1440p), DLSS Quality, DLSS Frame Generation 4x, ray tracing off. - Before: With `the card's own 13,292-13,371 MB in use of a budget of 15,235 MB` and `417 MB free in texture blocks`, `resource::room` reported `13,404 MB against a line of 14,016 MB: room`, while `window_room_for` compared raw `13,371 MB > window_line (12,916 MB)` and refused all new windows; `host copies in the card's memory` fell from `5,941 copies (5,234 MB)` at `18:12:30` to `4,702 copies (2,395 MB)` at `18:28:11`. - After: `window_fits_in_vram` credits `pool::texture_room()` while `used + size < budget - 256 MiB`, keeping buffer windows on equal footing with texture admissions under `window_line`. - `cargo test` passed for the crates it touches: yes (`cargo test -p victory-gpu --lib window_fits_in_vram`, 1 passed; `window_line_keeps_the_room_held_for_targets`, 1 passed). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1888
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 18:57:00 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2940/head:github-bot/gh-2940'
git switch 'github-bot/gh-2940'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2940'
git switch 'github-bot/gh-2940'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2940'
git switch 'github-bot/gh-2940'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2940'
git switch 'main'
git merge --squash 'github-bot/gh-2940'
git switch 'main'
git merge --ff-only 'github-bot/gh-2940'
git switch 'main'
git merge 'github-bot/gh-2940'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!2940
No description provided.