fix(vk): the start-up screen counts the compute pipelines and says when it writes the pipeline cache #721

Merged
HumanBean merged 1 commit from HumanBean/Longshot:fix/startup-wait-at-100 into main 2026-11-15 06:17:02 +00:00
Owner

Type: fix · Risk: low · Tested on: none yet (game-free checks to run in CI) · Needs: Windows or Linux, a GPU with mesh shaders (any NVIDIA RTX, RDNA2+), a first start after a preparation

Why

On the first start after the shaders were prepared, the start-up screen can sit at Loading pipelines, 100%, every pipeline counted and "a few seconds left", for a long while before the game comes up. It isn't a hang, but it looks like one. The screen had stopped counting before the work was done: what it still did after that wasn't shown. Fixes #714.

How to reproduce

Seen on: v3.0.0-rc.4, reported on Discord (GPU, driver and OS not known yet). Read off the code: the path runs where programs load when the game makes them (RX_VK_LOAD=create, the default on GPUs with mesh shaders).
Settings and switches: defaults
Steps: prepare the shaders (the Builder or the launcher), then start the game: the first start after the preparation builds the noted pipelines into the pipeline cache (precompile_warm).
Expected: once the bar reads 100%, the screen soon moves on to "Starting the game".
Actual: after the noted pipelines, precompile_warm builds every kept compute pipeline and then writes the whole pipeline cache (a GB and more). Through both the screen shows "32,623 / 32,623 pipelines", 100%, "a few seconds left": the compute pipelines were reported as progress(total, total), and the write isn't counted at all.

What changed

The compute pipelines the warm builds are now in its progress total from the start, so the bar holds under 100% while they're built and the time left covers them. Once the bar is full, the screen says what the start is still doing in place of "a few seconds left": "Saving the pipeline cache" while the cache is written, and "Getting the game ready" for anything else left (precompile_at_create, the threads ending).

  • vk (gpu/vk/vk_draw.cpp, precompile_warm): program_cache_compute_keys() is taken before the noted pipelines (it is an in-memory index), and progress is reported over all_n = notes + compute pipelines. The compute pipelines are still only built once every note is done. The forced pipeline_cache_save(true) is bracketed by a flag, prepare_saving() (declared in vk_internal.h), and its time is logged: vk: precompile: the pipeline cache written out in N s.
  • start-up screen (gpu/vk/vk_progress.h): StartupState::saving, and waiting_text() choosing the text right under the bar. gpu/vk/vk_main.cpp's painter fills saving from prepare_saving().
  • tests: tests/test_startup_progress.py checks the new texts (100% counted, saving, and the time left while there is work counted). tests/test_warm_bounded.py checks that the warm counts its compute pipelines in the total and flags the cache's write.

Measurements

Verdict: not measured yet. The wait itself isn't shortened: the same work is now counted and named on the screen. What's left to measure is that the bar now holds under 100% until the compute pipelines are built, and how long the cache write takes (the new log line).

Flags and settings

None

Testing

Tested: nothing yet. The change is read against the code paths. Per this PC's rules the checks aren't run here: python -I -B tests/run_all.py is left to the forge's CI.

Not tested: a build on either platform; a start in the game; the --prepare-shaders run (the Builder's), whose bar now also counts the compute pipelines in its last part.

Must be tested:

  • Linux or Windows, a GPU with mesh shaders (NVIDIA RTX, RDNA2 or newer), on a build of this PR: prepare the shaders, then start the game once. Expect the bar to stay under 100% while the log shows vk: compute pipelines: N of M, then "Saving the pipeline cache" under the bar, then "Starting the game". The log should have vk: precompile: the pipeline cache written out in N s (Test Farm: @Beanstalk the first start after preparing the shaders, watching the start-up screen at its end, and the log lines vk: precompile:)
  • Any GPU: a start with the caches already built, expecting the screen to go as before, with no "Saving the pipeline cache" (by hand or Test Farm).

Risks

What could break: only the start-up screen's numbers and texts, and the Builder's progress bar's last part (now larger by the compute pipelines). What's built and when is unchanged.

Turning it off: revert the commit.

Compatibility: Nothing changes: no file format, cache, option or MKWVK_API_VERSION change.

Issues

Fixes #714

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure. (not measured yet: needs a start in the game)
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). (not run on this PC: waiting for CI)
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Screenshots of the same spot, captioned like the Measurements columns, for a change that shows on screen. (needs the run in the game above)
  • A game-free test added for the fix, failing on main and passing here. (added; it fails on main by reading it, since the checks look for code main doesn't have; passing here waits for CI)
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (portable C++ only, no paths; the builds wait for CI)

🤖 Generated with Claude Code

**Type:** fix · **Risk:** low · **Tested on:** none yet (game-free checks to run in CI) · **Needs:** Windows or Linux, a GPU with mesh shaders (any NVIDIA RTX, RDNA2+), a first start after a preparation ## Why On the first start after the shaders were prepared, the start-up screen can sit at **Loading pipelines**, 100%, every pipeline counted and "a few seconds left", for a long while before the game comes up. It isn't a hang, but it looks like one. The screen had stopped counting before the work was done: what it still did after that wasn't shown. Fixes [#714](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/714). ## How to reproduce **Seen on:** v3.0.0-rc.4, reported on Discord (GPU, driver and OS not known yet). Read off the code: the path runs where programs load when the game makes them (`RX_VK_LOAD=create`, the default on GPUs with mesh shaders). **Settings and switches:** defaults **Steps:** prepare the shaders (the Builder or the launcher), then start the game: the first start after the preparation builds the noted pipelines into the pipeline cache (`precompile_warm`). **Expected:** once the bar reads 100%, the screen soon moves on to "Starting the game". **Actual:** after the noted pipelines, `precompile_warm` builds every kept compute pipeline and then writes the whole pipeline cache (a GB and more). Through both the screen shows "32,623 / 32,623 pipelines", 100%, "a few seconds left": the compute pipelines were reported as `progress(total, total)`, and the write isn't counted at all. ## What changed The compute pipelines the warm builds are now in its progress total from the start, so the bar holds under 100% while they're built and the time left covers them. Once the bar is full, the screen says what the start is still doing in place of "a few seconds left": "Saving the pipeline cache" while the cache is written, and "Getting the game ready" for anything else left (`precompile_at_create`, the threads ending). - vk (`gpu/vk/vk_draw.cpp`, `precompile_warm`): `program_cache_compute_keys()` is taken before the noted pipelines (it is an in-memory index), and progress is reported over `all_n = notes + compute pipelines`. The compute pipelines are still only built once every note is done. The forced `pipeline_cache_save(true)` is bracketed by a flag, `prepare_saving()` (declared in `vk_internal.h`), and its time is logged: `vk: precompile: the pipeline cache written out in N s`. - start-up screen (`gpu/vk/vk_progress.h`): `StartupState::saving`, and `waiting_text()` choosing the text right under the bar. `gpu/vk/vk_main.cpp`'s painter fills `saving` from `prepare_saving()`. - tests: `tests/test_startup_progress.py` checks the new texts (100% counted, saving, and the time left while there is work counted). `tests/test_warm_bounded.py` checks that the warm counts its compute pipelines in the total and flags the cache's write. ## Measurements **Verdict:** not measured yet. The wait itself isn't shortened: the same work is now counted and named on the screen. What's left to measure is that the bar now holds under 100% until the compute pipelines are built, and how long the cache write takes (the new log line). ### Flags and settings None ## Testing **Tested:** nothing yet. The change is read against the code paths. Per this PC's rules the checks aren't run here: `python -I -B tests/run_all.py` is left to the forge's CI. **Not tested:** a build on either platform; a start in the game; the `--prepare-shaders` run (the Builder's), whose bar now also counts the compute pipelines in its last part. **Must be tested:** - Linux or Windows, a GPU with mesh shaders (NVIDIA RTX, RDNA2 or newer), on a build of this PR: prepare the shaders, then start the game once. Expect the bar to stay under 100% while the log shows `vk: compute pipelines: N of M`, then "Saving the pipeline cache" under the bar, then "Starting the game". The log should have `vk: precompile: the pipeline cache written out in N s` (Test Farm: @Beanstalk the first start after preparing the shaders, watching the start-up screen at its end, and the log lines `vk: precompile:`) - Any GPU: a start with the caches already built, expecting the screen to go as before, with no "Saving the pipeline cache" (by hand or Test Farm). ## Risks **What could break:** only the start-up screen's numbers and texts, and the Builder's progress bar's last part (now larger by the compute pipelines). What's built and when is unchanged. **Turning it off:** revert the commit. **Compatibility:** Nothing changes: no file format, cache, option or `MKWVK_API_VERSION` change. ## Issues Fixes [#714](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/714) ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [ ] Measurements has a verdict, or one line saying why there is nothing to measure. (not measured yet: needs a start in the game) - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [ ] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). (not run on this PC: waiting for CI) - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [ ] Screenshots of the same spot, captioned like the Measurements columns, for a change that shows on screen. (needs the run in the game above) - [ ] A game-free test added for the fix, failing on `main` and passing here. (added; it fails on `main` by reading it, since the checks look for code main doesn't have; passing here waits for CI) - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (portable C++ only, no paths; the builds wait for CI) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(vk): the start-up screen counts the compute pipelines and says when it writes the pipeline cache
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 18s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 16s
Third-party parts / As their notes say (pull_request) Successful in 26s
PR description / Description follows the template (pull_request_target) Failing after 13s
c76510c8d7
On the first start after a preparation (RX_VK_LOAD=create), precompile_warm built every
kept compute pipeline and then wrote the whole pipeline cache while the screen already
read every pipeline done, 100%, "a few seconds left". The compute pipelines are now in
the progress's total from the start, the cache's write shows "Saving the pipeline
cache", and anything else left once the bar is full shows "Getting the game ready"
in place of the time left.

Fixes #714

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean changed title from WIP: fix(vk): the start-up screen counts the compute pipelines and says when it writes the pipeline cache to fix(vk): the start-up screen counts the compute pipelines and says when it writes the pipeline cache 2026-11-15 06:16:57 +00:00
HumanBean deleted branch fix/startup-wait-at-100 2026-11-15 06:17:02 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!721
No description provided.