GPU: keep VICTORY_TEXTURE_BUDGET_MB within DXGI video-memory budget (#415) #507

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

@⁠axolotlpriv on GitHub · 2026-11-25 01:52 UTC · original
axolotlpriv:fix/texture-budget-vram-check → main · +51 −11 · 1 files · 1 commits · open

What

In resource::room(), setting VICTORY_TEXTURE_BUDGET_MB bypassed the DXGI adapter video-memory budget check and decided solely on KINDS[1] (filled texture copies). On an 8 GB card where buffers, pipelines, and render targets already consume several GiB, setting VICTORY_TEXTURE_BUDGET_MB=6144 still admitted new host texture copies past the adapter's DXGI budget (Issue #415, traced by @⁠Kcaiooooo). Also, mb << 20 could wrap on very large values.

resource::room() now:

  • Uses mb.saturating_mul(1 << 20) when parsing VICTORY_TEXTURE_BUDGET_MB.
  • Delegates to texture_room(...) so a manual VICTORY_TEXTURE_BUDGET_MB cap still respects used < budget / 100 * room_percent() when DXGI video-memory telemetry is available, while preserving fallback to the manual cap if telemetry is unavailable and preserving the default path unchanged.

Addresses the VICTORY_TEXTURE_BUDGET_MB admission check in #415 (does not cover the non-mesh fallback or Agility SDK questions in that issue).

Testing

Added resource::tests::manual_texture_limit_respects_adapter_video_memory_budget covering:

  • manual cap with unavailable DXGI telemetry (None)
  • manual cap with total process VRAM below and above budget / 100 * percent (90% and custom 96%)
  • short-circuiting without querying DXGI once the manual cap is reached

Validated locally on Windows:

  • cargo test -p victory-gpu --locked -- resource::tests (10 passed, 0 failed)
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo xtask policy

AI use: written and tested with AI assistance; reviewed before posting. No game files were used.

**@⁠axolotlpriv** on GitHub · 2026-11-25 01:52 UTC · [original](https://github.com/fxceless/victory-fork/pull/507) `axolotlpriv:fix/texture-budget-vram-check` → `main` · +51 −11 · 1 files · 1 commits · open ## What In `resource::room()`, setting `VICTORY_TEXTURE_BUDGET_MB` bypassed the DXGI adapter video-memory budget check and decided solely on `KINDS[1]` (filled texture copies). On an 8 GB card where buffers, pipelines, and render targets already consume several GiB, setting `VICTORY_TEXTURE_BUDGET_MB=6144` still admitted new host texture copies past the adapter's DXGI budget (Issue #415, traced by @⁠Kcaiooooo). Also, `mb << 20` could wrap on very large values. `resource::room()` now: - Uses `mb.saturating_mul(1 << 20)` when parsing `VICTORY_TEXTURE_BUDGET_MB`. - Delegates to `texture_room(...)` so a manual `VICTORY_TEXTURE_BUDGET_MB` cap still respects `used < budget / 100 * room_percent()` when DXGI video-memory telemetry is available, while preserving fallback to the manual cap if telemetry is unavailable and preserving the default path unchanged. Addresses the `VICTORY_TEXTURE_BUDGET_MB` admission check in #415 (does not cover the non-mesh fallback or Agility SDK questions in that issue). ## Testing Added `resource::tests::manual_texture_limit_respects_adapter_video_memory_budget` covering: - manual cap with unavailable DXGI telemetry (`None`) - manual cap with total process VRAM below and above `budget / 100 * percent` (90% and custom 96%) - short-circuiting without querying DXGI once the manual cap is reached Validated locally on Windows: - `cargo test -p victory-gpu --locked -- resource::tests` (10 passed, 0 failed) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` - `cargo xtask policy` **AI use:** written and tested with AI assistance; reviewed before posting. No game files were used.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:44:56 +00:00
Author
Owner

@⁠fladit123 on GitHub · 2026-11-25 23:03 UTC · original

While investigating VRAM admission on an 8 GB RTX 4060, I found this PR.

When rebasing, please consider preserving the current main's card_room_kept() and targets_room_kept() accounting, as well as tiles::given_total() in the filled-texture calculation.

Checking only current DXGI usage against the budget could admit textures into memory intended for later buffer and render-target allocations.

It may also be worth coordinating with #605 and #1122 so that the admission changes remain consistent.

This is a static observation; I have not tested the combined implementation yet.

**@⁠fladit123** on GitHub · 2026-11-25 23:03 UTC · [original](https://github.com/fxceless/victory-fork/pull/507#issuecomment-7177089704) While investigating VRAM admission on an 8 GB RTX 4060, I found this PR. When rebasing, please consider preserving the current main's `card_room_kept()` and `targets_room_kept()` accounting, as well as `tiles::given_total()` in the filled-texture calculation. Checking only current DXGI usage against the budget could admit textures into memory intended for later buffer and render-target allocations. It may also be worth coordinating with #605 and #1122 so that the admission changes remain consistent. This is a static observation; I have not tested the combined implementation yet.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/resource.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-507'
git switch 'github-bot/gh-507'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-507'
git switch 'github-bot/gh-507'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-507'
git switch 'main'
git merge --squash 'github-bot/gh-507'
git switch 'main'
git merge --ff-only 'github-bot/gh-507'
git switch 'main'
git merge 'github-bot/gh-507'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.