[pr-fix][startup][shaders] darner preload records a finished preload, so the next start does not preload again #435
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!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).
34384568d0todf195a201eThanks for the review. Both points are addressed in
df195a2, rebased onmain47d21cd(with #153, #140, #264, #267, #215 and #395 in).1. The mark.
record_preloadnow writesdone_mark(home, program, by_content), whichpreparealso takes itspreload_markfrom: the shared mark withDARNER_WARM_SHARED=1, else the exe's. The switch is given to it as a bool (warm::shared_on(), from the environment, in the CLI; the window's child gets it in its environment from the start's settings), so the helper does not read it itself. New test:a_preload_from_a_shell_writes_the_mark_the_next_start_waits_for.2. A subfolder. A folder now counts as the whole title only when it holds the game's executable (
GAME, whichpreparelooks for next to darner.exe; the window passesexe.parent()), or when it is the configuredgame_dir(both canonicalised). No folder given is still the whole title (default_paths). I kept the executable check next to thegame_dirone because the window's folder comes from the executable's location, not fromgame_dir: here there is nodarner.tomland noDARNER_GAME_DIR, so agame_dircheck alone would never record. New test:only_the_title_folder_is_the_whole_title(the title folder, a subfolder, a file, the configured folder, the same folder written another way, another folder).Tested on
df195a2(diagnostics build, a new test DARNER_HOME with only the settings and the known-pipeline lists copied in; same PC and settings as in the description):darner preload --all <game folder>withDARNER_WARM_SHARED=1in the environment: exit 0, 43.4 min.warmed\afterwards holds onlyshared-f2ebcd8bd0fd9a87, written when the preload ended.scripts/bench.ps1 -Label pr435-shared-play -Switches 'DARNER_WARM_SHARED=1'(other options as in the description): no "not fully preloaded" and no "Shaders preloaded in" line in itsdarner.out.txt; the summary says "world after 77 s" and lists the switch.done_markismark_pathas before; that path is covered by the unit tests, and its in-game run is the one in the description (3438456).Gates on
df195a2: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, fromdarner-shader'semit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shadersonly (#389). Every crate before it passed,darner-gpuincluded this time (1790 passed, 81 ignored),darner195 passed, 1 ignored. The run stops at that failure, so the crates afterdarner-shaderdid not run here.cargo test -p darner --locked: 195 passed, 1 ignored, with the two new tests anda_preload_mark_can_be_written_twice.cargo xtask policy: "asset policy: 564 files ok".Open PRs in the same code (#450 and #451, both WIP, read the old head
3438456): sincedf195a2record_preloadwritesdone_mark, the helperpreparetakes itspreload_markfrom, so with #451 the second to land changes that one call to #451's helpers. #450's point stands:record_preloadruns afterinto_library, so a stopped step 3 must not record, and the second to land adds thewarm::stop::requested()check. If either lands first, I'll rebase this one.