perf(vk): the VRAM budgets set by the card, not a menu row or a preset; 8 GB cards' mirrors 2 GB #735
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 @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8015c9a
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
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
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!735
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:perf/vram-budget-by-card"
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: medium · Tested on: none (not run) · Needs: Windows or Linux, an 8 GB card (NVIDIA and AMD); a 6 GB card; a 4 GB card; a Steam Deck; a 16 GB card
Why
The VRAM budget setting confuses players and gets in their way. Its steps read like a quality slider, and players on 6 and 8 GB cards report that setting it to 6 GB makes the game run much better. That shows the default is wrong for them, not that the setting is needed: no player should have to find a memory number by trial.
On an 8 GB card the default (Auto (this PC) picks the Balanced (8GB) preset) gave the game's memory copies in VRAM (the mirrors) 1 GB. They fill within minutes, and from then on the GPU reads the game's memory over PCIe, so the frame rate swings with each area visited (#724 measured it on an RTX 3060 Ti). Picking 6 GB in the menu happened to raise the mirrors to 1.5 GB, which is why it helped.
This PR removes the setting. The game chooses both budgets from the card, with the same sizes every card already got by default, except the 8 GB cards' mirrors, which go to 2 GB.
See #724 (the 8 GB mirrors: this PR gives them the same 2 GB, and also removes the setting and the presets' budgets), #637 (memory management under 8 GB, the same code), #130 and #668 (8 GB cards losing the device at the driver's VRAM limit: what not to make worse).
What changed
The Insert menu's VRAM budget row is gone, and the Quality presets no longer set memory budgets. One rule by the card sets the textures' budget (new
gpu/vk/texture_budget.h) and one the mirrors' (gpu/vk/mirror_budget.h). Their sizes are the ones each card already started on through Auto (this PC)'s tier, so nothing moves for most players, apart from 2 GB of mirrors on 8 GB cards.What each dedicated card gets by default, before and after (textures / mirrors):
Textures: 7/12 of the card's memory, or all of it but 5 GB where that is more, at most 11 GB, at most 2.2 GB on a card of 4.5 GB or less, and at most 75% of what the driver allows (the presets' own clamp, for a card other programs already fill). The rule goes by the card, not the driver's allowance, so it gives the same size on Windows and on a Linux driver that allows nearly the whole card. 65% of the allowance would have given 5.1 GB on such an 8 GB card, the size that once had the driver page VRAM out (an RTX 3060 Ti at 14 fps). On a PC with under 12 GB of RAM and a card over 6.75 GB, it keeps the rule from before (45% of the allowance up to 8.5 GB, at most 6 GB), as it had. The cache still shrinks below its size near the driver's limit (
texture_frame's 90% and 97% rules). Mirrors: a quarter of the card, at most 2 GB under 15 GB and 3 GB from there, at most 256 MB on a card of 4.5 GB or less.texture_rule::dedicated_bytes(by the card's memory and the PC's RAM) andintegrated_bytes(the integrated GPUs' rule as before) ingpu/vk/texture_budget.h;texture_frameingpu/vk/vk_texture.cpptakesRX_VK_VRAM_MBor the rule, and the preset path (preset_texture_budget, the 75% clamp) is gone. Avk: texture budget:line logs the size chosen on a dedicated card.device_vram_bytes()is declared invk_internal.hfor it.mirror_rule::auto_bytesis the only rule;budget_bytesandpreset_caps_memory()are gone;mirror_budget()invk_memory.cppreads no options.vram_budget_sync,sync_preset_budgetsand Auto's keeping of a player's budget (apply_autohas no parameter now) are removed fromgpu/vk/vk_menu.cpp;Optionslosesvram_mb,mirror_mbandvram_budget.opts.budget(memory_budget=) stays: it still marks Minimum's settings for the low-VRAM mip trimming (low_vram_texture_mips).save()drops an old file'svram_budget=line, and a file that had the row set under Auto (memory_budget=0) gets Auto's tier back inmenu_auto_for_gpu. The Quality preset's help no longer says it sets memory limits, and the Custom hint loses "the VRAM budget row keeps its value"; the weak-laptop button says "smaller textures".gpu/vk/menu_i18n.hdrops the row's nine texts and rewords the Quality preset's help and the Custom hint in all 13 tables; the counts follow.docs/common-issues.md,docs/development.md(RX_VK_VRAM_MB,RX_VK_MIRROR_MBdefaults) andgpu/vk/VULKAN.md.test_texture_budget.py/.cpp(the rule's sizes, and that no preset, row or option reaches it) replacestest_preset_texture_budget.pyandtest_vram_budget_row.py;test_mirror_budgetchecks the one rule; the menu fixtures (test_framegen_preset,test_rumble_menu,test_upscaler_round_trip,test_menu_keys,test_bug_report_defaults,test_auto_settings,test_menu_sections) lose the removed functions and the row.Measurements
Verdict: not measured yet: nothing was run, in the game or the checks. The one size that changes on 8 GB cards, 2 GB of mirrors, is #724's measurement on an RTX 3060 Ti (37.1 to 45.3 fps, 1% lows 16.4 to 20.7, Kokiri Forest, Hyrule Field and the Market at 1080p, three interleaved runs each); the other sizes are each card's default before this PR.
Flags and settings
A menu row and an ini key removed; two switches' defaults follow the new rule.
vram_budget=(ini)memory_budget=(ini)RX_VK_VRAM_MBtexture_budget.h)RX_VK_MIRROR_MBTesting
Tested: nothing yet. The change was read through and reviewed, and no build or check was run on this PC.
Not tested: the game on any card;
python -I -B tests/run_all.py(left to CI).Must be tested:
vk: texture budget:line at 4778 MB, the mirrors at 2048 MB, fps and 1% lows at least main's, nodevice lostor VRAM paging (the GPU time staying near main's) (Test Farm: @Beanstalk on an 8 GB card, main against this PR in Hyrule Field, Kokiri Forest and the Market; or by hand).vk: integrated GPU texture budget: 2560 MBwith 16 GB of RAM) (Test Farm: @Beanstalk steamdeck, main against this PR in the Market).vram_budget=4added tolongshot_options.ini, expecting GPU and memory to show only GPU device and Threaded rendering, the game to start normally, and thevram_budget=line gone after changing any setting (by hand: the menu and the options file).Risks
What could break: an 8 GB card has 1 GB more of mirrors in VRAM. Where the textures and the rest of the game's VRAM already fill it (#130, #668), that could take it to the driver's limit; the texture cache shrinks first (the 90% and 97% rules), which #724's runs relied on too. Cards Auto put at Minimum for another reason than memory (no mesh shaders: a GTX 1060 6 GB, a GTX 1070, Polaris 8 GB) and Custom players from before Auto had the old rule (45% of the allowance on 8 GB, ~3.3 GB) and now get their card's size (3.5 GB on 6 GB, 4.67 GB on 8 GB). Mirrors are at most 2 GB under 15 GB of VRAM (#724 found 2 GB enough on 8 GB: no pool over PCIe), so cards past their tier's preset, which had a quarter of the card, get less: 10-11 GB cards 2.5-2.75 GB to 2 GB, 13-15 GB cards about 3 GB to 2 GB, and a 12 GB card in a PC with under 12 GB of RAM 3 GB to 2 GB. Players who chose a size on the row lose it: the 6 GB a player chose on an 8 GB card gave about 5.5 GB of textures and 1.5 GB of mirrors, where this gives 4.67 GB and 2 GB. PRs #724, #637 and #622 touch the same code and checks and will conflict.
Turning it off:
RX_VK_VRAM_MB=<MB>andRX_VK_MIRROR_MB=<MB>set either budget for a run; otherwise revert the commit.Compatibility:
longshot_options.ini:vram_budget=is ignored and dropped at the next save;memory_budget=is read as before. Saves, the shader and pipeline caches, the vk ABI (vk_api.huntouched) and the builder's tools don't change. The guide's Graphics screenshot (docs/images/guide/) was taken before this change: the rows it pictures don't include GPU and memory, but its Quality preset help may need the source review (the Custom hint changed).Issues
See #724
See #637
See #130
See #668
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). (Not run on this PC; left to CI.)third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
Description: each Must be tested item now says where, what to expect and who runs it; the build box added, unticked until CI builds it.
@Beanstalk
Beanstalk test farm
Commit
6f91fae· tier reviewed · approved by HumanBean · dashboardWhat will be tested · AI plan (
gpt-6.1-terra)On a Linux tester, compare main and the PR through Kokiri Forest, Hyrule Field and the Market, spending about 15 minutes on game runs. The plan measures frame times, GPU time, VRAM use and load times, and compares pictures after area changes. A crash, device-lost log, substantial frame-time or GPU-time regression, or excessive image difference fails the plan; VRAM use is recorded without a limit because the budget intentionally changes.
Done. Comment
@Beanstalkto run it again.WIP: perf(vk): the VRAM budgets set by the card, not a menu row or a preset; 8 GB cards' mirrors 2 GBto perf(vk): the VRAM budgets set by the card, not a menu row or a preset; 8 GB cards' mirrors 2 GBTest of #735 on an 8 GB card: pass
Hardware: RTX 3060 Ti 8 GB, driver 621.14, i7-12700F, 64 GB, Windows 11. Built the renderer of this PR @
511e9b03and of main @35465d12(the commit before it), each run in the same v3.0.0-rc.4 game folder (vk ABI unchanged between them), with no switches in the environment (RX_VK_MIRROR_MBandRX_VK_VRAM_MBunset) and the options file as a player has it (Auto (this PC), which picked Balanced (8GB),vram_budget=3).What I checked: Kokiri Forest, Hyrule Field and the Market (child), 1920x1080 output and render, frame generation off, no frame cap. Each run: per area 10 s settle, 30 s standing, 30 s turning the camera, a warm-up pass and then a recorded pass,
RX_VK_FRAME_LOGframe times. Four runs, interleaved: main, PR, PR, main. Then one start of the PR withvram_budget=4inlongshot_options.ini, and the Insert menu's Graphics tab.Result:
35465d12511e9b03vk: texture budget:VRAM:lines over what the driver allowsvk: pool 0x102e800000 (52 MB, its mirror 48 MB) stays in system memory: the mirrors have 1014 MB of 1024); with the PR no pool is read over PCIe, and the host waits less on the GPU.vk: texture budget: 4680 MB (driver allows 7256 MB, the card has 8024 MB, RAM 65375 MB)).vram_budget=4in the options file: the game started and loaded a save normally; the Graphics tab's GPU and memory section shows only GPU device and Threaded rendering; thevram_budget=line was gone fromlongshot_options.iniby the time the menu was open (memory_budget=3kept). The Quality preset's help no longer mentions memory limits.zeldaootr referenced this pull request2026-11-15 17:11:14 +00:00
zeldaootr referenced this pull request2026-11-15 17:11:26 +00:00