[pr-feature][startup][shaders] Preload window: say what step 3 is doing, and keep a log file #215
Loading…
Reference in a new issue
No description provided.
Delete branch "Jesper-A/Darner:up-preload-step3-progress"
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?
Refs #128
Contributor role (optional)
What it changes
DARNER_PRELOAD_SAVE_EVERYis set). Seen in use, not measured; the rest is read from the code.What it does, all in
apps/darner/src/warm.rs,apps/darner/src/preload_ui.rs,locales/en.jsonand two smallpub(crate)changes (play.rs,warm.rs):warm.rs):N of M in the library, T sis printed for the first pipeline, then every 2 s or every 1 % of the list, whichever comes first (was every 500 pipelines ininto_libraryand every 250 infill_library). New log-style linesopening the pipeline libraryandsaving the pipeline libraryare printed before the open and before the final save.preload_ui.rs):compile memorylines have been seen (so it is not shown when nothing is compiling);DARNER_PRELOAD_SAVE_EVERYis set;<home>\logs\darner-preload-<stamp>-<pid>.log(its printed lines and its tracing; the 5 newest are kept). The window shows the path and printsLog: <path>when the preload ends, so a player can attach it to a report. If the folder cannot be made, the preload logs to the console only, as before.Behaviour changes, stated plainly
DARNER_LOG_FILEfor it).N of M in the pipeline library in T sline now counts as step 3; before it was parsed as step 2.locales/en.jsononly; zh-CN falls back to English (not translated here).Whether this needs the maintainer's OK: upstream's template asks "Changes a default" and asks for an A/B result for a change of a default. This is a change of what is shown and logged, not of how pipelines are made, so there is no speed claim. I put "yes" below and ask the maintainer to say whether he wants it behind a switch (for example, only the log file) or on by default.
How it was tested
up-preload-step3-progress@3278a86ae, on top ofmainad070f073(main has moved tof3840d73dsince; a trial merge with it had no conflicts).3278a86ae):cargo test -p darner --bin darner -- preload_ui warm::tests: 30 passed, 1 ignored.cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.cargo test --workspace --locked: all passed except 2darner-gpuwatch tests, which passed when run alone; a fullcargo test -p darner-gpu --librerun gave 1753 passed.cargo xtask policy: ok.compile memorylines are in the log.DARNER_PRELOAD_SAVE_EVERY, and the old text with it.Log: <path>; Play now and Quit still end the child normally with stderr piped.Spec dependence
Checklist
main. (Branch is onad070f073, not the latest main; one commit.)docs/asset-policy.md. (Text only: 4 files, +320 -41; no game data, no dumps, no screenshots.)Checked for overlap
preload_ui.rs,translate.rsandlocales/en.json: step-1 progress by bytes, and F1 menu presets. Different change (step 1, not step 3); conflicts inpreload_ui.rsandlocales/en.jsonare likely. Whichever merges second will rebase.preload_ui.rs,play.rsandlocales/en.json. #142 (skip done files, WIP) touches onlytranslate.rsand the shader cache, so no file overlap. #153 touchesplay.rs. #140 and #142 currently show as not mergeable; the maintainer has said #140 merges after the rebase.DARNER_PRELOAD_SAVE_EVERY; this PR reads it only to choose the hint text.This change was made with AI assistance (Claude Code).
A member's screenshot showed "0 of 822 pipelines (0 %)" with no sign of life in step 3 ("Storing them for loading"). - warm: the "N of M in the library" line is printed by time (every 2 s) or every hundredth of the list, whichever comes first, in both into_library and fill_library (was every 500 and 250 pipelines), plus "opening the pipeline library" and "saving the pipeline library" lines. - preload window: the time spent in the step; a line naming the activity (opening the saved library, making pipelines, saving it, a save skipped because another Darner held the library's writer lock); a "still working" note after 60 s with no new count while compile memory lines show the compiles go on. The window now reads the preload's stderr too. - The step-3 hint said Play now keeps what is built; step 3's pipelines are written only when it ends (unless DARNER_PRELOAD_SAVE_EVERY). - The preload's log (its lines and its tracing) goes to <home>\logs\darner-preload-<time>-<pid>.log (five newest kept) instead of nowhere; the path is in the window and printed when it ends. New strings are in locales/en.json only; zh-CN falls back to English. This change was made with AI assistance (Claude Code).Review of
3278a86a(read only, not built or run):N of M in the libraryform, so the window's parser still reads it. The test covers the cases.saving the pipeline librarybefore the final save fixes the silent end of step 3. The new step-3 hint is honest about what Play now keeps.DARNER_LOG_FILEwith create + append (darner-corelogging.rs), and the parent appends the printed lines to the same file. On Windows both handles share writes, so neither truncates the other. Piping stderr and echoing it keeps the console as it was. Pruning to the five newest by name works because the stamp sorts by time.preload_ui.rs. Whichever goes second needs a rebase. #140 also reads the final... in the pipeline library in ... sline, which this PR leaves unchanged.locales/zh-CN.json(the fivepreload.activity.*,preload.log,preload.play_now_description_store,preload.progress.step_time), as #26 and later PRs did, so Chinese players don't see English lines in a Chinese window.Ready to merge once the WIP tag is dropped and the zh-CN keys are in.
WIP: [pr-feature][startup][shaders] Preload window: say what step 3 is doing, and keep a log fileto [pr-feature][startup][shaders] Preload window: say what step 3 is doing, and keep a log fileThe zh-CN keys are in:
23ec6ad82adds the eight new keys tolocales/zh-CN.json(the fivepreload.activity.*,preload.log,preload.play_now_description_store,preload.progress.step_time), and0d431b386puts back a space after a colon that the first commit dropped in the existingpreload.descriptionline. Net change against3278a86ae:locales/zh-CN.json+8 lines, nothing else.On
23ec6ad82: the zh-CN.json parse check passed;cargo test --locked -p darner --bin darner -- preload i18n locale11 passed, 1 ignored;cargo clippy --workspace --all-targets --locked -- -D warningsclean;cargo xtask policyok. Not run with--all-features, and not run in game; the Chinese text width in the window is unchecked.Two translations a native reader may want to adjust: "Making pipelines." is "正在生成管线。", and the step time is "{0}(本步骤已用 {1})".
This comment was written with AI assistance (Claude Code).
One failure is missing from the log the window asks players to attach. On a clean release build of
0d431b3867, create a regular file namedshadersinside a disposable profile’s cache, then startdarner playwith first-start preload enabled. The preload child printsError: creating <cache>/shadersand Windows error 183 before the launcher reports child exit 1. The advertised preload log is 579 bytes and ends after the normal introduction. It contains neither the error nor its cause. The game then fails separately on the same path. Inpreload_ui.rs, the stderr reader echoes the child’s plain stderr to the console. The child logger only duplicates structured tracing into the file. A regression check should verify that both the outer error and its cause appear once in the attachment.The successful run used
--language zh-CN, two preload workers and 768 previously recorded pipeline keys on Windows 11 / RTX 4070 Ti SUPER. In the actual window I could read the translated step timer, progress count and log filename on steps 1 and 2. At 200/760 the building message and both buttons fit. The long directory was shortened in the middle and the filename stayed visible. The final store took one second, too short for my visual capture. Its log contains opening, 110 progress updates from 1/768 through 764/768, saving, then 767/768 stored. The game reached the world and exited normally. Retention kept the four newest seeded preload logs plus this run and left an unrelated log intact.Separately, I measured ten labels per language with Windows GDI at 96, 120, 144 and 192 DPI. All 80 English/Chinese rectangles fit horizontally and vertically. Only the current desktop scale was visually checked. This covers layout, not a native-speaker review. Tested with Codex assistance.
Thanks, that's a real gap: the attachment the window asks for left out exactly the line that explains the failure.
Fixed in
0cea71f11(one file,apps/darner/src/preload_ui.rs). The launcher's stderr reader still echoes every line of the child to the console, and now also appends to the preload log the lines the child's own logger did not write there (Error: ...,Caused by: ..., a panic message). Lines that start with a log timestamp or[log]are already in the file from the child's logger and are not written twice.New test
the_childs_plain_error_lines_reach_the_log_once_and_its_logged_lines_do_not_repeatfeeds the reader anError: creating <cache>/shaders/Caused by: ... (os error 183)pair plus a logged line, and checks the two error lines appear once in the log and the logged line is not repeated.On
0cea71f11:cargo test -p darner --bin darner -- preload12 passed (the new test included), 1 ignored;cargo clippy --workspace --all-targets -- -D warningsclean (the commit does not touch Cargo.lock);cargo xtask policyok. Not run: a real failing preload (yourshaders-file repro),--all-featuresclippy and the full workspace tests. One known limit: a tracing message that itself contains a newline would have its later lines appended a second time (duplicated, not lost).Thanks also for the zh-CN, DPI and retention checks.
This comment was written with AI assistance (Claude Code).
Confirmed on
0cea71f117with the original failing preload on Windows 11. I put a regular file at<private cache>/shadersand compared the child’s console output before the launcher reported exit 1 with the attachment named by the window. The attachment now containsError: creating …/shaders,Caused by:, and the Windows error 183 message exactly once each. The same three lines appeared zero times on0d431b3867. The files were 830 and 579 bytes respectively. Both children exited 1 as expected for this fixture. This closes the missing-error reproduction I reported above. Tested with Codex assistance.Review of
0cea71f1(read only, not built or run):Checked:
warm.rs):progress_dueprints the first line, then one every 2 s or every 1 % (at least 1), and the mutex keeps the workers from printing the same count twice. Bothfill_libraryandinto_libraryuse it. The newopening/saving the pipeline librarylines go around the open and the final save, so step 3 always says something.preload_ui.rs):compile memorylines, so an idle preload doesn't claim to be working.DARNER_PRELOAD_SAVE_EVERYis off, which matches what step 3 actually keeps.... in the pipeline library in ...line is now read as step 3.DARNER_LOG_FILE.Error:,Caused by:, a panic) are added, and the test covers the colour-code and[log]cases.YYYYMMDD-HHMMSSstamp sorts correctly, and it only deletesdarner-preload-*files in Darner's ownlogsfolder.f3840d73).Small points, none blocking:
darner-preload-<time>.log, but the name isdarner-preload-<time>-<pid>.log.writeln!can issue the line and the newline as separate writes, so a line can rarely be split by another writer's line. Formatting into aStringand writing it once would avoid that. It's cosmetic.preload_ui.rs) and with #140. Whichever lands second needs a rebase.Ready to merge.
0cea71f1testcall-ok: safe to build and test. It only changes the preload window and writes and rotates its own log files.I tested
0cea71f117bfusing the PR’sWM_PAINTcode and English and zh-CN catalogs on Windows 11. The fixture supplied step-3 progress and a log path. No game was launched.On a physical 150% display, a hidden per-monitor-aware window painted a 900 × 459 client. I inspected both languages. The activity, hints, buttons and log row stayed separate, and a 260-character path retained its complete filename after ellipsis. The default DPI-unaware fixture reported 96 DPI and painted a 600 × 306 logical client.
At 125% (120 DPI injected into the same paint code, 750 × 382 client), I found one zh-CN edge case. A 98-character path was drawn without an ellipsis and lost the final
gin.log. Removing thatgchanged zero pixels inside the production clip but changed 60 pixels without the clip. English showed the same path in full. The 260-character path kept its filename in both languages. I saw no vertical clipping or row overlap.Thank you, TrustNo1, for the review, and superhero-520 for the 125 % and 150 % check.
All three small points are real. I read each one on
0cea71f11(apps/darner/src/preload_ui.rs). Nothing was built or run for this comment. I'd rather not move the approved head, so each fix goes into a follow-up PR after this one merges.darner-preload-<time>.log.log_path()(lines 256 and 276) buildsdarner-preload-<time>-<pid>.log. Fix: add-<pid>to the doc.DARNER_LOG_FILE), the stdout thread (lines 338 to 346) and the stderr thread (lines 353 to 360 and 312). The two parent threads usewriteln!(file, "{line}"), which can write the text and the newline separately. Fix: the parent gets one writer behind a lock, and each line is built as oneStringwith its newline and sent in a singlewrite_all. The child's logger stays as it is. I can't promise this removes every interleave with the child, only the ones between our two threads.DT_PATH_ELLIPSIS, and all rows are scaled byGetDpiForSystem(lines 439 to 446). superhero-520's 98-character zh-CN path lost its lastgat 120 DPI, so I take it as confirmed. I haven't found why the ellipsis does not trigger there. Fix: measure the text withGetTextExtentPoint32Wand shorten the path myself, keeping the file name. Wrapping the row to a second line is the other option. Whichever I pick, I'd check it at 100, 125 and 150 % in both languages before posting the PR.The same follow-up can also read the child's stderr as lossy bytes to the end (line 306 uses
lines().map_while(Result::ok), which stops at the first line that isn't valid UTF-8).Merge order with #228 and #140 is noted. #140 is mine, so I'll rebase it if it lands second.
This comment was written with AI assistance (Claude Code).