feat(Menu): a row that turns the preset to Custom keeps the preset's memory budgets #1358
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1358
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/custom-keeps-memory-budget"
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?
Problem
Pick Quality preset → Low (6GB), then step Resolution (or any other non-exempt row). The preset becomes Custom, and
set_rowcallssync_preset_budgets(0). That setsvram_mbandmirror_mbback to 0, so the card loses the texture and mirror caps the preset gave it. Nothing in the menu says so.On an RTX 4050 Laptop (6 GB) this is exactly what players do: pick Low, then tune Resolution. Without the cap the game went past its VRAM:
vk: VRAM: 5896 MB used of 5080 MB allowed,VRAM full: ... in system memory. GPU time in Kakariko rose to ~37 ms/frame, and with DLSS on, Streamline loggedExceeded VRAM budgetand refused frames. With the same settings and the Low budget restored (viaRX_VK_VRAM_MB=3600), usage stayed under the limit and GPU time fell to ~13.5 ms in a similar scene.Change
opts.budgetis the preset whose memory budgets hold.memory_budget=<n>inhookshot_options.ini. It is not a menu row, so it is written next tomicrophone_device. It is read back at start.memory_budget. It gets its preset's budgets, as today.preset_caps_memory()checks the card size againstopts.budgetinstead ofopts.preset. A smaller preset on a bigger card therefore keeps the card's own budget after a row is tuned too, the same as it does while the preset is shown.3 files, +12 / −4:
gpu/vk/vk_menu.cpp,gpu/vk/vk_menu.h,gpu/vk/vk_memory.cpp.Tested
hookshot_vk.dllbuilds (llvm-mingw,RX_VK_ONLY=1).tests/test_rumble_menu.pystill applies: it stubssync_preset_budgets, andset_rowno longer calls it.RX_VK_VRAM_MBsetting.🤖 Generated with Claude Code
The change reads right to me.
opts.budgetis set only byapply_preset(and from the file at start),set_rowno longer zeroesvram_mb/mirror_mb, and picking Custom on the preset row itself still clears it. The old-file path (nomemory_budget, preset > 0) gives the preset's budgets as before.preset_caps_memory()is the only consumer that looked atopts.preset, and it now followsopts.budget.The PR conflicts with main, in one place:
menu_init()ingpu/vk/vk_menu.cpp, next tosync_preset_budgets(...). #1121 (frame generation Auto) deleted the lineif (opts.framegen == 1) opts.framegen = 2;that sits right under your edit, so the hunks touch adjacent lines. The other hunks invk_menu.cpp,vk_menu.handvk_memory.cppmerge cleanly (I merged them locally against current main). To resolve it, rebase and keep your two budget lines without theframegen == 1line:Small things, none blocking:
RX_VK_VRAM_MB. It would be good to confirm in game that Low, then a Resolution step, logs the 3600 MB budget.Good to go after the rebase.
Thanks for the review! I rebased on current main and resolved the conflict the way you described: the two budget lines are kept, without the
framegen == 1line. I also took the nit. The Quality preset hint now reads "…comes back to Custom, with the preset's memory caps kept."In-game test: RTX 4050 Laptop, 6 GB. Built on v2.0.11 with the same change applied, since the branch itself is ahead of my game's version.
hookshot_env.txthadRX_VK_VRAM_MB=3000, so the log shows which budget is in effect:memory_budget:textures 94 MB (budget 3000 MB), the env value.textures 2482 MB (budget 3600 MB). Before the fix this went back to 3000.quality_preset=0withmemory_budget=2.budget 3600 MBfrom the first VRAM line on. It later reads 3555 MB, which is the existing 75 %-of-allowed safety clamp (4741 MB allowed at that point). There were noExceeded VRAM budgetwarnings from Streamline this run.The menu tests that touch these rows pass locally:
test_upscaler_rows.py,test_rumble_menu.pyandtest_audio_output_menu.py.Re-checked 4fde5eb..d6cbbee. The rebase is clean: the two budget lines in
menu_init()are kept without theframegen == 1line, and GitHub no longer reports a conflict. The hint nit is taken, and the in-game run (Low, then Resolution to 67%, shows 3600 MB,memory_budget=2saved, still 3600 after restart, no Streamline warnings) covers the open test point.The diff is otherwise the same as before, and I still find nothing wrong with it. No CI has run on the branch yet (the checks list is empty), so the first run will be after this lands in the queue. Good to merge.
Independent confirmation from a 4 GB card, and since #1485 this bug hits harder.
RX 5500M laptop (RDNA1, 4 GB; the driver allows ~3.4 GB), main 0c412ad. I had picked Minimum (4GB), then turned frame generation back on, so the preset became Custom and its 2200 MB texture budget was dropped, exactly as described here. Before #1485 the fallback was 70% of what the driver allows (2412 MB on this card), so it went unnoticed. Since #1485 it's 45%: 1551 MB, below the ~2.1-2.4 GB that Kokiri Forest's textures take.
Same place, same settings (Custom, frame generation 2x):
RX_VK_VRAM_MB=2412One caveat: the second session also had more free system RAM, which helps the alt-tab case. The pause numbers don't depend on it.
With this PR, picking Minimum and then changing a row would have kept the 2200 MB budget, which is about what the second column shows.
Heads-up: this conflicts with main now (a lot landed today). Could you merge main into the branch (or rebase) and resolve the conflicts? Thanks!
Rebased on current main (
7b81752). The only conflict was the Quality preset hint, whose preset lines changed on main: I kept main's text and added only "…with the preset's memory caps kept." The budget changes applied cleanly, andhookshot_vk.dllbuilds.@rakefire-impala thanks for the 4 GB numbers. They show the same thing on a smaller card, and that the 45% default from #1485 makes this bug easier to hit.
Rebased again on current main (
e187859). Two conflicts, both next to my lines, and both resolved by keeping main's line beside mine:menu_init()'s options reading: main's newmenu_sizeline.apply_preset(): #2000'sur::snap_render(...), withopts.budget = p;after it.hookshot_vk.dllbuilds.Re-checked against the new head. The author rebased twice on main since my approval. The diff is still the same three files, and the two conflict spots are resolved the way they describe:
menu_init()keeps main'smenu_sizeline besidememory_budget, andapply_preset()keeps #2000'sur::snap_render(...)line withopts.budget = p;after it.set_rowstill no longer zeroes the budgets, Custom on the preset row still clearsbudget, and a file withoutmemory_budgetstill gets its preset's budgets. I found nothing new in the code, and the in-game run from the last round still covers it. The GitHub conflict state is clear.One thing to fix before merge: the
Conventional Commit titlecheck fails. The PR title isMenu: a row that turns the preset to Custom keeps the preset's memory budgets, so it needs a type prefix, e.g.fix(menu): a row that turns the preset to Custom keeps the preset's memory budgets. No other checks have run on the branch.github-sync referenced this pull request2026-11-12 06:22:54 +00:00