[pr-fix][startup][shaders] Preload: a host pipeline library the game will not load no longer counts as made (named DARNER_CACHE_DIR, after #192) #270
Loading…
Reference in a new issue
No description provided.
Delete branch "iboom72/fix/preload-when-library-is-another-builds"
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 #188
What it changes
apps/darner/src/play.rs,needs_pipelines, againstmade_by_another_buildincrates/darner-gpu/src/pipeline/library.rs).Since #192 the game does not load a host pipeline library that another build's translator made: the folder's
host-pipelines.translatorhas to name this build, or the run starts an empty library. The launcher's check for "are there host pipelines?" was not changed with it:needs_pipelinesstill counts any non-emptyhost-pipelines.binas made and never reads the mark.On the default cache this does no harm:
clear_stale_shadersdeletes another translator's library before the check, and a new darner.exe gets its first-start preload anyway. In a cache folder the caller named (DARNER_CACHE_DIR) neither happens. Two builds with different translators that share such a folder then go like this: the second build finds the first one's library, no preload is offered, the game refuses that library, and the run makes its host pipelines during play. Its first save replaces the other build's library, so the builds throw each other's library away at every switch, each time without a preload.The comments already say what is meant: "A named DARNER_CACHE_DIR (benches, tests) preloads only when its pipelines are missing" (
play.rs), andpreload_needednames a library "of an earlier translator" as a case to preload.What this does: a library counts as made only when
host-pipelines.translatorbeside it names this build's translator (compared aftertrim(), likemade_by_another_build). WithDARNER_LIBRARY_KEEP_OLD=1any library counts, because the game then loads it. Where the translator id is not known (not Windows), nothing changes.With
DARNER_LIBRARY_DIRset, the library is looked for in that folder, as the game does (library_dirinlibrary.rs); the pipeline book stays in the cache folder (8b34fd77by andrewpozdnakov7-jpg, after superhero-520's test).The file name
host-pipelines.translatoris written out inplay.rs, asis_stale_pipeline_entrythere already does forhost-pipelines.; the rule itself stays inlibrary.rs.Not in this change:
apps/darner/src/warm.rs(library_there, only withDARNER_WARM_SHARED=1) also tests just for the file. That is a separate problem in an opt-in path and overlaps #153.How it was tested
8b34fd77cargo test -p darner --locked: passed (149 passed, 1 ignored in the app's unit tests, with the extendeda_book_without_made_pipelines_is_preloadedandpreload_checks_the_shared_library_and_uses_the_local_book; 2 + 2 + 8 in its three test files).cargo clippy -p darner --all-targets --locked -- -D warnings: passed.DARNER_CACHE_DIRthat holds another build's library: the start now offers the preload there where it started the game at once (library.rsgives 10 minutes for a preload from no library, from #188; not measured here). Two builds that take turns on one named cache get the offer at every switch.DARNER_FIRST_START_PRELOAD=0andDARNER_LIBRARY_KEEP_OLD=1both keep the old behaviour. On the default cache the offer is new only where a library has no mark of this build and the exe is past its first start (a mark that could not be written, for one); the game refuses that library there too.cargo clippy --workspace --all-targets --locked -- -D warningsand the same with--all-features: both passed.cargo test --workspace --lockedwas not run as a whole (only-p darner, above; the change is inapps/darneronly).library.rs, not run: every write of the library goes throughreplace_library, which writes the mark in the same folder, so a finished preload is not offered again. Not run in the game with two builds on one named cache; the case is from reading the code, and the test coversneeds_pipelinesonly (no mark, another build's mark, this build's mark). Not covered before or after: a library made for another card.Checklist
main.docs/asset-policy.md.Not run in the game: it needs two builds with different shader translators and a shared named cache, which I do not have set up.
Checked for overlap
preload_needed's neighbourhood inplay.rsand keepsneeds_pipelinesas the deciding check; it does not change the check. #140 (open) mentionspreload_neededin a comment only. The other open pull requests found that changeapps/darner/src/play.rs(#243, #233, #222, #216, #215, #205, #154, #143, #130, #80, #75, #59, #16, #12, #9) do not touch it.🤖 Generated with Claude Code
Tested the launcher preflight and runtime directory selection on Windows using the functions from main
f3840d73and PR5799f84a. Each of the nine filesystem cases ran in a fresh process so the cached environment setting was read independently.One case changes on this PR when both cache paths are set. I put the pipeline book and a library with another translator's marker under
DARNER_CACHE_DIR/pipelines, then put a library with this translator's marker under a separateDARNER_LIBRARY_DIR. Main returned false fromneeds_pipelines; the PR returned true. The runtime selected the shared directory and itsmade_by_another_buildcheck returned false. The preflight therefore classifies host pipelines as missing even though the selected shared library passes the runtime marker check.With no shared override, the PR did request preload for a missing or foreign marker and skipped it for a matching one. The opposite path mismatch already exists on main: with a matching local marker and a foreign shared marker, both launcher revisions skip preload while the runtime rejects the shared marker.
A regression test could keep the book in the named cache and vary the local and shared markers independently. These were plain file sentinels and the actual marker and path functions. No driver library was opened and no game was run.
Thanks, @superhero-520. I reproduced the mismatch and prepared a follow-up commit on top of this PR. It reuses the launcher’s existing library-folder selection for DARNER_LIBRARY_DIR and keeps the pipeline book in the local cache. The commit can be cherry-picked onto this branch.
A Windows file fixture ran seven scenarios against
5799f84and the follow-up. The PR missed three cases involving a shared override. The follow-up passed all seven, including an absent or empty override and DARNER_LIBRARY_KEEP_OLD=1. The focused Cargo type check and asset-policy check passed. No game or driver library was loaded.Follow-up to "How it was tested": the description says
cargo test --workspace --lockedwas not run as a whole. It has now been run, together with five other small pull requests of mine, on one local branch.mainf3840d73with these six commits picked on top, no conflicts:98a3c911(#265),5799f84a(#270),c782a6e2(#283),e69c0f77(#284),1c142d36(#285),5eae3d19(#286). Not run on this pull request's branch alone.cargo clippy --workspace --all-targets --locked -- -D warnings: passed.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed.cargo test --workspace --locked: one test failed, indarner-shader:emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders("DXIL validation failed ... Not all elements of output SV_Depth were written"). The same test fails the same way onmainf3840d73without these commits, none of the six changesdarner-shader, and #227 (open) fixes it.darner-shader's other tests: 557 passed, 16 ignored.cargo test --workspace --locked --no-fail-fast --exclude darner-shader: passed, all packages and the doc tests (darner-gpu: 1,773 passed, 81 ignored).Still not run in the game.
Thanks both. superhero-520's case is right: with
DARNER_LIBRARY_DIRset, the check looked in the cache folder while the game takes the library from the shared one, and the description was wrong to call that case unchanged.I read
8b34fd77and picked it onto this branch as it is. It uses the same rule aslibrary_dirinlibrary.rs(the shared folder when it is set and not empty, else the cache'spipelinesfolder) and keeps the pipeline book in the cache folder. On8b34fd77:cargo test -p darner --lockedpassed (149 passed, 1 ignored), and both workspace clippy gates passed. Not run in the game. The description is updated.The gates were run again with
8b34fd77in, since my earlier comment covered the older commit only.mainf3840d73with seven commits picked on top, no conflicts: both commits of this pull request (5799f84a,8b34fd77) and98a3c911(#265),c782a6e2(#283),e69c0f77(#284),1c142d36(#285),5eae3d19(#286). Not run on this pull request's branch alone.cargo clippy --workspace --all-targets --locked -- -D warnings: passed.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed.cargo test --workspace --locked --no-fail-fast: one test failed, indarner-shader:emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders. It fails the same way onmainf3840d73without these commits, none of them changesdarner-shader, and #227 (open) fixes it. Everything else passed: the app's unit tests (150 passed, 1 ignored, withpreload_checks_the_shared_library_and_uses_the_local_book),darner-gpu(1,773 passed, 81 ignored),darner-shader's other tests (557 passed, 16 ignored), the other packages and the doc tests.Still not run in the game.
Two things from reading
8b34fd77again, both inneeds_pipelines(apps/darner/src/play.rs). Read from the code only, nothing run. Neither is fixed in this pull request.1. With
DARNER_LIBRARY_DIRset, the check walks the whole folder.made_ingoes into every folder below the one it is given. Until8b34fd77that was the cache's ownpipelinesfolder. Now it is the folder the user named, so a large or networked folder that holds other things is read through at every start, and a markedhost-pipelines.binanywhere below it counts as made. The game looks in two places only:adapters/<card>and the folder itself (load_cacheinlibrary.rs). Looking in the folder and one level belowadapterswould match that.2. A library made for another card counts as made. This was so before this pull request, and the description lists it under coverage gaps.
made_intakes a marked library in anyadapters/<card>folder, while the game reads this card's folder first. On a PC with two cards, or with a named cache copied from another PC, no preload is offered and the pipelines are made during play. Narrowing the walk as in 1 does not fix it: the launcher does not know this card's folder name.If the maintainer wants 1 in this pull request, I can add it; otherwise it can follow separately.
4932c5a follows your first suggestion if the maintainer wants it in this PR. The launcher checks the library root and direct directories under
adapters, using the runtime's two filenames,host-pipelines.binandhost-pipelines.next. The existing translator check still applies. Matching the library to the selected adapter remains a separate decision.The same ten fixture cases exercise both revisions. Three cases with backups or unrelated subdirectories now offer preload, and two cases with a valid pending library now recognize it. Five controls for the book, primary libraries and translator mismatch behaved as before. Focused app type check, the asset policy and the diff check passed.
If you cherry-pick or rebase this commit, please keep the Git author. If you fold it into your own commit, please add this trailer.
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>With the pipeline book present, no adapter-specific library, and a matching legacy-root marker, both #270’s current head
8b34fd77and andrewpozdnakov7-jpg’s proposed follow-up4932c5askip preload whenhost-pipelines.binhas data andhost-pipelines.nextis empty. The runtime atf3840d73selects the empty.nextand starts with an empty host pipeline library.With #275 at
1bc75a3, the runtime falls back to.bin, so skipping preload is correct for this layout. If #270 lands before #275, please have the launcher offer preload in this case until the runtime fallback lands.Pushed
98934a72for point 1 of my comment above (#270 (comment)).needs_pipelinesnow looks for a library in two places only, the ones the game reads (load_cacheinlibrary.rs): each card's folder underadapters, and the folder itself. It no longer goes into everything below the folder named withDARNER_LIBRARY_DIR. Point 2 (a library made for another card counts as made) is unchanged.How it was tested
8b34fd77plus this one change inapps/darner/src/play.rs. It was built and tested on a local branch that also holds #265's two commits (98a3c911,9d3ede12), not on this branch alone. The patch is the same on both.cargo test -p darner --locked: passed (150 passed, 1 ignored in the app's unit tests; 2 + 2 + 8 in its three test files).preload_checks_the_shared_library_and_uses_the_local_bookhas a new case: a marked library deeper in the shared folder does not count.cargo clippy --workspace --all-targets --locked -- -D warningsand the same with--all-features: both passed.cargo test --workspace --lockedwas not run again (only-p darner; the change is inapps/darneronly).pipelines\adapters\hardware-<card>, which is one of the two places.The description above still names
8b34fd77as the tested revision.Thanks for finding the empty pending case. I agree with merging #275 first. With an empty
.nextbeside a usable.bin, skipping preload is correct only once the runtime can fall back to the primary.I checked the latest
98934a72. The search now stays in the right directories. It still counts a matchinghost-pipelines.bin.bakand misses a non-emptyhost-pipelines.next. 7d33640 checks the two exact runtime names in those same directories. On the same Windows fixture, a backup alone now offers preload, a valid pending file alone skips it, and five controls kept their launcher result. Scoped app type-check, asset policy and diff check passed. The follow-up merges cleanly with #275 at1bc75a3. No game run was needed for these filename checks.If you cherry-pick or rebase this commit, please keep the Git author. If you fold it into another commit, please add this trailer.
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>Picked
7d33640onto this pull request as it is, with its author unchanged. Thanks, @andrewpozdnakov7-jpg.needs_pipelinesnow checks the two exact names the game reads,host-pipelines.binandhost-pipelines.next, in the same two places as98934a72. Ahost-pipelines.bin.bakalone no longer counts as a made library, and ahost-pipelines.nextwith data alone now does. Both cases behaved the same onmain.I had not read your comment with 4932c5a (16:54 UTC) when I pushed
98934a72at 18:29. The two make the same change to where the check looks.How it was tested
7d33640itself, on98934a72. It was built and tested as a pick (same patch) on a local branch that also holds #265's two commits (98a3c911,9d3ede12), not on this branch alone.cargo test -p darner --locked: passed (150 passed, 1 ignored in the app's unit tests; 2 + 2 + 8 in its three test files).preload_checks_the_shared_library_and_uses_the_local_bookholds the new cases.cargo clippy --workspace --all-targets --locked -- -D warningsand the same with--all-features: both passed.cargo test --workspace --lockedwas not run again (the change is inapps/darneronly).The empty
host-pipelines.nextcase (@UncommonDLL)Read from the code, not run: on
mainthe launcher already skips the preload whenhost-pipelines.binhas data, whateverhost-pipelines.nextholds. This pull request does not add that case or change it. I have not added a launcher fallback here; #275 fixes it where the game reads the files. The merge order is the maintainer's decision.The description above still names
8b34fd77as the tested revision.View command line instructions
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.