[pr-feature][startup][shaders] Preload: print the progress line before each title file is read #184

Manually merged
TrustNo1 merged 1 commit from Jesper-A/Darner:up-preload-progress into main 2026-12-04 02:41:02 +00:00
Contributor

Refs #128, Refs #166

Contributor role (optional)

  • Fluxer ID: none given

What it changes

While the preload runs, its window first says "Reading what is already made". It stays on that text until the first progress line arrives. precompile (apps/darner/src/translate.rs) printed that line only at every 1000th shader. On this PC the title folder has 35 files that can hold shaders (3.76 GB). The first 26 of them (about 3.25 GB) hold fewer than 1000 shaders between them, and file 27 holds nearly all the rest. So the window showed no progress for 17 to 20 s (8 s when the files were still in the OS cache).

Now precompile prints the same progress line once per file, before the file is read. The preload window already reads that line as "Step 1 of 3 ... file f of 35", so it leaves "Reading what is already made" after about 1 s and shows the file count while the big files are read.

  • This is progress output only. No time is saved, and no switch is added.
  • The text "Reading what is already made" is not changed here. It is misleading, because this phase reads the title's files and not the shader cache. That would be a small separate change.
  • progress_line became pub(crate) so the new test in preload_ui.rs can build a real line.
  • New test: a_file_start_line_with_no_shaders_yet_moves_the_window_to_step_one. It feeds a "0 shaders in the cache, file 19 of 35" line to the window's parser and expects step 1, file 19 of 35.

Related, not replaced: #128 and #166 are about the preload window, and this only makes its first phase show movement. It does not fix either.

How it was tested

  • Tested revision: e232e684d, on top of 0b362cdec (the main of 2026-12-04, before #179).
  • Commands and results:
    • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.
    • cargo test -p darner --bin darner -- translate preload_ui: 10 passed, 0 failed, 1 ignored. The new test is in preload_ui::tests; I did not confirm it by name in the run.
    • Not run: cargo test --workspace --locked (gate 3). There is no CI upstream, so nothing else has checked this.
  • Gameplay, when relevant: no in-game run of this change. The effect (window leaves "Reading what is already made" after about 1 s) is expected from reading the code and from earlier logs of the same precompile code, not seen on screen with this commit.
  • Before and after: the 17 to 20 s figure is the time to the first progress line in 15 earlier preload runs with a warm shader cache on an RTX 2070 SUPER, Ryzen 7 5800X, with the title on a SATA QLC drive. No "after" timing was taken.
  • Shader wave sizes tested, when relevant: not relevant (no shader output changes).
  • Coverage gaps: no in-game run; cargo test --workspace not run; the Wine/Proton window and the PowerShell launcher window were not looked at. The extra line is printed 35 times per preload on this PC, once per file, to the console only.

Spec dependence

  • Likely general: the extra line does not depend on hardware. The bigger gain from this change is on a slow drive or a cold OS cache, where the first files take longest to read.
  • May depend on our specs: the 17 to 20 s wait and the "26 of 35 files before the first shaders" order were measured on one title folder on a SATA QLC drive. A fast NVMe drive will show a shorter wait; the file order comes from the folder walk and may differ elsewhere.
  • Untested elsewhere: AMD, Intel, Linux/Proton, and the Series X profile.

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs, searched on 2026-12-04 (open PRs' file lists via the API):
    • #142 (skip title files an earlier run finished): touches translate.rs; its precompile hunk is next to the line this adds, so expect a small textual conflict whichever lands second. It skips files; this prints progress for the files that are read. They do not do the same thing.
    • #165 (fewer compiler jobs under Wine/Proton): touches translate.rs near the start of precompile. Same note.
    • #140 (remember an unfinished preload): touches preload_ui.rs (its own parser and tests hunks). Different lines from this change.
    • #147, #153 (preload library save, warm mark) do not touch these two files.
    • No open PR adds a progress line during the file reads.

This is a draft and is posted as it stands on 0b362cdec. It has not been rebased onto newer main.

Drafted with AI assistance (Claude Code).

Refs #128, Refs #166 ## Contributor role (optional) - Fluxer ID: none given ## What it changes While the preload runs, its window first says "Reading what is already made". It stays on that text until the first progress line arrives. `precompile` (`apps/darner/src/translate.rs`) printed that line only at every 1000th shader. On this PC the title folder has 35 files that can hold shaders (3.76 GB). The first 26 of them (about 3.25 GB) hold fewer than 1000 shaders between them, and file 27 holds nearly all the rest. So the window showed no progress for 17 to 20 s (8 s when the files were still in the OS cache). Now `precompile` prints the same progress line once per file, before the file is read. The preload window already reads that line as "Step 1 of 3 ... file f of 35", so it leaves "Reading what is already made" after about 1 s and shows the file count while the big files are read. - This is progress output only. **No time is saved**, and no switch is added. - The text "Reading what is already made" is not changed here. It is misleading, because this phase reads the title's files and not the shader cache. That would be a small separate change. - `progress_line` became `pub(crate)` so the new test in `preload_ui.rs` can build a real line. - New test: `a_file_start_line_with_no_shaders_yet_moves_the_window_to_step_one`. It feeds a "0 shaders in the cache, file 19 of 35" line to the window's parser and expects step 1, file 19 of 35. Related, not replaced: #128 and #166 are about the preload window, and this only makes its first phase show movement. It does not fix either. ## How it was tested - Tested revision: `e232e684d`, on top of `0b362cdec` (the `main` of 2026-12-04, before #179). - Commands and results: - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean. - `cargo test -p darner --bin darner -- translate preload_ui`: 10 passed, 0 failed, 1 ignored. The new test is in `preload_ui::tests`; I did not confirm it by name in the run. - **Not run:** `cargo test --workspace --locked` (gate 3). There is no CI upstream, so nothing else has checked this. - Gameplay, when relevant: **no in-game run of this change.** The effect (window leaves "Reading what is already made" after about 1 s) is expected from reading the code and from earlier logs of the same `precompile` code, not seen on screen with this commit. - Before and after: the 17 to 20 s figure is the time to the first progress line in 15 earlier preload runs with a warm shader cache on an RTX 2070 SUPER, Ryzen 7 5800X, with the title on a SATA QLC drive. No "after" timing was taken. - Shader wave sizes tested, when relevant: not relevant (no shader output changes). - Coverage gaps: no in-game run; `cargo test --workspace` not run; the Wine/Proton window and the PowerShell launcher window were not looked at. The extra line is printed 35 times per preload on this PC, once per file, to the console only. ## Spec dependence - Likely general: the extra line does not depend on hardware. The bigger gain from this change is on a slow drive or a cold OS cache, where the first files take longest to read. - May depend on our specs: the 17 to 20 s wait and the "26 of 35 files before the first shaders" order were measured on one title folder on a SATA QLC drive. A fast NVMe drive will show a shorter wait; the file order comes from the folder walk and may differ elsewhere. - Untested elsewhere: AMD, Intel, Linux/Proton, and the Series X profile. ## Checklist - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs, searched on 2026-12-04 (open PRs' file lists via the API): - #142 (skip title files an earlier run finished): touches `translate.rs`; its `precompile` hunk is next to the line this adds, so expect a small textual conflict whichever lands second. It skips files; this prints progress for the files that are read. They do not do the same thing. - #165 (fewer compiler jobs under Wine/Proton): touches `translate.rs` near the start of `precompile`. Same note. - #140 (remember an unfinished preload): touches `preload_ui.rs` (its own parser and tests hunks). Different lines from this change. - #147, #153 (preload library save, warm mark) do not touch these two files. - No open PR adds a progress line during the file reads. This is a draft and is posted as it stands on `0b362cdec`. It has not been rebased onto newer `main`. Drafted with AI assistance (Claude Code).
The first files of the title folder hold no shaders, and precompile printed
its progress line only at every 1000th shader, so the preload window showed
"reading" for 15 to 20 s with nothing moving. Print the same line once per
file before it is read; preload_ui already reads it as step 1, file f of F.
Log/progress output only, no new switch.

This change was made with AI assistance (Claude Code).
Jesper-A changed title from WIP: [pr-feature][startup][shaders] Preload: print the progress line before each title file is read to [pr-feature][startup][shaders] Preload: print the progress line before each title file is read 2026-12-04 02:30:19 +00:00
Owner

Second-opinion review: merge as is. precompile prints the progress line once per file, before reading it, so the window leaves "Reading what is already made" after about a second. at is computed before bytes_before grows, so the percentage is right, and the new test covers the window's parsing. Output only, no default change. It conflicts with #142 in translate.rs (both add code before std::fs::read); there the progress line should stay before #142's skip check, so skipped files still move the window.

Second-opinion review: merge as is. `precompile` prints the progress line once per file, before reading it, so the window leaves "Reading what is already made" after about a second. `at` is computed before `bytes_before` grows, so the percentage is right, and the new test covers the window's parsing. Output only, no default change. It conflicts with #142 in translate.rs (both add code before `std::fs::read`); there the progress line should stay before #142's skip check, so skipped files still move the window.
TrustNo1 manually merged commit 7b2e2703b0 into main 2026-12-04 02:41:02 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
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
TrustNo1/Darner!184
No description provided.