Show Prepare the Shaders moving in the launcher: the game prints its counts and the step sends them on.

The step sat at 0 % until it was done, an hour on some PCs, because nothing it ran reported progress to the launcher. nx2navi.exe --prepare-shaders now prints how many shaders it has translated and how many it has built into the driver's cache every 2 s. make_game.py reads them as they come and fills the bar, the translation the first half and the build the second, with the counts in the step's text. An event every 10 s keeps the text current while nothing is printed, and after 3 minutes without a count moving it says so, and that the step is still running.

The selftest draws the step as a tenth screen. Its made-up update was version 0.3.11, so from 0.4.0 on the update-ready screen showed Up to Date and was no longer drawn; it is now a minor version past the launcher running it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BSHQpLnScF9sNv4LNAaaS3
This commit is contained in:
Claude
2026-11-09 08:32:13 +00:00
parent 754ded99e0
commit b1421faaf9
7 changed files with 166 additions and 14 deletions

View File

@@ -2221,10 +2221,18 @@ static long long prepare_files(const char *ans_path, const char *prg_path, int t
for (int i = 0; i < threads; i++)
if ((t[k] = plat_thread_new(prep_worker, &p, "shader prepare"))) k++;
if (!k) prep_worker(&p);
for (int m = 0; m < k; m++)
while (!plat_thread_join_ns(t[m], 5000000000u))
rt_log("gfx_shader: prepare: %lld of %zu pairs, %llu translated, %.0f ms", (long long)p.done, p.n_ans,
(unsigned long long)((uint64_t)n_xlated - xl0), (double)plat_now_ms() - t0);
// every 2 s a count on stdout for tools/make_game.py (step_shaders reads "prepare-shaders: progress" lines and shows
// them in the launcher, which otherwise sat at 0 % for the whole step), and every 10 s one in the log
for (int m = 0, polls = 0; m < k; m++)
while (!plat_thread_join_ns(t[m], 2000000000u)) {
printf("prepare-shaders: progress translate %lld %zu\n", (long long)p.done, p.n_ans);
fflush(stdout);
if (++polls % 5 == 0)
rt_log("gfx_shader: prepare: %lld of %zu pairs, %llu translated, %.0f ms", (long long)p.done, p.n_ans,
(unsigned long long)((uint64_t)n_xlated - xl0), (double)plat_now_ms() - t0);
}
printf("prepare-shaders: progress translate %zu %zu\n", p.n_ans, p.n_ans);
fflush(stdout);
svc_set_limit(svc_runtime_limit());
rt_log("gfx_shader: prepare: %zu %s of %zu programs: %llu translated, %lld failed, %lld without a program, the rest "
"cached; %lld default variants with refined answers; %.0f ms", p.n_ans, what, p.progs.n,

View File

@@ -3570,7 +3570,18 @@ static void lb_warm_prepared(const char *dir) {
for (int i = 0; i < cpus && i < JR_SLOTS; i++)
if ((t[k] = plat_thread_new(lb_warm_worker, (void *)(intptr_t)k, "lib warm"))) k++;
if (!k) lb_warm_worker((void *)(intptr_t)0);
for (int i = 0; i < k; i++) plat_thread_join(t[i]);
// every 2 s a count on stdout for tools/make_game.py (step_shaders), as gfx_shader.c prepare_files prints for the
// translation: a driver building for a long time still shows the step moving
for (int i = 0; i < k; i++)
while (!plat_thread_join_ns(t[i], 2000000000u)) {
plat_mutex_lock(&LB.stat);
uint64_t d = LB.done;
plat_mutex_unlock(&LB.stat);
printf("prepare-shaders: progress build %llu %zu\n", (unsigned long long)d, n);
fflush(stdout);
}
printf("prepare-shaders: progress build %zu %zu\n", n, n);
fflush(stdout);
if (SK.journal) plat_file_close(SK.journal), SK.journal = NULL, plat_file_delete(jp); // every build returned
lb_report("preparation done");
// with gpl off only compute variants are built: say so, rather than count the skipped ones as built