[pr-fix][startup][shaders] darner preload records a finished preload, so the next start does not preload again #435
Loading…
Reference in a new issue
No description provided.
Delete branch "Skanzinho/Darner:preload-grava-marca"
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
The problem on main: a
darner preload <game folder> --allthat finishes with exit code 0 leaves nowarmed\<hash>mark, so the nextdarner playof the same darner.exe prints "The shaders are not fully preloaded for this version of darner.exe: preloading them before the game starts." and runs the whole preload again. Seen on 2026-12-04 with diagnostics builds (--profile diag --features diagnostics) of v2026.12.03.01 and v2026.12.03.02, each in its own DARNER_HOME, started by a script:darner preload <game folder> --alldarner play(scripts/bench.ps1)The
warmedfolder of each home got its mark only when that second preload ended.Three paths write the mark on main: the start's preload window (
play::preload→finish_preload), whichplay --preloadand F1's PRELOAD SHADERS use too, and the warm-up restart (menu.rs).Command::Preloadinmain.rsruns the same steps as the window's child (translate::precompile,warm::run,warm::into_library) but writes no mark. So anyone who preloads withdarner preloadbefore playing (a script, a launcher, the README'sdarner.exe preload) pays for the preload twice.This change:
darner preloadwrites the same mark as the window, for the same darner.exe bytes (mark_path), when it warmed every known pipeline (not--used) of the whole title: folders given (the window passes the game folder), or none given (the configured ones). One file given is part of the title, so no mark.DARNER_CACHE_DIR:playdoes not read the mark then either.finish_preloadintowrite_mark, shared by both. The window's child now writes it too, then the window writes it again; the second write keeps it (new testa_preload_mark_can_be_written_twice).How it was tested
Tested revision:
3438456(onmainf3840d7, v2026.12.03.02).Commands and results, in the v2026.12.03.02 diagnostics test home (DARNER_HOME set, not my normal one), Windows 11:
cargo build --locked --profile diag -p darner --features diagnostics: ok.darner preload --all <game folder>: exit 0, 51.7 min.warmed\before: only main's mark (338ec62e29f44481, from the night before). After: also7f656d3d846bc757, written when the preload ended.darner playof this build, throughscripts/bench.ps1 -Label pr-preload-play -Dlss performance -FrameGen 2 -RayTracing off -AllowMenuFile -Warmup 45 -Seconds 60 -BootTimeout 900 -CaptureEvery 0: exit 0; no "not fully preloaded" and no "Shaders preloaded in" line in itsdarner.out.txt; the summary says "world after 74 s".Changes a default: no. No switch;
darner preloadof the whole title now leaves the mark the window leaves.A/B result: same home, game folder, settings and PC, one run each; A is main's v2026.12.03.02 diagnostics build (the night before), B is this PR's diagnostics build:
f3840d7)3438456)darner preload <game folder> --allwarmed\7f656d3d846bc757darner playGates run on
3438456:cargo clippy --workspace --all-targets --locked -- -D warnings: passed.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed.cargo test --workspace --locked: exit 101. Every crate beforedarner-gpupassed:darner149 passed, 1 ignored (withplay::tests::a_preload_mark_can_be_written_twice), its testscache_paths2,census2,picked_folders8;darner-core31;darner-formats87 (7 ignored);darner-game67.darner-gpu: 1772 passed, 1 failed,host::refresh_tests::refresh_front_zero_arc_matches_and_runs_due("sift_indexed kept wrong dirty subset"). A second run with--no-fail-fasthung indarner-gpuinstead (eighthost::refresh_tests/host::watch_pipetests over 60 s; I stopped its process after 10 min). This PR touches no file incrates/; that test passed 3 of 3 runs alone onf3840d7(cargo test -p darner-gpu --lib --locked refresh_front_zero_arc_matches_and_runs_due). This is #389 (gate 3 not green onf3840d7,darner-gpufailing in half of the parallel runs), not fixed here. That--no-fail-fastrun then went on: every other crate passed exceptdarner-shader, 557 passed, 1 failed,emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders, the test #389 reports failing every time onf3840d7(that crate's run took 28 min).cargo xtask policy: "asset policy: 555 files ok".Gameplay, when relevant: RTX 4070 SUPER 12 GB, driver 617.42 (32.0.16.1742), Series S profile (the F1 menu file's choice), 1080 to 1440, DLSS performance, frame generation 2x, ray tracing off. Only the start matters here.
Shader wave sizes tested, when relevant: not relevant (no shader change).
Hardware dependence: likely general (no GPU code; only when a file is written).
Coverage gaps: diagnostics build only, not a release build. The start's own preload window (no
darner preloadbefore) was not run again with this build; it writes the mark through the samewrite_markand the unit test covers two writes.darner preloadwith a single file (no mark expected) not run. Not run under Linux/Proton. Without--all, on a home that has a list of used pipelines,darner preloadwarms only those and writes no mark, as before.Hardware: i9-12900F, 32 GB DDR4-3200, RTX 4070 SUPER 12 GB, Windows 11 (pt-BR).
Checklist
main.docs/asset-policy.md.Checked for overlap
play.rscode; this writes throughmark_path, so if one of them merges first I will rebase and write their mark here too. #140, #267 and #270 change what the preload does, not when the mark is written. #128 is the issue about the window opening again; its causes (a stopped preload, a new exe, a translator change) are different, and this is one more.Thank you, this is a useful fix, and the numbers are convincing: the world after 74 s instead of 1919 s on the next start.
Two things I found reading the diff against
main. I have only read the code, not built or run it.1. The mark it writes is only the byte-hash one.
record_preloadwritesmark_path(&home, &program), thewarmed\<hash of darner.exe>file (play.rs,record_preload). That is the mark the window waits for today. My open PR #153 (DARNER_WARM_SHARED=1) changes this: with the switch on,preparepicksshared_mark(&home)(warmed\shared-<hash>, by translator, card and driver), andwindow_markthen looks only at that file and ignores the exe's own mark (play.rsat #153 head3854be8df,window_markand theby_contentlines inprepare). So with #153 and the switch on, adarner preload ... --allfrom a shell would still be followed by the full preload window.Suggestion: let
record_preloadwrite the mark the window would choose, by calling the same codeprepareuses (a small helper that takes the settings and returns the mark path), instead of callingmark_pathdirectly. Then it keeps working whichever of the two lands first.shared_markonly needs the translator id and the DXGI adapter and driver, which the CLI process already has. One thing to watch: the CLI preload sees the switch only in the environment (warm::shared_on), whilepreparesees it in the start's settings (shared_marks(&s)), so the helper should be given the switch as a bool rather than read it itself, or the two can disagree.2. A subfolder counts as the whole title.
whole_title = paths.iter().all(|p| p.is_dir())is true for any folder.translate::precompilescans every folder it is given (scan_entries(root)), sodarner preload <game>\<subfolder> --allwould translate only that subfolder and still write the mark. An emptypathsis fine:default_pathsthen usesgame_dirandtest_titlesfrom the config.Suggestion: compare the given paths with the configured title folder(s) (
Config::load(),game_dir), after canonicalising both, and only record when they match.(My open PR #140,
DARNER_PRELOAD_RESUME, is not affected: its resume record is only read when the mark is not there yet, so a mark written by the CLI wins.)Written with AI assistance (Claude Code).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.