fix(menu): the Scan row's help lines end, so a Linux window starts and the menu opens again #1815
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!1815
Loading…
Reference in a new issue
No description provided.
Delete branch "mooki/Longshot:fix-nfc-scan-hint-loop"
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: fix · Risk: low · Tested on: Linux, RTX 4090 · Needs: Windows, any GPU
TL;DR
Since the menu rows moved into modules (#1774), on Linux the game never gets past its start-up screen in a window, and a windowless run stops presenting at its first Insert. The menu's help-box sizing asks the NFC "Scan tag on controller" row for its help lines one after another until one says nothing, and on a Linux host that row always has another: the render thread loops at 100%. The row now has its two documented lines and then none. With it, the window starts and the scripted Insert opens the menu.
Breakdown
measure_help(new in #1774) calls a button's hint for line 0, 1, 2 and so on until it returns nothing;nfc_scan_saysanswered every line with a text when the host's scan state was not "none", and the non-Windows host reports state 5 always. The menu's glyph baking draws the page once at start-up, so a window loops before the game's first frame.nfc_scan_saysreturns nothing from line 2 on (line 0 the longest text, line 1 the one now, as its comment already said), and a new check runs the menu's loop against it for every scan state.Why
#1774 added a loop to
measure_help(gpu/vk/vk_menu.cpp) that asks a button's hint for line k = 0, 1, 2, ... until it returns nullptr, so that the help box keeps the height of the tallest line (the Bug report's once saved, the Scan row's). The Scan row's hint,nfc_scan_says(gpu/vk/menu/nfc.cpp), returns a text for every k oncehost->nfc_scan(0)is not 0. A non-Windows host answers 5 ("no Switch 2 Pro Controller over USB") always (host/nn_nfp.c), so on Linux the count never ends. Before #1774 only the line being shown was asked for, so nothing looped.measure_helpruns whenever the menu page is drawn for a new width, andprebake(gpu/vk/vk_menu.cpp) draws the page once into a scratch list while the menu is closed, so the first open has no glyphs to bake. In a window that happens on the start-up screen's thread before the game's first frame; windowless, the menu is drawn only once it is opened (with the menu stream,RX_VK_SHOT_MENU=1). Main did not build on Linux after #1774 until the include fix, so no Linux build of it could have shown this.How to reproduce
Seen on: Arch Linux, Hyprland (Wayland), RTX 4090 (NVIDIA 615.78), main at
0de25c3e4aplus the one-commit include fix that main needs to build on Linux (its own pull request)Settings and switches: (window) defaults; (windowless) a start from a disposable save with
RX_VK_SHOT_MENU=1andRX_VK_MENU_SCRIPT=25:INS,28:TABR,29:TABR,31:ESC(Insert 25 s after the first presented frame, two tabs right, Esc)Steps: (window) start the game in a window on Linux; (windowless) start it as above and wait for the 25 s mark
Expected: the window shows the start-up screen and then the game; windowless, the menu opens at the Insert and the game keeps presenting
Actual: window: the compositor never maps the window, the game presents one frame in 80 s (the log says "start-up: the window is not being shown"), no fatal, crash or device-lost line. Windowless: the present trace ends exactly at the Insert (5460 frames over 25.0 s, none after) and the game ends only at its wall. In both, one thread is at 100% CPU for the rest of the run, always in the same place:
ImFontCalcWordWrapPositionExcalled fromdraw_options(wheremeasure_helpis inlined),draw_menu, then in the windowprebake,menu_record,present_imageand the start-up screen's thread, windowlessmenu_record_image,do_present,replay_thread_main.What changed
nfc_scan_saysends its list: line 0 is the longest text, line 1 the one for the scan's state now, and nothing after, which is the order its comment andhn_nfcalready follow.gpu/vk/menu/nfc.cpp: one early return,if (variant > 1) return nullptr;, and the comment says why.tests/test_nfc_scan_hint.py: compiles the function from the source with a stub host and runs the menu's loop with a bound, for no host and every scan state 0 to 7 (state 5 is the Linux host's).Measurements
Verdict: nothing to measure for speed: one early return in a function called once per menu draw; the table is the stall it removes.
Hardware: Linux 7.2, RTX 4090 (NVIDIA driver 615.78), Core i9-13900K
Scene: the game started from a disposable save in the Kokiri Forest, windowless with the scripted Insert at 25 s, and in a window for 80 s
Method: the same script, options and save on both builds, one start each, in the side lane (beside another game); the builds are main with the include fix and this PR's commit on top of it
How to reproduce: the Steps above with the build of each commit
0de25c3e4a7e4cf257d2measure_helpin two stack samplesThe builds measured are main with the include fix (
8a1fc7d5c1) and this PR's commit on top of it (78d40349c7,v3.0.0-rc.8-71-g78d40349c7): the include fix touches onlygpu/vk/menu/pipeline_list.cpp, this PR onlygpu/vk/menu/nfc.cppand its check.Flags and settings
None.
Testing
Tested: on Linux (RTX 4090): the new check fails on main and passes on this head; the 72 game-free checks that read the menu or NFC sources ran through the idle gate on main and on this head, 68 pass with 4 failing on main (the new check and
test_bug_report_defaults,test_damage_debug_menu,test_upscaler_rows) and 69 pass with the same 3 failing here; the file passes the Windows-target syntax check (x86_64-w64-mingw32-clang++ -std=c++20 -fsyntax-only -Wall -Wextra); the build above started once windowless with the script above and once in a window, each from the same save and options as the run on main: the menu opened at the Insert, went to the Gameplay tab and closed, the game kept presenting to the end and went on from the title to the game, and the window was shown and presented 9173 frames, fatal=0 crash=0 devlost=0 nocore=0 kernel=0 nvrm=0 in both. The other hint functions ofgpu/vk/menuwere read for the same shape (everyhint(v, k)ends: the table ones return nothing from k = 1, the others are bounded) and none other can answer every k.Not tested: a Windows build and run; the menu opened by hand in a window on Linux (the window run's scripted Insert falls on the start-up screen, so what it shows is that presents continue, not a picture of the menu); the whole suite.
Must be tested:
Risks
What could break: the Scan row's line is the same in every state; only the loop's end changes. A Windows build that depends on a further line (a variant above 1) would lose it, and nothing reads one:
measure_helpand the row's own drawing ask for lines 0 and -1. On Windows the scan state is not reset after a scan (scan_stateinhost/nn_nfp.c), so before this change any recompute of the help height after a scan (a menu size change, a new window width, a saved pipeline list) would have looped the same way; that is read from the code, not run, and is why Windows is in Must be tested.Turning it off: revert the commit.
Compatibility: Nothing changes.
Issues
See #1774
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.New on this forge; not opened on GitHub.
Since the menu model (#1774) a Linux game does not get past its start-up screen in a window, and a windowless run stops presenting at its first Insert:
measure_helpasks a button's hint for line 0, 1, 2 and so on until it returns nothing, and the Scan tag on controller row (nfc_scan_says) answers every line on a Linux host, whose scan state is always 5. The render thread loops at 100% there (ImFontCalcWordWrapPositionExfromdraw_options, read from the running game); in a window it isprebakedrawing the page once at start-up.This PR gives the row its two documented lines and nothing after (one early return in
gpu/vk/menu/nfc.cpp), with a check that runs the menu's loop against the real function for no host and every scan state: it fails on main and passes here.On Linux (RTX 4090) a window of main stayed unmapped with one frame presented in 80 s, and with this change it was shown and presented 9173 frames; the same scripted Insert at 25 s windowless stopped presenting on main (last frame 5460) and kept presenting with this change (10906 frames, the menu drawn on the Graphics and Gameplay tabs). The other hint functions of the menu were read for the same shape and none can answer every line.
Windows is not tested: the scan state is not reset there after a scan, so it may loop the same way after a Scan press; please try that by hand.
WIP: fix(menu): the Scan row's help lines end, so a Linux window starts and the menu opens againto fix(menu): the Scan row's help lines end, so a Linux window starts and the menu opens againPossibly related, for context:
@Beanstalk
Beanstalk test farm
Commit
7e4cf25· tier reviewed · approved by mooki · dashboardWhat will be tested · AI plan (
gpt-6.1-terra)On Linux and Windows, this plan opens the menu windowlessly from the Kokiri starting save, changes tabs, closes it, and checks that presentation continues. Each tester runs one start per build, taking roughly 12 minutes; menu screenshots and frame times are compared with main. A crash, stalled presentation, menu image difference, or substantial frame-time regression fails the test; main may itself stall on Linux. The automated sequence does not press the NFC Scan row or test a physical reader.
kokiri-start(switchesRX_VK_SHOT_MENU=1,RX_VK_MENU_SCRIPT=5:INS,8:TABR,9:TABR,12:ESC), then take the picture menu-open to compare with main, take the picture menu-tabs to compare with main, measure after-menu for 10 s (after 0 s warm-up); 1 run on each side.Done (started 2026-11-19 23:01 UTC, last report 2026-11-19 23:07 UTC). Comment
@Beanstalkto run it again.AMD Radeon RX 9070 XT (RADV GFX1201), 26.2.6; 2: linux+amd+radv+dgpuAMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0; 2: windows+amd+amd-proprietary+dgpuAMD Radeon RX 9060 XT, 2.0.416Measurements · linux
Verdict: could not be judged on linux (2/1 report).
Hardware: 1: linux+amd+radv+dgpu
AMD Radeon RX 9070 XT (RADV GFX1201), 26.2.611th Gen Intel(R) Core(TM) i9-11900KB @ 3.30GHz, 32 GB RAM; 2: linux+amd+radv+dgpuAMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7AMD Ryzen 7 5800X3D 8-Core Processor, 64 GB RAMScene: menu-presentation, from the repository's save kokiri-start (RX_VK_SHOT_MENU=1, RX_VK_MENU_SCRIPT=5:INS,8:TABR,9:TABR,12:ESC); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); menu-presentation: 1 game start a side, after-menu 10 s after 0 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
None: the plan varied no setting, switch or build option.
Markdown for the PR description
Measurements · windows
Verdict: pass on windows (2/1 report): no rule failed and no PR run crashed.
Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM; 2: windows+amd+amd-proprietary+dgpuAMD Radeon RX 9060 XT, 2.0.416AMD Ryzen 5 5600 6-Core Processor, 32 GB RAMScene: menu-presentation, from the repository's save kokiri-start (RX_VK_SHOT_MENU=1, RX_VK_MENU_SCRIPT=5:INS,8:TABR,9:TABR,12:ESC); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); menu-presentation: 1 game start a side, after-menu 10 s after 0 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)0de25c37e4cf25Flags and settings
None: the plan varied no setting, switch or build option.
Markdown for the PR description
Verdict: Request changes. The Scan help loop fix looks sound. The readiness evidence needs a full-suite result and a Linux run with a buildable control.
Reviewed mooki’s
7e4cf257against0de25c3e. The finite help-line iteration addresses the reported startup/reopen loop. Please report the full game-free suite outcome, naming failures reproduced on main and any skips, rather than counting focused checks as a full-suite pass.The earlier Linux farm controls failed before gameplay because the pipeline-list module lacked POSIX includes. Rebase onto main containing the include fix and rerun Linux on an exact buildable pair. Start a new game, open Insert, switch tabs, close it and confirm the game continues presenting. Separately on Windows, manually visit the Scan row/help, close and reopen Insert, and resize the window. Keep that manual result separate from the farm startup check.
Credit to the Windows Beanstalk testers: the RTX 3050 Ti Laptop and RX 9060 XT passed the scripted route, with p99 19.0 ms on each side in the summary. That route did not establish the manual Scan/reopen/resize check.
Tested on a second setup: RTX 3060 Laptop GPU (6 GB), NVIDIA 620.70.06, CachyOS (Linux 7.3.4), KDE Plasma Wayland, two screens (HDMI 1080p 75 Hz primary, laptop panel 1080p 300 Hz), fullscreen. It fixes #1834.
Before and after are the same game folder (nightly-596-2692a6e3) with only
bin/longshot_vk.sochanged. "After" is that renderer built from2692a6e3with this PR's commit cherry-picked on top (dev_build.py vk).vk: start-up: pipelines N of M)start-up: the window is not being shownpresent texture ... rendered), the shaders took 246.7 sNo fatal, crash or device-lost lines.
posihdun referenced this pull request2026-11-20 04:30:29 +00:00