feat(vk): stepped sliders with commit-on-release for Render resolution and Frame generation across Modern dark and Classic themes #2383
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!2383
Loading…
Reference in a new issue
No description provided.
Delete branch "Jer9/Longshot:feat/vk-insert-menu-stepped-sliders"
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
On the Graphics tab of the Insert menu,
Render resolutionandFrame generationwere previously configured via wrappingChoicecontrols. ForRender resolution, options wrapped in an arbitrary order (Native,Quality,Balanced,Performance,Ultra Performance, andAuto), placingAutoto the left of33%and allowing accidental wrap-around fromNative (100%)toAuto (0). Furthermore, mouse-dragging sliders in the menu triggered immediate value commits on every mouse-move event. For heavy settings likeRender resolutionandFrame generation multiplier, this caused rapid back-to-back render target reallocations, optical flow buffer updates, and pipeline churn (costing +4.7 to 30.6 ms of stutter per step) while the player was merely trying to adjust the slider.This pull request resolves these UX and performance issues by introducing stepped sliders with
commit_on_releaseacross both Modern dark and Classic themes:gpu/vk/vk_menu_hit.h,gpu/vk/menu_model.h,gpu/vk/vk_menu.cpp): Introduces pure stop-index <-> permille mapping helpers (slider_stop_permille,slider_stop_index,slider_find_stop) with non-linear spacing and edge stops. Addsmenu_hit::DragStateandSetting::commit_on_release: while a slider is being dragged, thumb position, fill bar, and value text update smoothly at 60+ FPS, while the underlying setting commit and file save are deferred until the mouse button is released (or cancelled cleanly if the player switches tabs or presses Escape).gpu/vk/upscaler_rows.h,gpu/vk/menu/upscaler.cpp): Adds a dedicatedDynamic resolutiontoggle (Off / On) directly aboveRender resolution. Setting it toOnsetsopts.resolution = 0, exits Native mode if active, and hides the fixed slider. Setting it toOffexposesRender resolutionas an intuitive, non-wrapping stepped slider with engine-specific stops up to100%or Native, remembering the player's last fixed stop, including Native (defaulting to Quality 67%).longshot_options.ini: resolutionand control bridgeoption set resolution <val>remain 100% backwards-compatible.gpu/vk/framegen_rows.h,gpu/vk/menu/framegen.cpp): SplitsFrame generationinto a clean Mode choice (Off / Auto / Fixed) and an accompanyingMultiplierstepped slider (2x..8x) that appears only whenFixedis selected (remembering the player's last multiplier, defaulting to 2x). On RTX 40 series GPUs with NVIDIA DLSS-G (which supports only 2x), the multiplier slider cleanly locks at 2x with dimmed styling.gpu/vk/vk_menu.cpp,gpu/vk/menu_i18n.h):slider_cell()incorporatesfit()text fitting and marquee animation so long localized resolution strings (Quality 67% (1708x960)) never collide with arrows or overflow cell bounds. Full i18n translations added across all 13 supported languages.What a player notices:
Render resolutionis now an intuitive stepped slider with stops at both ends, clear percentage stops, and a Native stop where supported.Dynamic resolutionis a cleanOff / Ontoggle directly aboveRender resolution. Turning itOnhides the fixed slider, eliminating the previous confusingAutostop positioned left of 33%.Frame generationprovides a clean top-level choice (Off / Auto / Fixed). When set toFixed, an intuitiveMultiplierstepped slider (2x..8x) appears directly beneath it.Modern darkandClassicthemes render with clean contrast, centered text fitted inside arrows, and proper gold selection styling.Helps:
No measurable impact:
longshot_options.iniconfigurations (opts.resolutionandopts.framegenstorage is 100% backwards-compatible).Files to read first:
gpu/vk/vk_menu_hit.h: pure stop-index <-> permille helpers andmenu_hit::DragState.gpu/vk/menu_model.h:Setting::commit_on_releaseandSetting::syncdeclarations.gpu/vk/vk_menu.cpp:slider_cell()text fitting (fit()), drag lifecycle, and row synchronization.gpu/vk/menu/upscaler.cpp:Dynamic resolutiontoggle +Render resolutionstepped slider.gpu/vk/menu/framegen.cpp:Frame generationMode choice +Multiplierstepped slider.tests/test_menu_stepped_sliders.py: unit tests covering slider stops, clamping, commit-on-release, and Dynamic resolution / Frame generation mode mapping.Testing
Tested:
Modern dark(menu_theme=0) andClassic(menu_theme=1) themes at 1280x720 (RX_VK_SHOT_MENU=1, FSR 3.1):Dynamic resolution: Off+Render resolutionstepped slider (Quality 67% (854x480)cleanly fitted inside arrows viafit()).Dynamic resolution: OnwithRender resolutioncleanly hidden aboveSharpness.Frame generation: Fixed+Frame generation multiplierstepped slider (4x) aboveFrame generation by: FSR 3.1 FG.Visual comparison sheets compiled:
pr_b_modern_dark_comparison.pngandpr_b_classic_comparison.png.20/20--stricttargeted tests PASS (0 failed, 0 skipped):test_menu_stepped_sliders.py,test_framegen_by_row.py,test_menu_hit.py,test_menu_slider_ends.py,test_menu_ini_keys.py,test_menu_i18n.py,test_menu_i18n_count.py,test_settings_table.py,test_preset_exempt.py,test_bug_report_defaults.py,test_upscaler_rows.py,test_upscaler_round_trip.py,test_framegen_dlss_cap.py,test_framegen_preset.py,test_menu_modules.py,test_menu_rows_model.py,test_menu_model.py,test_menu_setting_walk.py,test_vk_braces.py,test_utf8_paths.py.tests/run_all.pyon Windows (882 passed, 29 pre-existing Windows/POSIX baseline failures that also fail on cleanmain—test_auto_handheld,test_pads_after_menu,test_build_long_paths,test_dev_*,test_linux_preflight,test_perf_report,test_crash_dialog,test_seed_reader, etc. — 59 skipped in 328 s), with 0 regressions. The final fix still needs testing.How to test:
Modern darkandClassicthemes withUpscaler = AMD FSR 3.1.Dynamic resolutionbetweenOffandOn: verifyOnhidesRender resolutionand persistsresolution=0inlongshot_options.ini; verifyOffshowsRender resolutionas a non-wrapping stepped slider with engine-specific stops up to100%or Native, stops at both ends, and clean text fitting inside arrows.Render resolutionacross multiple stops: verify the thumb, fill bar, and value label update smoothly during drag and the resolution change commits once on mouse release (and cancels cleanly onEscor tab switch).Frame generationtoOff/Auto/Fixed: verifyFrame generation multiplier(2x..8x, locked at2xon 1-stop DLSS-G) appears only underFixed, drags smoothly with commit-on-release, and persists to the sameframe_generationINI key.Still to test:
Render resolutionandFrame generation multipliersliders by hand (DragStatedeferral/commit/cancel is verified by unit tests intests/test_menu_stepped_sliders.py).Measurements
Nothing to measure: this PR changes only Insert menu layout, slider hit-testing, and deferred mouse-drag commits (zero changes to the Vulkan draw loop, upscalers, or shaders; deferring commits until release avoids triggering intermediate
+4.7–30.6 msresolution-step spikes while dragging).Risks
longshot_options.inischema churn:opts.resolution == 0(Dynamic) and fixed stops1..N, as well asopts.framegenvalues (0Off,1Auto,2..8Multipliers) continue to serialize into identical keys. Existing player INI files load with 100% fidelity.longshot_ctl.py/dev.py abcommands (option set resolution <val>,option set frame_generation <val>) synchronize row state throughrow_sync()without behavioural divergence.MKWVK_API_VERSION = 45unchanged). No game assets or save files modified.gpu/vk/menu/framegen.cpp,docs/user/graphics-and-controls.md,tests/test_menu_ini_keys.py), which rebase cleanly on adjacent lines.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
mainand passes here.tests/that reads changed source is updated, not weakened.mainand here, for a change that shows on screen.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: Windows 11 Radeon 860M (1280x720, AMD FSR 3.1, RX_VK_SHOT_MENU=1): visually verified 6 Insert menu states across Modern dark and Classic themes (Dynamic resolution Off + Render resolution stepped slider, Dynamic resolution On hiding fixed slider, Frame generation Fixed + Multiplier stepped slider)
Visual Verification: Modern Dark and Classic Themes
Captured at 1280x720 windowed (
menu_theme=0andmenu_theme=1, AMD FSR 3.1) showing the 3 Option C menu states:Render resolutionis exposed as an intuitive stepped slider (Quality 67% (854x480)cleanly fitted inside arrows viafit()).Render resolutionis cleanly hidden aboveSharpness, persistingresolution=0without the previous wrappingAutooption.Multiplierstepped slider (4x) appears directly belowFrame generation: Fixedwith smooth stepped drag and commit-on-release.Modern Dark Theme Comparison
Classic Theme Comparison
@review
Recommendation: Approve. A settings change during a drag can commit the preview to a different row, and the dynamic-resolution toggle does not restore Native after it was selected. The interactive drag behavior also still needs an in-game run. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The change replaces wrapping choices with stepped sliders and defers expensive mouse-drag commits. It adds useful previews and separates dynamic resolution and frame-generation mode, at the cost of additional state and synchronization paths.
Should fix (2): not blocking, but worth doing before merging.
gpu/vk/vk_menu.cpp:5553: The drag stores a visible row index and resolves it again against the current row list, so a visibility change can redirect the eventual commit to another setting. (more on the line) Do: Store a stable row identity for the drag and cancel it if that row is hidden or the tab changes; add an integration test that changes visibility during a drag.gpu/vk/upscaler_rows.h:250: Enabling dynamic resolution from a Native mode does not remember that fixed stop. (more on the line) Do: Remember the Native sentinel as a fixed stop and restore the corresponding Native upscaler when dynamic resolution is turned off.Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)
gpu/vk/vk_menu.cpp:5550: The interactive behavior of the new drag lifecycle has not yet been verified in the game. (more on the line) Do: Run the documented mouse-drag, release and cancel cases in an active game session, including both sliders and themes.@fixcan do L1 and L2.Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven. The reported Windows screenshots show the new layout, but the author says interactive mouse dragging has not been tested. No before-and-after runs substantiate the claimed 4.7–30.6 ms improvement.
Other systems: The controls affect saved graphics settings, the control bridge, upscaler Native modes, frame generation and both menu themes. The reported visual check covers Windows with AMD FSR 3.1; Linux and interactive drag behavior remain untested.
Switches: No environment switches added, changed or removed. The new Dynamic resolution control reflects the existing resolution setting; the multiplier control reflects the existing frame_generation setting.
Reviewed:
6ce0f5c5d2againstd02cac0fb4: Read the repository rules and PR template, commit log, changed slider helpers, settings modules, menu model and relevant menu input, persistence and bridge paths. Skimmed translations, documentation and changed tests. The large menu source and all changed test files were not read in full; docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).Checked and fine:
Testing: No commands that build, run tests or execute project code were run. The PR reports Windows visual checks and targeted tests; CI is still running.
Overlaps and merge order: The description reports overlap with PR #2369 in framegen.cpp, graphics-and-controls.md and test_menu_ini_keys.py; merge order is not established.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -234,0 +247,4 @@if (e == FSR3) return n = (int)(sizeof kFsr3FixedSteps / sizeof kFsr3FixedSteps[0]), kFsr3FixedSteps;if (e == OFF) return n = (int)(sizeof kOffFixedSteps / sizeof kOffFixedSteps[0]), kOffFixedSteps;return n = (int)(sizeof kGameFixedSteps / sizeof kGameFixedSteps[0]), kGameFixedSteps;}L2 (should fix): Enabling dynamic resolution from a Native mode does not remember that fixed stop.
When: With DLAA selected, turn Dynamic resolution on and then off. The toggle leaves DLAA and restores the last numeric stop, initially Quality 67%, instead of the Native stop the player was using.
Do: Remember the Native sentinel as a fixed stop and restore the corresponding Native upscaler when dynamic resolution is turned off.
@ -5492,1 +5550,4 @@if (drag_state.active()) { // (a slider held: it follows the cursor's x until let go)if (drag_state.row >= tab_row_count(cur_tab)) {drag_state.cancel();} else {L1 (should fix): The drag stores a visible row index and resolves it again against the current row list, so a visibility change can redirect the eventual commit to another setting.
When: While dragging Render resolution, a control-bridge request can turn Dynamic resolution on. The resolution row disappears, but the same index now identifies the next visible row; releasing the mouse passes the resolution stop ID to that row's set_row instead.
Do: Store a stable row identity for the drag and cancel it if that row is hidden or the tab changes; add an integration test that changes visibility during a drag.
@ -5489,3 +5550,1 @@if (!(ptr.held & HOS_MOUSE_LEFT) || !d.value) {drag_row = -1;save();if (drag_state.active()) { // (a slider held: it follows the cursor's x until let go)L3 (should fix): The interactive behavior of the new drag lifecycle has not yet been verified in the game.
When: The reported tests exercise the helper state and screenshots show static menu states, but neither demonstrates that actual mouse input previews, commits once on release and cancels correctly.
Do: Run the documented mouse-drag, release and cancel cases in an active game session, including both sliders and themes.
@fix
6ce0f5c5d2ae67646974Recommendation: Approve. The code is ready: only testing is left (a run of the change itself). The interactive drag behavior still needs an in-game run on the final fix. The reported screenshots do not establish preview, release, and cancellation behavior. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
ae67646974. I rebased it ontomain(6bf8cf34c8). I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
The change replaces wrapping graphics choices with stepped sliders and defers expensive slider commits until release. The final fix preserves drag row identity and restores Native resolution after toggling dynamic resolution; it adds state and validation to the menu.
Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)
gpu/vk/vk_menu.cpp:5550: The interactive behavior of the new drag lifecycle has not yet been verified in the game. When: The reported tests exercise the helper state and screenshots show static menu states, but neither demonstrates that actual mouse input previews, commits once on release and cancels correctly. Do: Run the documented mouse-drag, release and cancel cases in an active game session, including both sliders and themes.Checks: they run again on this head; a failure shows on the pull request.
Also noticed (3; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Unproven: the description reports 4.7–30.6 ms per intermediate resolution step, but does not provide comparable before-and-after drag measurements. Interactive behavior on the final fix is also unverified.
Other systems: The menu applies across Windows and Linux and across upscaler and frame-generation modes. Screenshots cover Windows with AMD FSR 3.1; Linux and live drag behavior remain unreported on the final fix.
Switches: The slider changes add no switches. The full base diff also changes gpu/vk/switches.def in an earlier upstream commit; its default and measurements were not reviewed.
Reviewed:
ae67646974against6bf8cf34c8: Read the fix diff, the drag-state helpers, relevant menu drag and resolution-toggle code, repository rules and pull request template. Skimmed the broader base diff and tests; the full base diff and all changed files were not read in full.; nothing run (a code review).Checked and fine:
Testing: No commands that build, test, or run the project were executed. The author reports Windows screenshots and pre-fix test results; CI has not run on this head.
Overlaps and merge order: The description reports adjacent overlap with PR #2369 in framegen.cpp, graphics-and-controls.md, and test_menu_ini_keys.py; merge order was not established.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.