perf(vk): Custom with no preset behind it trims the large textures where Auto would pick Minimum #1388
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1388
Loading…
Reference in a new issue
No description provided.
Delete branch "zeldaootr/Longshot:vk-texture-trim-auto-tier"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: perf · Risk: low · Tested on: Steam Deck OLED (SteamOS 3.9.5, RADV) · Needs: Windows, an AMD or Intel integrated GPU (renderer only)
Why
On a Steam Deck, and other PCs with an integrated GPU and 16 GB of RAM or less, a player whose Quality preset reads Custom with no preset behind it gets the largest textures at full size, while Auto and Minimum on the same PC get them a level smaller. On a Deck that doubles the long frame at every arrival that brings in the terrain (on this PR's Deck A/B, the Kokiri save load's longest frame 2,249 ms on main against 1,026 ms here, the Hyrule Field return after the Market 1,352 ms against 682 ms, medians), and the player has no menu row to change it.
Who has Custom with no preset behind it (
memory_budget=0or no such line): everyone whose options file comes from a build before 2026-11-11, when a first start still meant Custom with the defaults andmemory_budgetdid not exist yet (Hookshot PR 1358, Hookshot PR 2187), and anyone who picks Custom on the Quality preset row. A file from beforememory_budgetwith a preset on gets the preset's number when it is read; one with Custom stays at 0 for good, and nothing in the menu sets it. Of the 74 issues and pull requests here that quotememory_budget, 25 showmemory_budget=0, 20 of them on Custom; three of those are on hardware the rule covers: issue 1304 (Ryzen 5 6600H's integrated GPU, 14 GB), issue 748 (GTX 1650) and issue 835 (GTX 1050).How to reproduce
Seen on: Steam Deck OLED, SteamOS 3.9.5, RADV (
AMD Custom GPU 0932 (RADV VANGOGH)), main @8e3dfde6eSettings and switches: Quality preset Custom,
longshot_options.iniwith nomemory_budgetline (ormemory_budget=0); 1280x720, Render resolution 50%, the game's own upscaler, sharpness 50Steps: load a save in Kokiri Forest; go to the Market, then back to Hyrule Field
Expected: the terrain's two 1365x1365x90 ASTC arrays with their top level left out, as on Auto or Minimum on the same Deck:
vk: texture 0x10a00ea600 1365x1365x1 x90 (NVN 0x8e, 852 MB): its 1 top level(s) left out (212 MB), 40 such lines a runActual: the arrays at full size, 214 MB each in the renderer's largest-textures list (
vk: 214 MB: 0x10a00ea600 1365x1365x1 x90 levels 11 NVN 0x8e ASTC), onetop level(s) left outline a run (a 6144x6144 texture), and the load and the Field return twice as long as with the trimmingWhat changed
Minimum's texture trimming on a small or shared GPU now goes by the memory tier the settings come from, and Custom with no preset behind it takes Auto (this PC)'s tier for this PC, as the Shadow resolution's Auto already does. Every preset still saves its own number as
memory_budget, so a player who applied Low or higher keeps full-size textures; only Custom with none changes, and only where Auto would pick Minimum.low_vram_texture_mips()ingpu/vk/vk_texture.cppasksopts.preset == 1 || menu_memory_tier() == 1(wasopts.budget == 1). The size rule itself (integrated GPU with 16 GB of RAM or less, or a driver budget of 4.5 GiB or less) is unchanged.menu_memory_tier()ingpu/vk/vk_menu.cpp, declared ingpu/vk/vk_menu.h:memory_budgetwhen set, else the preset's (a file with a preset andmemory_budget=0), else Auto's tier for this PC (auto_choice.tier, chosen inmenu_auto_for_gpuat the start, before any texture). Auto's tier is Minimum on every integrated GPU and handheld, on cards of 4.5 GB or less and on cards without mesh shaders (gpu/vk/auto_settings.htier_of).tests/test_low_vram_texture_mips.pycutsmenu_memory_tiertoo, gives the fixture Auto's tier, and adds 20 cases for a Deck (14798 MB of RAM, 5872 MB allowed, Auto's tier Minimum) and for discrete 8 GB and 4 GB cards. It now runs every case and names all that fail, instead of stopping at the first.README.md(the low-VRAM mips paragraph),docs/development.md(amemory_budgetrow in the options file's table),docs/steam-deck-playbook.md(one bullet under Settings, and its line on what Auto picks on a Deck, which said Low and FSR 3.1: it is Minimum and the game's own upscaler,tier_ofandchooseingpu/vk/auto_settings.h, as every Deck log says), and the defaults ofRX_VK_LOW_VRAM_MIPS,RX_VK_TEX_MAX_DIMandRX_VK_TEX_SKIP_MBingpu/vk/switches.def.docs/tested/(2026-11-17-textrim-deck-zeldaootr-*.md), one for each Deck run below.menu_shadow_res()(it already goes bymemory_budgetor Auto's tier;tests/test_oot_shadow.pychecks its line), no options migration, no menu row.Measurements
Verdict: on a Steam Deck OLED at a player's Custom rows with no
memory_budgetline, this PR halves the long frames at arrivals (Kokiri save load 2,249 → 1,026 ms, Field return after the Market 1,352 → 682 ms, medians of 2 runs each, interleaved), with standing fps the same (20.24 → 20.70, within the noise), no softer ground in the screenshots, and nothing written into the player's options file.RX_VK_LOW_VRAM_MIPS=0gives main's numbers back. The check: 2 of its 61 cases fail on main, the two this PR changes, and all 61 pass here.Baseline: the Deck ran this PR's renderer (only
longshot_vk.sochanges) packed on main @8e3dfde6e, against that main; this PR is now on main @544229a26. Of the 9 commits between them, one touches the files the rule lives in (gpu/vk/vk_texture.cpp,gpu/vk/vk_menu.cpp,gpu/vk/auto_settings.h):7fd3e2ace, the fullscreen monitor row invk_menu.cpp, with no line on the trimming, the presets,memory_budgetor Auto's tier. The numbers hold for this base.Hardware: Steam Deck OLED, SteamOS 3.9.5 build 20261023.100, Mesa 26.2.0-devel (5c65d4fc31), RADV; plugged in, headless, nothing else running; GPU clock held at a manual 1600 MHz before and after every run (
vk: GPU clock: the driver's own: the GPU's power level was chosen (not auto): it stays (the power level: manual)in every log)Scene: a child Kokiri Forest save; standing 45 s at the save, then 7 teleports (1 Field, 2 Lost Woods, 3 Market, 4 Field, 5 Lost Woods, 6 Market, 7 Field); 1280x720 output, Render resolution 50%, the game's own upscaler, sharpness 50, frame pacing off, frame generation off, Custom (
quality_preset=0) with nomemory_budgetline; one shared shader cache, no preparation in any runMethod: the longest frame (ms) from 10 presents before each
map:line to 10 s after it; standing fps and p99 over the 45 s sample; the arrays' upload from thea frame's uploads tookline and the GPU-busy block after it (10 Hz). Order A B B A, then B0: tA-1 (main), tB-1, tB-2 (this PR), tA-2 (main), tB0-1 (this PR withRX_VK_LOW_VRAM_MIPS=0); the median of the two runs an armHow to reproduce: the options above with no
memory_budgetline, a renderer-only build of each side on the same base,RX_VK_SLOW_LOG=1008e3dfde6e(tA-1 / tA-2)23eb8116d(tB-1 / tB-2)RX_VK_LOW_VRAM_MIPS=0: this PR @23eb8116d(tB0-1)top level(s) left outlinesmemory_budgetlines in the staged / saved options file; saved = stagedThe other arrivals (longest frame ms, arrivals 1 Field, 2 Lost Woods, 3 Market, 5 Lost Woods, 6 Market): tA-1 648 260 2,446 390 657; tA-2 549 228 739 285 631; tB-1 486 164 3,470 259 1,042; tB-2 547 181 670 172 548; tB0-1 567 230 3,512 243 731. The first Market arrival has a multi-second frame in some runs of every arm, main included (tA-1, tB-1, tB0-1 here; 2,484 ms on main and 4,505 ms on Auto in the earlier hand-set series on the same main): not this change. Apart from it, this PR's other arrivals are inside or under main's range except tB-1's arrival 6 (Market) (1,042 ms against main's 631-657).
Memory: the integrated GPU texture budget was 2,560 MB in every run. MemAvailable at its low point: main 1,325 / 1,393 MiB, this PR 1,436 / 1,400, B0 1,351. MemAvailable + SwapFree at that point: main 8,251 / 5,691 MiB, this PR 7,948 / 5,938, B0 5,139: this PR inside main's range. No kill (
oom_killdelta 0, no earlyoom), noVK_ERROR, device lost, upload failure or amdgpu line, exit 0 in every run.Picture: full-size crops of the ground, main (tA-1) above this PR (tB-1), are in this PR's screenshots comment: the Kokiri save's spot after the 45 s stand (the stone path), the Hyrule Field entrance 20 s after the first arrival (grass and rock), and the last Field return (where this PR kept its trimmed arrays and main made them again). In each, this PR is not softer; no missing, black, garbage or wrong texture; Link lit in both.
The same setting by hand, before this PR: main @
8e3dfde6eagainst the same main withmemory_budget=1added to the options file (whatlow_vram_texture_mips()sees on this PR for such a player on a Deck), same Deck, rows and route, order main,memory_budget=1,memory_budget=1, main: Kokiri load 2,253 / 2,443 → 1,049 / 1,050 ms, Field after the Market 1,328-1,441 → 648-675 ms, standing fps 20.46 / 20.58 → 20.38 / 21.23, no difference seen on the ground. At 1280x800, Render resolution 100% (one run withmemory_budget=1, two without): load 2,164 / 2,221 → 1,056 ms, Field after the Market 1,334-1,392 → 711 / 755 ms. This PR's own runs match it.Limits: two runs an arm (one with the switch off), runs of about 10 minutes, four areas (Kokiri Forest, Hyrule Field, the Lost Woods, the Market); a long session is not measured.
The check, on main's source (this PR's test commit,
821fcdcff) and on this PR:What it costs where it was not measured
memory_budgetis a preset's (Low and up keep full size; Minimum and Auto at Minimum were trimmed already).Flags and settings
No new switch or row. The meaning of
memory_budget=0on Custom changes: from "no trimming" to "Auto's tier for this PC".memory_budget=0withquality_preset=0(ini, no row)RX_VK_LOW_VRAM_MIPS=0The way back for a player who wants full-size textures: apply Low (6GB) or a higher preset (each saves its own
memory_budget, which this PR leaves alone), then change rows as before; ormemory_budget=2inlongshot_options.ini; orRX_VK_LOW_VRAM_MIPS=0.RX_VK_TEX_MAX_DIM=2048alone is not a way back: it spares the 1365-texel arrays but the 8 MB threshold stays. The check covers each:deck-custom-after-lowanddeck-low(full size),deck-custom-no-budget-switch-off(full size).Testing
Tested: in the game on a Steam Deck OLED (SteamOS 3.9.5, RADV): this PR's renderer on main @
8e3dfde6eagainst that main, Custom with nomemory_budgetline, the arrival route above, A B B A plus one run withRX_VK_LOW_VRAM_MIPS=0(Measurements); the options file checked after every run, the ground compared at three spots.python -I -B tests/run_all.py --changed forge/mainon Linux, with the Vulkan headers found: 134 passed, 18 failed, 1 skipped (nx2/test_bc_storage_views.py, which needs a Windows Vulkan device). The same checks on main @544229a26fail the same 18:test_bug_report,test_bug_report_defaults,test_crt_options,test_damage_debug_menu,test_framegen_preset,test_hud_layout_row,test_linux_pressure,test_parallel_init_order,test_readback_timeout_source,test_rumble_menu,test_staging_burst,test_switch_table(RX_VK_PGO_FILE has a row and nothing reads it),test_target_image_pool,test_tested_configurations(fourdocs/tested/files already on main with more than one row; this PR's five files read clean on their own),test_upscaler_round_trip,test_upscaler_rows,test_vk_occlusion_queries,test_walk_key.test_low_vram_texture_mips(fails on the test commit alone, passes here),test_oot_shadow,test_options_budget_onceandtest_readme_menu_rowspass.Not tested: Windows; other integrated GPUs and 4 GB cards (what it costs there is above); picture quality beyond three spots on a Deck at 1280x720 (and at 1280x800 by hand on main); a session longer than about 10 minutes.
Must be tested:
memory_budget(Test Farm:@Beanstalk windows, amd or intel integrated: Custom with memory_budget removed from longshot_options.ini, Kokiri Forest and Hyrule Field, expecting the "top level(s) left out" lines and no visible blur on the ground at the PC's own resolution).Risks
What could break: textures look softer up close for Custom players with no preset on integrated GPUs with 16 GB or less and on cards of 4.5 GB or less, most on a large screen. Nothing else reads
menu_memory_tier().Turning it off:
RX_VK_LOW_VRAM_MIPS=0; for one player, applying Low or a higher preset. Or revert the commit.Compatibility:
longshot_options.iniis read and written as before (no line added, no migration; on the Deck every run's saved file equals the one it started with). The shader and pipeline caches are untouched.MKWVK_API_VERSIONis unchanged (vk_api.huntouched). Textures over the limits are made smaller at their creation, so a player on the affected hardware sees the change at the next start.Issues
See #1304 (Custom,
memory_budget=0, an integrated GPU with 14 GB). The rule's own PR: #404, which made it go by Minimum's budget (memory_budget=1) so the Debug tab's button would get it on Custom; the reporter it was for ran Custom too.Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks.
main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.docs/tested/for each new measured run (format indocs/tested-configurations.md).mainand passing here.tests/that reads changed source updated in this PR, not weakened.memory_budgetgets Minimum's mips where Auto picks Minimum 821fcdcff3memory_budgetgoing by Auto's tier, five runsTested in game: Steam Deck OLED (SteamOS 3.9.5, RADV), this PR's renderer on main @
8e3dfde6eagainst that main, Custom with no memory_budget line at 1280x720 / 50%, A B B A plus a run with RX_VK_LOW_VRAM_MIPS=0: the terrain arrays trimmed to 682x682x90, the Kokiri save load's longest frame 1,026 ms against 2,249 and the Field return after the Market 682 ms against 1,352 (medians), standing fps the same, the ground not softer, the options file unchanged, and the switch-off run equal to main.Screenshots: full-size crops of the ground on a Steam Deck OLED, 1280x720, Render resolution 50%, the game's own upscaler, Custom with no
memory_budgetline. In each, the top half is Before: main @8e3dfde6e(tA-1) and the bottom half is After: this PR @23eb8116d(tB-1).WIP: perf(vk): Custom with no preset behind it trims the large textures where Auto would pick Minimumto perf(vk): Custom with no preset behind it trims the large textures where Auto would pick MinimumPossibly related, for context:
Custom with no preset behind it now trims the large textures where Auto would pick Minimum. I read head
02844b622. It applies onto current main. The Windows integrated-GPU run it still names is open, so this is not an approval.menu_memory_tierusesmemory_budgetwhen it is set, otherwise the preset's, otherwise Auto's tier for this PC. The mip rule still requires an integrated GPU with 16 GB of RAM or less, or a driver budget of 4.5 GiB or less, and it still trims only at tier 1. A Low or higher preset keeps full-size textures.RX_VK_LOW_VRAM_MIPS=0turns the rule off. Auto's choice is filled when the card is known, and that function does not rewrite a Custom player's budget. On a Deck, Auto's tier is Minimum and the upscaler is the game's own. The played renderer is23eb8116; the tip adds the measured rows. On a Deck OLED at Custom with nomemory_budgetline, the terrain arrays drop their top level and the long arrival frames are about half, with the ground not softer. Must be tested still asks for an AMD or Intel integrated GPU on Windows, at that PC's own resolution.@Beanstalk windows, amd or intel integrated: Custom with memory_budget removed from longshot_options.ini, Kokiri Forest and Hyrule Field, expecting the "top level(s) left out" lines and no visible blur on the ground at the PC's own resolution
@zeldaootr only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.