victory: run makes the title's shaders and pipelines before it starts, with a progress window (once; kept on disk) #2907

Open
github-bot wants to merge 3 commits from github-bot/gh-2907 into main AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 23:38 UTC · original
0xkn0wh3r3:tools/startup-prebuild → main · +840 −8 · 12 files · 3 commits · open

translate --cache --pipelines makes 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 --execute makes 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's translate --cache --pipelines line 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:

    • shaders: a fingerprint of the files (path, size, time written) and of the shader cache's build directory, which names the translator and its settings;
    • pipelines: that, plus the GPU and driver (new 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:

    Value The title waits for
    shaders (default) the shaders (minutes, once per translator)
    all the pipelines too (about 20 minutes on 16 threads; hours after a translator change that touches most programs)
    off nothing; nothing is made ahead

    Pipelines 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:

    • the phase and the file;
    • done of total, time spent and an estimate of time left;
    • the last log lines.

    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 small progress state, and their summary lines go into its log.

Tests

  • progress: progress line and time-left estimate, durations, the log keeping its last lines.
  • startup:
    • the VICTORY_PREBUILD modes;
    • the stamp's round trip;
    • the fingerprint changing with a file's contents, the file list and the GPU part, and staying the same otherwise;
    • the shader file list.
  • 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-targets and -p victory-gpu --all-targets are clean, with and without --features diagnostics.

Not verified

  • Not run with the title: no game data here. What a cold start shows, and how long the shader half takes on a given machine, needs a run.
  • Pipelines made behind a running title share the pipeline library with the run's own pipeline workers, as the run's workers already do with each other. A run would show whether the extra CPU load matters during play; VICTORY_PREBUILD=all avoids the overlap.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 23:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2907) `0xkn0wh3r3:tools/startup-prebuild` → `main` · +840 −8 · 12 files · 3 commits · open `translate --cache --pipelines` makes 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 --execute` makes 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's `translate --cache --pipelines` line 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: - **shaders:** a fingerprint of the files (path, size, time written) and of the shader cache's build directory, which names the translator and its settings; - **pipelines:** that, plus the GPU and driver (new `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`: | Value | The title waits for | |---|---| | `shaders` (default) | the shaders (minutes, once per translator) | | `all` | the pipelines too (about 20 minutes on 16 threads; hours after a translator change that touches most programs) | | `off` | nothing; nothing is made ahead | Pipelines 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: - the phase and the file; - done of total, time spent and an estimate of time left; - the last log lines. 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 small `progress` state, and their summary lines go into its log. ## Tests - `progress`: progress line and time-left estimate, durations, the log keeping its last lines. - `startup`: - the `VICTORY_PREBUILD` modes; - the stamp's round trip; - the fingerprint changing with a file's contents, the file list and the GPU part, and staying the same otherwise; - the shader file list. - `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-targets` and `-p victory-gpu --all-targets` are clean, with and without `--features diagnostics`. ## Not verified - Not run with the title: no game data here. What a cold start shows, and how long the shader half takes on a given machine, needs a run. - Pipelines made behind a running title share the pipeline library with the run's own pipeline workers, as the run's workers already do with each other. A run would show whether the extra CPU load matters during play; `VICTORY_PREBUILD=all` avoids the overlap.
`translate --cache --pipelines` makes every shader and pipeline a title
can ask for, but only when someone runs it; otherwise the first runs
translate at first use (draws wait) and make pipelines on worker threads
(draws are dropped meanwhile), again after every translator change.

`run --execute` now does it itself, before the title starts, on the
title's shaders.rpf, executable and DLLs (`startup::prepare`):

- A stamp in the cache folder (`prebuild/<title dir hash>.txt`) records a
  fingerprint of what is done: for the shaders, the files (path, size,
  time written) and the shader cache's build directory (translator and
  settings); for the pipelines, those and the GPU and driver
  (`victory_gpu::adapter_identity`). A start with nothing new reads the
  stamp and goes on at once. Both halves stay on disk as before: the
  shader cache and the pipeline library.
- What is not done runs on a thread of its own with the existing code
  (translate::warm, prebuild::run). VICTORY_PREBUILD chooses what the
  title waits for: `shaders` (default), `all`, or `off`. Pipelines not
  waited for are made behind the title on half the processor's threads,
  their progress in the window caption (`victory_gpu::set_caption_status`).
- A progress window (`splash`, plain GDI on its own thread: the GPU is
  busy) shows the phase, the file, done of total, time spent and left,
  and the last log lines, four times a second. Esc or closing it starts
  the title at once; the rest goes on behind it.
- `translate::report`, which both halves already use for their progress
  lines, also feeds `progress`, and their summary lines go to its log.

Tests: progress lines and durations, the log ring, the mode switch, the
stamp's round trip, the fingerprint changing with a file, the file list,
the window's lines, and the window opening and closing on its thread.
Review (fuzeofficlal): with the default mode the wait looked only at the
shaders' flag, which a worker that panicked in the translation never
set, so the title never started. It now also starts once the worker has
finished, however (startup::ready).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:17:13 +00:00
Author
Owner

@⁠alexandruiulian201-bot on GitHub · 2026-11-25 23:48 UTC · original

The CI failure is because apps/victory/Cargo.toml added windows-sys without updating Cargo.lock, and CI runs with --locked.
Note: running cargo check --workspace (or cargo update --workspace) will add just the windows-sys entry for victory in Cargo.lock without bumping unrelated dependency versions (avoid cargo generate-lockfile)

**@⁠alexandruiulian201-bot** on GitHub · 2026-11-25 23:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2907#issuecomment-7178077922) The CI failure is because `apps/victory/Cargo.toml` added `windows-sys` without updating `Cargo.lock`, and CI runs with `--locked`. Note: running `cargo check --workspace` (or `cargo update --workspace`) will add just the `windows-sys` entry for `victory` in `Cargo.lock` without bumping unrelated dependency versions (avoid `cargo generate-lockfile`)
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 00:05 UTC · original

@⁠fuzeofficlal thanks, that was a real hang. Fixed in 69a0d48a: the wait is now startup::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 test the_title_starts_when_the_work_is_over_or_its_shaders_are_done covers both. The earlier CI failure was a missing Cargo.lock update, fixed in 2710e9c8.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 00:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2907#issuecomment-7178377686) @⁠fuzeofficlal thanks, that was a real hang. Fixed in 69a0d48a: the wait is now `startup::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 test `the_title_starts_when_the_work_is_over_or_its_shaders_are_done` covers both. The earlier CI failure was a missing `Cargo.lock` update, fixed in 2710e9c8.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 02:19 UTC · original · edited 2026-11-26 07:23 UTC

Automated triage for the maintainers.

Thanks for the reply. The offer to make the prebuild opt-in (VICTORY_PREBUILD=on) is noted. The windows-sys dependency 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

**@⁠Marvisak** on GitHub · 2026-11-26 02:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2907#issuecomment-7180691147) · edited 2026-11-26 07:23 UTC <!-- victory-triage v1 head=69a0d48a980d9cd0a06121bb5147b80203af57c6 verdict=needs-work at=2026-11-26T07:23:33Z --> Automated triage for the maintainers. Thanks for the reply. The offer to make the prebuild opt-in (`VICTORY_PREBUILD=on`) is noted. The `windows-sys` dependency 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](https://claude.ai/code)_
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 06:42 UTC · original

Understood: the windows-sys dependency 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) so run --execute behaves as before unless asked.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 06:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/2907#issuecomment-7184700179) Understood: the `windows-sys` dependency 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`) so `run --execute` behaves as before unless asked.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2907/head:github-bot/gh-2907'
git switch 'github-bot/gh-2907'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2907'
git switch 'github-bot/gh-2907'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2907'
git switch 'github-bot/gh-2907'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2907'
git switch 'main'
git merge --squash 'github-bot/gh-2907'
git switch 'main'
git merge --ff-only 'github-bot/gh-2907'
git switch 'main'
git merge 'github-bot/gh-2907'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
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
github/Marvisak--VIctory!2907
No description provided.