feat(menu): a Shader loading row, When needed or Before the title (from 32 GB of RAM) #2321
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2321
Loading…
Reference in a new issue
No description provided.
Delete branch "Veix/Longshot:feat/shader-loading-row"
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?
Summary
RX_VK_LOAD=start(every shader program loaded before the title) gets a row in the menu, so a player can choose it without editinglongshot_env.txt. Nothing changes for anyone who doesn't choose it.The Graphics tab's GPU and memory section gets Shader loading: When needed (the default, the game's behaviour until now: programs loaded as the game makes them, with
load_default.h's safety net that switches an install to loading before the title when play waited too long for loads) or Before the title (start, asRX_VK_LOAD=start). It applies after a restart, like GPU device beside it. Before the title is only for PCs with 32 GB of RAM or more (28 GB reported, what a 32 GB PC shows), and only where the shader preparation runs at the start (it loads the programs inside it; not withRX_VK_PRECOMPILE=0or in a build that is not a release). Where it cannot apply, the row is held, shows When needed (what applies) and its line says why; a saved Before the title stays inlongshot_options.inifor a PC where it can. Before the title loads the programs the shader lists name; one they do not name yet can still be loaded the first time the game makes it.RX_VK_LOADstill wins for the run, the row shown held by it, as the ASTC and Intel rows are by their switches. The log says which decided: "programs are loaded before the title (start): the Shader loading row: Before the title".Why 32 GB: Before the title held about 10 GB more RAM and 1 GB more video memory here (the PC under Testing, 2560x1440 DLAA,
RX_VK_LOAD=startagainstRX_VK_LOAD=createonmain753fb5afwith #2312 (the speaker's sound search, nothing of the loading), the process's memory read every few seconds):What has to fit in RAM is the working set: 22.6 GB with Before the title. The private memory (31.3 GB) is what the process has committed; Windows backs it with the page file, which it sizes itself by default.
Read first:
load_default::askedingpu/vk/load_default.h,programs_load_decideingpu/vk/vk_programs.cpp, the row ingpu/vk/menu/gpu.cpp.Testing
Tested: Windows 11, RTX 4070 SUPER 12 GB, driver 621.24, Ryzen 9 9900X, 64 GB of RAM. In the game: the row at When needed, the log "programs are loaded when the game makes them (create): the default where the GPU has mesh shaders"; set to Before the title in the menu and the game restarted: the log said "programs are loaded before the title (start): the Shader loading row: Before the title", and
longshot_options.inikeptshader_loading=1.On the head
70dec8c8(onmaind02cac0f): the row at Before the title, the log line above; set to When needed in the menu, the row showed it with "Restart needed" (pictures in the review answer); withRX_VK_PRECOMPILE=0and the row saved at Before the title the log said "programs are loaded when the game makes them (create)" and "the Shader loading row's Before the title is left aside: the shader preparation does not run".tests/load_default_test.cppchecks the rule (RX_VK_LOADfirst; Before the title only from 28 GB and only with the shader preparation; When needed asks nothing) and fails to build onmain(noload_default::asked);tests/test_load_default.py,tests/test_menu_ini_keys.py(the new key) andtests/test_settings_table.py(the settings page's new line) and the menu checks (tests/test_menu_*: modules, module slots, sections, hooks, i18n, model, rows, locked button, keys, environment overrides, restart, restart slots, setting walk, size, mouse, help paragraphs) pass on the head.tests/run_all.py --changed origin/mainon0e32bc10: 114 passed, 2 failed, 7 skipped; the 2 (test_dev_packs,test_saveload_warm_cache) fail onmain753fb5afin the same environment. The head started again after the rebase: the same log line.Still to test:
Measurements
Nothing to measure for speed: When needed is the game's behaviour until now, and Before the title is
RX_VK_LOAD=start; the memory that chose the 32 GB line is in the Summary.Risks
No risk for anyone who leaves the row as it is: When needed is the game's behaviour until now, safety net included. Before the title is what
RX_VK_LOAD=starthas done all along, and only offered where the RAM it takes is there. A revert is enough. After updating, a player sees one more row;longshot_options.inigetsshader_loading=0with the next save.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Written with the help of an AI coding agent.
Tested in game: Windows 11, RTX 4070 SUPER 12 GB, driver 621.24, 64 GB of RAM: the row set to Before the title in the menu and the game restarted; the log said 'programs are loaded before the title (start): the Shader loading row: Before the title', and longshot_options.ini kept shader_loading=1. At When needed the log gave the default as before. The rebased head started again with the same line.
Possibly related, for context:
@review
Can you include screenshot and make sure the text shown to users say this is only for 32GB machines
Recommendation: Request changes. The new row can promise loading before the title when startup preparation is disabled or skipped, and it can display a saved choice that the game has ignored. The 32 GB eligibility threshold also needs validation near that limit.
The row exposes the existing startup shader-loading mode without requiring an environment variable. It preserves the existing default, but its availability and explanatory text do not cover all paths through the loader.
Blocking (1): must change before merging.
gpu/vk/load_default.h:33: The row requests start even when shader preparation will not run, so its advertised choice does not load programs before the title. (more on the line) Do: Make the row reflect whether startup preparation can actually run, and either enable the required preparation for this choice or hold the choice with an explanation when it cannot run.Should fix (2): not blocking, but worth doing before merging.
gpu/vk/menu/gpu.cpp:87: On a machine below the RAM threshold, a saved Before the title value remains displayed and cannot be changed even though the loader ignores it. (more on the line) Do: Display the effective automatic choice while preserving or clearing the saved preference deliberately, and allow the player to select When needed on a lower-memory machine.docs/user/graphics-and-controls.md:267: The description promises that every program is loaded before the title and nothing is loaded during play, but start mode only preloads listed programs. (more on the line) Do: Describe startup loading as covering listed programs and acknowledge that unlisted programs can still load during play; correct the matching menu hint.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/load_default.h:26: The threshold offers the memory-heavy mode on a 32 GB PC, but the reported run used 64 GB and reached 31.3 GB of private memory. (more on the line) Do: Run the selected mode on a 32 GB system through the measured route, including a representative AMD or Steam Deck-class configuration where applicable, and record commit usage, paging, startup and frame pacing against When needed. (@fixdoes its part first: Raise the eligibility threshold until a lower limit is demonstrated safe.)@fixcan do L1, L2, L3 and L4.Checks: Failing on this head, which is behind its base, where it passes:
PR description / Description follows the template (pull_request_target).@rebase(or@fix) brings it up to date and runs it again; not held against it. Still running: 10 checks.More: does it help, other systems, switches, what was read
Does it help: Yes: the author reports selecting Before the title, restarting, and seeing the corresponding log and saved value on Windows with an RTX 4070 SUPER and 64 GB RAM. The reported comparison shows 22.6 versus 12.4 GB working set and 7.7 versus 6.6 GB VRAM in Castle Town, but does not establish safety on a 32 GB machine.
Other systems: The option affects startup and shader loading on Windows and Linux, including AMD, NVIDIA, Steam Deck and fallback GPUs. The reported game run covers one Windows NVIDIA system; preparation-disabled and skipped-preparation paths can bypass the promised startup work.
Switches: No environment switch is added or changed. The saved shader_loading option defaults to 0, preserving the existing automatic choice and safety net; 1 requests the existing RX_VK_LOAD=start mode when reported RAM is at least 28 GiB. RX_VK_LOAD still takes precedence.
Reviewed:
9a6afa364aagainst0e32bc100d: Read the repository rules, available PR template, standards, diff, commit and changed small files; traced menu initialization, RAM detection, loading choice, preparation and saving. Skimmed the larger changed renderer and menu files and surrounding callers rather than reading those files in full. docs/review-checklist.md and ../Tooling/AGENTS.md were absent. No generated files or recorded runs were changed.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no commands from the project, builds or tests were run. The author reports an in-game Windows run and passing targeted checks; CI is still running.
Overlaps and merge order: Not checked; network access was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -263,0 +264,4 @@- **Shader loading:** When needed loads each of the game's shader programs from the shader cache the first time the gamemakes it, which takes the least memory; if play waits too long for them, the game loads them all before the title fromthe next start by itself. Before the title loads every one before the title: a longer start and about 10 GB more RAMand 1 GB more video memory (measured on an RTX 4070 SUPER), and nothing is loaded in play. It needs 32 GB of RAM andL3 (should fix): The description promises that every program is loaded before the title and nothing is loaded during play, but start mode only preloads listed programs.
When: A kept program without a listed pipeline is read at its first draw unless RX_VK_LOAD_UNLISTED is enabled, so a player can still encounter a first-use load after choosing Before the title.
Do: Describe startup loading as covering listed programs and acknowledge that unlisted programs can still load during play; correct the matching menu hint.
@ -23,0 +23,4 @@/// Before the title holds about 10 GB more RAM than at create calls (measured 2026-11-23 on an RTX 4070 SUPER with mesh shaders,/// Castle Town: 22.6 against 12.4 GB in use, 31.3 against 19.9 GB private; 1 GB more video memory). The Shader loading row offers/// it from 32 GB of RAM: a PC sold with 32 GB reports a little less (the part the hardware keeps), so from 28 GBconstexpr unsigned long long kStartRamMin = 28ull << 30;L4 (should fix): The threshold offers the memory-heavy mode on a 32 GB PC, but the reported run used 64 GB and reached 31.3 GB of private memory.
When: A player with 28–32 GiB reported RAM can select the mode while the game and other processes compete for memory; the supplied run does not show whether the mode remains usable under that constraint.
Do: Run the selected mode on a 32 GB system through the measured route, including a representative AMD or Steam Deck-class configuration where applicable, and record commit usage, paging, startup and frame pacing against When needed.
@ -23,0 +30,4 @@inline const char* asked(const char* env, int row, unsigned long long ram) {if (env) return env;if (row == 1 && start_allowed(ram)) return "start";return nullptr;L1 (blocking): The row requests start even when shader preparation will not run, so its advertised choice does not load programs before the title.
When: With RX_VK_PRECOMPILE=0, or in a non-release build, precompile_wanted() is false; choose() still accepts the row's start request, but precompile_run() is not called. Programs are then read on first draw despite the row and log saying they were loaded before the title. A build whose preparation was skipped also returns before precompile_run().
Do: Make the row reflect whether startup preparation can actually run, and either enable the required preparation for this choice or hold the choice with an explanation when it cannot run.
@ -55,0 +84,4 @@.restart = true,.preset_exempt = true,.locked = []() -> const char* { // (why: RX_VK_LOAD holds it, or under 32 GB of RAM: hn_shader_loading's line)if (getenv("RX_VK_LOAD")) return hn_shader_loading(0, -1);L2 (should fix): On a machine below the RAM threshold, a saved Before the title value remains displayed and cannot be changed even though the loader ignores it.
When: Copy an options file with shader_loading=1 from a larger machine to a 16 GB machine. asked() falls back to the automatic choice, while the locked row still displays Before the title; the player cannot clear that saved choice in the menu.
Do: Display the effective automatic choice while preserving or clearing the saved preference deliberately, and allow the player to select When needed on a lower-memory machine.
9a6afa364a70dec8c884Done: the row now says it is only for PCs with 32 GB of RAM or more, and it only offers Before the title where it can really happen (screenshot below).
Rebased onto
maind02cac0f(one conflict inprograms_load_decide:main's new rule that a start marker is only followed with enough RAM is kept as it is; the row's choice is taken first). The PR is one commit again,70dec8c8.load_default::askedgets whether the shader preparation runs (precompile_wanted()). Without it (RX_VK_PRECOMPILE=0, a build that is not a release) the row asks for nothing, the menu locks it with that reason, and the log says the row's Before the title was left aside and why.RX_VK_LOAD=startset by hand still does what it says.tests/load_default_test.cpphas both cases.longshot_options.inias the player's choice, for a PC where it can apply (an options file copied from a bigger PC), so nothing is cleared behind the player's back.Checks on the head:
tests/test_load_default.py,tests/test_menu_ini_keys.py,tests/test_switch_table.pyand the menu checks (test_menu_modules,test_menu_module_slots,test_menu_sections,test_menu_hooks,test_menu_i18n,test_menu_model,test_menu_rows_model,test_menu_locked_button,test_menu_env_overrides,test_menu_keys,test_menu_restart,test_menu_restart_slots,test_menu_setting_walk,test_menu_size,test_menu_hit,test_menu_help_paragraphs,test_menu_i18n_count) andtests/test_settings_table.pypass.The row on this PC (64 GB), at Before the title and after a change to When needed:
And with
RX_VK_PRECOMPILE=0, the row saved at Before the title, the log: "programs are loaded when the game makes them (create)" and "the Shader loading row's Before the title is left aside: the shader preparation does not run (RX_VK_PRECOMPILE=0, or a build that is not a release), and start loads the programs inside it".View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.