victory: run makes the title's shaders and pipelines before it starts, with a progress window (once; kept on disk) #2905
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2907"
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?
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T23:38:04Z.
translate --cache --pipelinesmakes every shader and pipeline a title can ask for, but only when someone runs it. Otherwise the first runs translate shaders at first use, so draws wait, and make pipelines on worker threads, so draws are dropped meanwhile. That happens again after every translator change.With this PR,
run --executemakes them itself, before the title starts, with a progress window. It does nothing on later starts unless something changed.What
Which files. The title's
shaders.rpf, its executable and its DLLs: the files the README'stranslate --cache --pipelinesline names (startup::shader_files).Done once, kept on disk. The shader cache and the pipeline library keep the work, as before. A stamp in the cache folder (
prebuild/<title dir hash>.txt) records what was finished:victory_gpu::adapter_identity).A start with nothing new reads the stamp and goes on at once.
The work. What isn't done runs on a thread of its own, using the existing code (
translate::warm,prebuild::run).How long the title waits is set by
VICTORY_PREBUILD:shaders(default)alloffPipelines the title doesn't wait for are made behind it on half the processor's threads. Their progress shows in the window caption, after the frame rate (new
victory_gpu::set_caption_status).Progress window (
splash): plain GDI on its own thread, since the GPU is busy with the work. Four times a second it shows:Esc, or closing the window, starts the title at once; the rest goes on behind it.
How progress reaches it.
translate::report, which both halves already use for their console progress lines, also feeds a smallprogressstate, and their summary lines go into its log.Tests
progress: progress line and time-left estimate, durations, the log keeping its last lines.startup:VICTORY_PREBUILDmodes;splash: the window's lines, and the window opening and closing on its own thread. That test caught a crash: GDI was given empty text for blank lines.cargo test -p victory: 23 passed.cargo clippy -p victory --all-targetsand-p victory-gpu --all-targetsare clean, with and without--features diagnostics.Not verified
VICTORY_PREBUILD=allavoids the overlap.Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T23:52:56Z.
Review: COMMENTED
Scoped review: this turns the manual translate-then-run flow into a prebuild step with a stamp keyed on files/translator/GPU — the right invalidation key, and Esc-to-start keeps it non-blocking. VICTORY_PREBUILD=shaders/all/off covers the use cases in the README. Size-wise it's a feature PR; the knob surface and cache-stamp design look right.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:52:58Z.
Review: COMMENTED
Verified head
2a7b2aaacleanly merged ontoorigin/main(63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP +VICTORY_D3D12_DEBUG=1).Findings
Mode::Shaders(apps/victory/src/startup.rs:748-751): ForMode::Shaders,waitedonly checksshaders_done.load(Ordering::Acquire)and does not checkwork.is_finished(). If"victory prebuild"panics insidetranslate::warmbefore storingshaders_done = trueat line 729, the main thread loops indefinitely waiting forshaders_done. Checkingwork.is_finished() || shaders_done.load(Ordering::Acquire)(or settingshaders_donevia an RAII drop guard) prevents a hang.#2890:apps/victory/src/startup.rs:692, 738, 778, 781unconditionally callvictory_gpu::adapter_identity(),victory_gpu::set_caption_status(...), andcrate::prebuild::run(...), whereascrates/victory-gpu/src/lib.rs:967-969gates the first two under#[cfg(windows)](and#2890gatesmod prebuildunder#[cfg(windows)]). Worth gating/stubbing for non-Windows builds so#2907and#2890merge cleanly together.Concurrency & Fallback Review
xmem::low_guardsandd3d12x::use_shader_cacheinitialize beforestartup::prepare; backgroundprebuild::runsharesvictory_gpu::pipeline::librarysafely viaNAMES.hold(name),statemutex, andwrite_atomically's global lock; individual warm/prebuild failures warn without blocking launch or writing stale stamps.Local Verification
cargo test --locked -p victory: 23/23 unit tests (includingprogress::tests3/3,splash::tests2/2,startup::tests4/4) + 4/4 integration tests passed.victory-gpuhost::tests(--features diagnostics,VICTORY_D3D12_DEBUG=1): 16/16 on RTX 5090 (non-descriptor tests) and 31/31 on WARP.cargo clippy --locked -p victory -p victory-gpu --all-targets -- -D warnings(default and--features victory-gpu/diagnostics) &cargo xtask policy(194 files ok): clean.Imported from Marvisak/VIctory. Originally posted by alexandruiulian201-bot on 2026-11-25T23:48:26Z.
The CI failure is because
apps/victory/Cargo.tomladdedwindows-syswithout updatingCargo.lock, and CI runs with--locked.Note: running
cargo check --workspace(orcargo update --workspace) will add just thewindows-sysentry forvictoryinCargo.lockwithout bumping unrelated dependency versions (avoidcargo generate-lockfile)Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T00:05:07Z.
@fuzeofficlal thanks, that was a real hang. Fixed in
69a0d48a: the wait is nowstartup::ready(mode, work.is_finished(), shaders_done), so the title starts once the worker has ended for any reason, including a panic, or once its shaders are done in the default mode. The new testthe_title_starts_when_the_work_is_over_or_its_shaders_are_donecovers both. The earlier CI failure was a missingCargo.lockupdate, fixed in2710e9c8.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T02:19:26Z.
Automated triage for the maintainers.
Thanks for the reply. The offer to make the prebuild opt-in (
VICTORY_PREBUILD=on) is noted. Thewindows-sysdependency and whether the launcher owns the prebuild step are still the maintainer's decision, so the verdict stays needs work: needs the maintainer's decision.CI: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T06:42:24Z.
Understood: the
windows-sysdependency and whether the launcher should own the prebuild step and its window are your call. If you'd rather not change the default, I can make the prebuild opt-in (VICTORY_PREBUILD=on) sorun --executebehaves as before unless asked.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.