Skip to content

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

Open
axolotlpriv wants to merge 1 commit into
fxceless:mainfrom
axolotlpriv:fix/texture-budget-vram-check
Open

axolotlpriv wants to merge 1 commit into
fxceless:mainfrom
axolotlpriv:fix/texture-budget-vram-check

Conversation

@axolotlpriv

Copy link
Copy Markdown

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.

@fladit123

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants