Start-up screen: the window opens at once, with a splash and the shaders' progress #860
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!860
Loading…
Reference in a new issue
No description provided.
Delete branch "startup-screen"
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?
On the first start after an install or an update, the game prepares every shader program and the pipelines its notes name before its window shows anything: 136 s on an RTX 3090 here, several minutes on slower PCs (#711: 7.5 min on an RX 6650 XT). On Linux nothing appears at all; on Windows a console shows a count and the window does not answer. Players take it for a hang, close it at "99%" or start the game a second time (#615, #643).
Now the window opens at once and shows what is being done:
What changed
prepare_run,predict_runandprecompile_runrun on a thread of their own. A second thread draws a small screen with the Insert menu's text renderer (GDI on Windows, the stb_truetype stand-in on Linux) and presents it about 30 times a second throughpresent_image.assets/hookshot.png, the builder's), the HOOKSHOT wordmark and the version ("v2.0.5"; "v2.0.5 dev" between releases). After a second it shows what the start is doing:gpu/vk/vk_progress.h(startup_view, tested on its own) and drawn ingpu/vk/vk_startup_paint.h; neither needs Vulkan.nx2/build.pydecodesassets/hookshot.png(nx2/logo_rgba.py, standard library only) into a header in the build's own folder, and the screen blends it into its picture, scaled with the rest (112 px tall at 720 lines). A tree without the picture builds without the logo.mkwvk_close_asked, before it ends the process. An executable and a back end of different versions still close.--prepare-shadersand the builder's@@progress. The count also goes to the log every 10 s.RX_VK_STARTUP_SCREEN=0brings back the old behaviour.Measured on Linux (CachyOS, Sway/Wayland) with an RTX 3090: from launch to the first frame in the window, the program cache emptied for the first starts. Other jobs shared the PC, so the totals vary from run to run; the window times do not.
RX_VK_STARTUP_SCREEN=0for "before")Closing at 25 s: the process exited by itself 0.7 s later (exit code 0), with no
hookshot_prepared.bin.warmingor.runningmarker left.Overlap
precompile_runas it is, so it works with both. They conflict as text with the twoprepare_stopped()checks inprecompile_run's worker and wait loops.prepare_run's warm-up marker code.vk_menu.cppandvk_main.cpptoo.Testing
tests/test_startup_progress.pycompilesgpu/vk/vk_progress.hon its own. It covers the count's separators, the percentage (never 100% before the end), the time-left wording, the estimate (steady progress, a resumed run, a slow stretch, a stall, a new stage) and the screen's states (wordmark alone in the first second, steps on a first start, none on a warm one, closing, starting). It also checks the sources: windowed starts prepare behind the screen, headless ones do not, the workers stop on a close, and a stopped preparation does not write its stamp.tests/run_all.pypicks it up.tests/test_fps_overlay_order.pynow also covers the start-up screen's copy.Not tested
PeekMessage/DispatchMessage);WM_CLOSEwaiting up to 10 s inside the window procedure for the workers to stop (the window does not answer during that wait);GetClientRect, sinceWM_SIZEis left out until the renderer has started (WM_ERASEBKGNDmay flash black during a resize);A second, separate commit gives the Insert menu's selected row rounded corners and a rounded marker, to match. It can be dropped without touching the rest.
Closing to keep the queue clear — please rebase on current main and reopen; thanks!