Skip to content

perf(vk): reduce ASTC memory pressure on small VRAM budgets - #1009

Merged
hckrman101 merged 1 commit into
NotRexed:mainfrom
pablitorockz:fix/minimum-astc-mips
Nov 11, 2026
Merged

hckrman101 merged 1 commit into
NotRexed:mainfrom
pablitorockz:fix/minimum-astc-mips

Conversation

@pablitorockz

@pablitorockz pablitorockz commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Fully mipmapped 3072-square ASTC textures occupy about 48 MiB when decoded, below the existing 64 MiB mip-trimming threshold. On Minimum with a small driver VRAM budget, retaining several of these images can crowd the texture working set.

Use 1024 / 8 MiB automatic mip-selection defaults on Minimum when the driver reports a nonzero budget of at most 4.5 GiB. This trades sampled-texture detail for a smaller working set; it does not establish a stable FPS floor.

Changes

  • Rebased onto main at a740d67ad41d1c8df52e40ef64193aeb96a6af3c, retaining its BC3 policy, texture allocation handling and preset memory budgets.
  • Feed the low-VRAM default into the existing skip_from path. RX_VK_TEX_SKIP_MB retains its existing parsing and wins when supplied; the separate RX_VK_TEX_TRIM_MB control is removed.
  • Keep RX_VK_TEX_MAX_DIM as a dimension-only override. Other presets and larger or unknown driver budgets retain the existing 2048 / 64 MiB defaults. The separate allocation-size limit and uncompressed render/depth handling are unchanged.
  • Use the shared env_value_off helper for RX_VK_LOW_VRAM_MIPS, including 0, off, false and no, case-insensitively. Unset keeps the automatic policy. The driver budget is sampled once per session; preset defaults are evaluated for each new texture.
  • Document the budget heuristic, quality tradeoff and override interaction, including RX_VK_TEX_MAX_DIM=512 RX_VK_TEX_SKIP_MB=2.
  • Declare RUN_ALL_ARGS in the new game-free test. Keep tests/run_all.py and tests/test_program_answer_domains.py exactly as they are on this base; the obsolete answer-domain compatibility commit is dropped.

Validation

Fedora 44, i5-12450H, NVIDIA RTX 2050 Laptop 4 GB, driver 615.71.09. Native builds use Clang; the suite also uses GCC 16.2.1 for tests that require it.

  • The focused fixture executes the production selection block with real NVN/Vulkan types and a stubbed driver-budget query. All 24 configurations pass with both Clang and GCC: budget boundaries and query failure, preset changes, explicit overrides, on/off spellings, small UI images, a final mip, an uncompressed render target and a depth image.
  • Against unmodified main, the same fixture fails the expected 3072-square mip-selection assertion.
  • Four isolated source mutations are rejected: zero-only opt-out parsing, an ignored skip-threshold override, caching the first preset's threshold, and excluding the exact 4.5 GiB boundary.
  • Full suite: python -I -B tests/run_all.py --jobs 2: 424 passed, 0 failed, 21 skipped. Skips require Windows-specific functionality, game modules/a game build, an opt-in Vulkan-device test, or unavailable dav1d, Pillow or .NET dependencies.
  • Native Vulkan backends for both the updated branch and unmodified base compile successfully with zero compiler failures.
  • git diff --check passes. Only gpu/vk/vk_texture.cpp, readme.md and tests/test_low_vram_texture_mips.py differ from the base.

Not validated

Gameplay FPS and visual quality have not been remeasured on this base. The installed game frontend uses Vulkan API 7, while this base requires API 17; it cannot provide a valid comparison with these new backends. No previous-base FPS measurements are used as evidence for this revision. Windows builds and AMD/Intel gameplay were not tested.

No game files or build artifacts are included.

@pablitorockz
pablitorockz force-pushed the fix/minimum-astc-mips branch from 4f4553c to b4a6422 Compare November 9, 2026 13:06
soltros added a commit to soltros/Longshot that referenced this pull request Nov 11, 2026
Adopts and adapts NotRexed/Hookshot#1009 by pablitorockz, original head 9390d68afff33046a0529c3b37c23d39926d1bd0. Preserve current size guards, legacy skip override and Longshot docs.

@Joey-Magnus Joey-Magnus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branch hasn't changed since the review on Nov 9, so all of those points are still open. Main doesn't have this trimming yet: there's no RX_VK_LOW_VRAM_MIPS or TEX_TRIM_MB on main. What's still needed after a rebase:

  • Drop RX_VK_TEX_TRIM_MB (vk_texture.cpp:1475) and have the low-VRAM default feed main's skip_from instead, with RX_VK_TEX_SKIP_MB still winning when set. Update the readme paragraph and test modes to match.
  • tests/run_all.py now uses per-file declarations, so the ARGS entry won't apply any more. test_low_vram_texture_mips.py should declare its own RUN_ALL_ARGS.
  • The answer-domains commit is probably obsolete on current main.
  • RX_VK_LOW_VRAM_MIPS is read as e[0]=='0' (line 1419). Since #2042, on/off switches go through env_on/env_value_off, so off and false should work too.

Since then, main has also added BC3-by-VRAM and preset memory budgets, so the 4 GB numbers should be measured again on the rebased branch.

Use 1024 / 8 MiB mip-selection defaults on Minimum when the driver reports
a nonzero budget of at most 4.5 GiB. Feed the existing skip_from path and
keep RX_VK_TEX_SKIP_MB and RX_VK_TEX_MAX_DIM overrides authoritative.

Use the shared off-value parser for RX_VK_LOW_VRAM_MIPS. Evaluate preset
defaults for each new texture while retaining the session budget heuristic.

Exercise the production selection block in a game-free fixture, with
per-file runner arguments, override precedence, opt-out spellings, budget
boundaries, preset changes and preservation of UI/render/depth textures.
Retain current main's runner and answer-domain fixture unchanged.

Assisted-by: OpenAI Codex
Co-Authored-By: Codex <noreply@openai.com>
@pablitorockz pablitorockz changed the title Vulkan: reduce ASTC texture memory pressure on 4 GB GPUs perf(vk): reduce ASTC memory pressure on small VRAM budgets Nov 11, 2026
@hckrman101
hckrman101 merged commit e460da1 into NotRexed:main Nov 11, 2026
2 checks passed
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.

2 participants