[bug][startup][shaders] Preload window opens again on every start, and starts over, after a preload was stopped or the exe changed #128

Open
opened 2026-12-03 22:18:39 +00:00 by Jesper-A · 1 comment
Contributor

What happened

The preload window opens on start and preloads everything again, even though part of it (or all of it) was already preloaded in an earlier start.

How to see it:

  1. Start the game with a darner.exe that has not finished a preload. The preload window opens.
  2. Click "Play now" (or "Quit") while it is still working.
  3. Start again. The window opens again and the counts begin from the start.

Same thing after a new build or an update: the window opens again, because the "preload is done" mark belongs to one exact darner.exe.

Not checked: whether a preload that runs to the end and finishes without error opens the window again on the next start of the same exe. By the code it should not.

GPU and driver

NVIDIA GeForce RTX 2070 SUPER 8 GB (Turing), driver 621.40, Resizable BAR off.

CPU, RAM and Windows version

AMD Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider Preview build 26320.

Darner release or commit

Code read at trustno1/main 57dea7f23. The behaviour was seen in use on our own builds on top of main, not in a measured test; the cause below is read from the code only.

Settings

Series S, DLSS Performance. DARNER_FIRST_START_PRELOAD=0 stops the window from opening on start.

Logs

No log attached: this is about when the window opens and what a stopped preload keeps, which is easiest to follow in the code below. We can attach a play log of a start-stop-start sequence if you want one.

What the code does (read from main, not a confirmed cause for every case)

  • The window opens from apps/darner/src/main.rs:690 when play::preload_needed (apps/darner/src/play.rs:2304) finds no mark warmed/<first 16 hex of blake3 of darner.exe> (play.rs:2247), or a pipeline book with no host pipeline library (play.rs:2325).
  • The mark is only written after a preload finished in full: finish_preload (play.rs:765-776), and only if the final library save had nothing pending (crates/darner-gpu/src/pipeline/library.rs:1278-1291).
  • "Play now" and "Quit" return before finish_preload (play.rs:751-759), and the window kills the whole preload process tree (apps/darner/src/preload_ui.rs:183). A failed child or a failed save also leaves no mark. Every new exe (update or local build) has a new hash. So the window comes back on every start until one preload finishes in full.
  • The work is also done again, not resumed:
    • translate::precompile (apps/darner/src/translate.rs:567) lists and hashes every shader file on every run and calls the translator for each one (translate.rs:602-606). We did not read whether the translator itself returns early for a shader it has already stored.
    • warm::into_library (apps/darner/src/warm.rs:511-556) makes every early and slow pipeline again and saves the library once at the end (warm.rs:551, crates/darner-gpu/src/pipeline/known.rs:544). "Play now" during that step keeps nothing from it.
    • Only warm::run resumes, through the warm-done.txt marks (warm.rs:204-236, warm.rs:293-296).
  • The done marks are made from the translator, driver, sampler order, the exe path in lower case, and the card (warm.rs:200, warm.rs:396-408). A new install folder or a driver update starts over.
  • A related loop: failed_in_a_row (warm.rs:53) goes back to 0 after any child that made one pipeline. That may keep a preload that fails once the title is up in a loop. See TheBen's comment on #70 (#70 (comment): with the title up, preload children exit 0xffffffff and are retried); PR #125 captures those children's stderr.

Are you working on a fix?

Yes, I'm on it (Jesper-A). No branch or draft PR yet.

Plan, as separate small PRs; each new behaviour off by default behind its own DARNER_* switch, and no default changes without asking you:

  1. A partial mark or remaining count, so the window opens only when work is left.
  2. Skip shader files precompile already did for this translator.
  3. Save into_library progress as it goes, so "Play now" keeps what was made.
  4. Key the done marks without the exe path.

If you already work on this or would rather have it done differently, tell me and I will stop.

Spec dependence

Likely general: the logic is in the launcher and does not depend on the GPU. Seen on RTX 2070 SUPER 8 GB, Ryzen 7 5800X, 32 GB, Windows 11. Not checked on other GPUs, Series X, or Linux/Proton.

Related: issue #70, PR #125.

Drafted with AI assistance (Claude Code).

### What happened The preload window opens on start and preloads everything again, even though part of it (or all of it) was already preloaded in an earlier start. How to see it: 1. Start the game with a darner.exe that has not finished a preload. The preload window opens. 2. Click "Play now" (or "Quit") while it is still working. 3. Start again. The window opens again and the counts begin from the start. Same thing after a new build or an update: the window opens again, because the "preload is done" mark belongs to one exact darner.exe. Not checked: whether a preload that runs to the end and finishes without error opens the window again on the next start of the same exe. By the code it should not. ### GPU and driver NVIDIA GeForce RTX 2070 SUPER 8 GB (Turing), driver 621.40, Resizable BAR off. ### CPU, RAM and Windows version AMD Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider Preview build 26320. ### Darner release or commit Code read at `trustno1/main` 57dea7f23. The behaviour was seen in use on our own builds on top of main, not in a measured test; the cause below is read from the code only. ### Settings Series S, DLSS Performance. `DARNER_FIRST_START_PRELOAD=0` stops the window from opening on start. ### Logs No log attached: this is about when the window opens and what a stopped preload keeps, which is easiest to follow in the code below. We can attach a play log of a start-stop-start sequence if you want one. ### What the code does (read from main, not a confirmed cause for every case) - The window opens from `apps/darner/src/main.rs:690` when `play::preload_needed` (`apps/darner/src/play.rs:2304`) finds no mark `warmed/<first 16 hex of blake3 of darner.exe>` (`play.rs:2247`), or a pipeline book with no host pipeline library (`play.rs:2325`). - The mark is only written after a preload finished in full: `finish_preload` (`play.rs:765-776`), and only if the final library save had nothing pending (`crates/darner-gpu/src/pipeline/library.rs:1278-1291`). - "Play now" and "Quit" return before `finish_preload` (`play.rs:751-759`), and the window kills the whole preload process tree (`apps/darner/src/preload_ui.rs:183`). A failed child or a failed save also leaves no mark. Every new exe (update or local build) has a new hash. So the window comes back on every start until one preload finishes in full. - The work is also done again, not resumed: - `translate::precompile` (`apps/darner/src/translate.rs:567`) lists and hashes every shader file on every run and calls the translator for each one (`translate.rs:602-606`). We did not read whether the translator itself returns early for a shader it has already stored. - `warm::into_library` (`apps/darner/src/warm.rs:511-556`) makes every early and slow pipeline again and saves the library once at the end (`warm.rs:551`, `crates/darner-gpu/src/pipeline/known.rs:544`). "Play now" during that step keeps nothing from it. - Only `warm::run` resumes, through the `warm-done.txt` marks (`warm.rs:204-236`, `warm.rs:293-296`). - The done marks are made from the translator, driver, sampler order, the exe path in lower case, and the card (`warm.rs:200`, `warm.rs:396-408`). A new install folder or a driver update starts over. - A related loop: `failed_in_a_row` (`warm.rs:53`) goes back to 0 after any child that made one pipeline. That may keep a preload that fails once the title is up in a loop. See TheBen's comment on #70 (https://git.gtahub.st/TrustNo1/Darner/issues/70#issuecomment-851066: with the title up, preload children exit 0xffffffff and are retried); PR #125 captures those children's stderr. ### Are you working on a fix? Yes, I'm on it (Jesper-A). No branch or draft PR yet. Plan, as separate small PRs; each new behaviour off by default behind its own `DARNER_*` switch, and no default changes without asking you: 1. A partial mark or remaining count, so the window opens only when work is left. 2. Skip shader files `precompile` already did for this translator. 3. Save `into_library` progress as it goes, so "Play now" keeps what was made. 4. Key the done marks without the exe path. If you already work on this or would rather have it done differently, tell me and I will stop. ### Spec dependence Likely general: the logic is in the launcher and does not depend on the GPU. Seen on RTX 2070 SUPER 8 GB, Ryzen 7 5800X, 32 GB, Windows 11. Not checked on other GPUs, Series X, or Linux/Proton. Related: issue #70, PR #125. Drafted with AI assistance (Claude Code).

Same problem as this issue ("starts over"), with two causes that are not in the list above. Code read at main 57dea7f236; the timings are from one laptop.

Hardware and build: Ryzen 7 8845HS (8 cores, 16 threads), 32 GB, RTX 4050 Laptop 6 GB, driver 621.24, Windows 11 build 26300. Series S, DLSS Quality. 10 preload processes (the default here).

1. A translator change deletes the done marks and the library, although both are named by content

Seen:

  • First start of v2026.12.02.03-playtest: translator.txt was rewritten, warm-done.txt, warm-bad.txt and pipelines\adapters were created anew, and the preload had 76,725 pipelines to make. It took 47 minutes.
  • First start of v2026.12.03.01 at the same exe path (translator.txt not rewritten): the preload window was done in about 80 s. Every mark was reused.
  • A diagnostics build of the same commit in target\diag: "0 made before by what is in them", 76,725 to make again. That is your point 4 (the exe path in the marks), seen here.

Read from the code, not confirmed by a test:

  • On a new translator id, clear_stale_in (apps/darner/src/play.rs:653) calls clear_stale_artifacts_in (play.rs:683), which removes shaders\ and, in pipelines\, what is_stale_pipeline_entry names: adapters, warm-done.txt, warm-bad.txt and host-pipelines.* (play.rs:671-676).
  • The done marks are by pipeline name (the hash of the translated code, root signature and state), and their fingerprint holds no translator: apps/darner/src/warm.rs:196-200, known::made_for, and the test marks_by_name_follow_program_card_and_driver_only (warm.rs:817). The comment at warm.rs:196-199 says a change of the translator makes again only the pipelines whose translated code or root signature it changed. With warm-done.txt deleted, all of them are made again.
  • The library is named the same way (library::name), so the entries of pipelines the new translator left as they were would still load.
  • warm-bad.txt already carries the translator in its fingerprint (known::fingerprint), and bad_keys passes over lines of another one.

Not measured: how many pipelines keep their name across a typical translator change. If it is few, keeping the marks gains little. Not checked either: whether anything removes library entries that are no longer asked for, if the file is kept.

2. The window's time left starts about 3.5 times too long

Seen: a preload of 76,725 printed 200 of 76725, 56 s and 1200 of 76725, 199 s, and the window showed about 174 minutes left. The same count took 47 minutes on this PC that morning. (Not like for like: the two passes ran from different exe paths, and the morning one may have found some pipelines in the driver's cache.)

Read from the code:

  • The pipelines earlier runs drew with are made first (warm.rs:230), and those are the slow ones. slow-pipelines.txt here names 4,695 pipelines of 1 s or more, 20,428 s in all, against about 28,400 worker-seconds for the whole 47-minute pass. (Some of those times were noted in play, so the share is rough.)
  • time_left is a straight line from the count so far (apps/darner/src/preload_ui.rs:118-129).

An estimate of three hours is what makes one press "Play now", which leads into the loop this issue describes. The slow list is on disk before the pass starts, so the estimate could weigh by it.

Related, and deliberate as far as I can tell: the window always passes --all (preload_ui.rs:161), so DARNER_PRELOAD_USED_MIN applies only to darner preload run by hand. The README row for that switch reads as if it applied to every preload.

Drafted with AI assistance (Claude Code).

Same problem as this issue ("starts over"), with two causes that are not in the list above. Code read at `main` 57dea7f236; the timings are from one laptop. **Hardware and build:** Ryzen 7 8845HS (8 cores, 16 threads), 32 GB, RTX 4050 Laptop 6 GB, driver 621.24, Windows 11 build 26300. Series S, DLSS Quality. 10 preload processes (the default here). ### 1. A translator change deletes the done marks and the library, although both are named by content Seen: - First start of v2026.12.02.03-playtest: `translator.txt` was rewritten, `warm-done.txt`, `warm-bad.txt` and `pipelines\adapters` were created anew, and the preload had 76,725 pipelines to make. It took 47 minutes. - First start of v2026.12.03.01 at the same exe path (`translator.txt` not rewritten): the preload window was done in about 80 s. Every mark was reused. - A diagnostics build of the same commit in `target\diag`: "0 made before by what is in them", 76,725 to make again. That is your point 4 (the exe path in the marks), seen here. Read from the code, not confirmed by a test: - On a new translator id, `clear_stale_in` (`apps/darner/src/play.rs:653`) calls `clear_stale_artifacts_in` (`play.rs:683`), which removes `shaders\` and, in `pipelines\`, what `is_stale_pipeline_entry` names: `adapters`, `warm-done.txt`, `warm-bad.txt` and `host-pipelines.*` (`play.rs:671-676`). - The done marks are by pipeline name (the hash of the translated code, root signature and state), and their fingerprint holds no translator: `apps/darner/src/warm.rs:196-200`, `known::made_for`, and the test `marks_by_name_follow_program_card_and_driver_only` (`warm.rs:817`). The comment at `warm.rs:196-199` says a change of the translator makes again only the pipelines whose translated code or root signature it changed. With `warm-done.txt` deleted, all of them are made again. - The library is named the same way (`library::name`), so the entries of pipelines the new translator left as they were would still load. - `warm-bad.txt` already carries the translator in its fingerprint (`known::fingerprint`), and `bad_keys` passes over lines of another one. Not measured: how many pipelines keep their name across a typical translator change. If it is few, keeping the marks gains little. Not checked either: whether anything removes library entries that are no longer asked for, if the file is kept. ### 2. The window's time left starts about 3.5 times too long Seen: a preload of 76,725 printed `200 of 76725, 56 s` and `1200 of 76725, 199 s`, and the window showed about 174 minutes left. The same count took 47 minutes on this PC that morning. (Not like for like: the two passes ran from different exe paths, and the morning one may have found some pipelines in the driver's cache.) Read from the code: - The pipelines earlier runs drew with are made first (`warm.rs:230`), and those are the slow ones. `slow-pipelines.txt` here names 4,695 pipelines of 1 s or more, 20,428 s in all, against about 28,400 worker-seconds for the whole 47-minute pass. (Some of those times were noted in play, so the share is rough.) - `time_left` is a straight line from the count so far (`apps/darner/src/preload_ui.rs:118-129`). An estimate of three hours is what makes one press "Play now", which leads into the loop this issue describes. The slow list is on disk before the pass starts, so the estimate could weigh by it. Related, and deliberate as far as I can tell: the window always passes `--all` (`preload_ui.rs:161`), so `DARNER_PRELOAD_USED_MIN` applies only to `darner preload` run by hand. The README row for that switch reads as if it applied to every preload. Drafted with AI assistance (Claude Code).
Sign in to join this conversation.
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#128
No description provided.