Add opt-in LARP_PIPELINE_WAIT_MS budgeted wait for graphics pipelines #3

Manually merged
github merged 1 commit from gh-pr/3/head into gh-pr/3/base 2026-12-05 17:21:33 +00:00
Owner

@⁠Logard0 on GitHub · 2026-12-05 12:32 UTC · original
Logard0:fix/pipeline-wait-budget → main · +79 −16 · 1 files · 1 commits · merged 2026-12-05 14:45 UTC

Adds an opt-in per-frame budgeted wait (LARP_PIPELINE_WAIT_MS=<N>) for non-lasting graphics pipelines in crates/larp-gpu/src/pipeline/make.rs to eliminate in-game shader-compilation hitches.

Summary of changes

  • Opt-in env switch (pipeline_wait_budget): Reads LARP_PIPELINE_WAIT_MS once via OnceLock and logs one tracing::info! line on first use with the configured budget in ms. Unset or 0 preserves the existing behavior exactly.
  • Budgeted worker-only wait (wait_budgeted): When a draw asks for a non-lasting graphics pipeline (!p.lasting()) and LARP_PIPELINE_WAIT_MS=N (N > 0) is set, ready() skips wait_for() and instead waits up to N ms per title frame (shared across all threads via a per-frame SPENT mutex using the same reserve-and-refund pattern as wait(), extracted into run_with_frame_budget) using until_made() only—never make_here() on the title thread. If the budget runs out before a worker finishes, ready() returns None so the draw is dropped until the worker completes.
  • Lasting pipelines unchanged: Compute pipelines and BAKE_PIXEL_SHADERS (Pending::lasting()) keep the existing wait_for() / wait() + wait_lasting() behavior.
  • Unit test: Added parse_wait_budget_handles_opt_in_values covering unset, empty, 0, negative, invalid, and positive millisecond values (recommended value: 8).

Verification

  • cargo test --locked -p larp-gpu parse_wait_budget: 1 passed, 0 failed
  • cargo clippy --locked --tests -p larp-gpu: 0 warnings in the changed code

Made with the help of Gemini 4 Neon.

**@⁠Logard0** on GitHub · 2026-12-05 12:32 UTC · [original](https://github.com/gamingwithhomie/larp/pull/3) `Logard0:fix/pipeline-wait-budget` → `main` · +79 −16 · 1 files · 1 commits · merged 2026-12-05 14:45 UTC Adds an opt-in per-frame budgeted wait (`LARP_PIPELINE_WAIT_MS=<N>`) for non-lasting graphics pipelines in `crates/larp-gpu/src/pipeline/make.rs` to eliminate in-game shader-compilation hitches. ### Summary of changes - **Opt-in env switch (`pipeline_wait_budget`):** Reads `LARP_PIPELINE_WAIT_MS` once via `OnceLock` and logs one `tracing::info!` line on first use with the configured budget in ms. Unset or `0` preserves the existing behavior exactly. - **Budgeted worker-only wait (`wait_budgeted`):** When a draw asks for a non-lasting graphics pipeline (`!p.lasting()`) and `LARP_PIPELINE_WAIT_MS=N` (`N > 0`) is set, `ready()` skips `wait_for()` and instead waits up to `N` ms per title frame (shared across all threads via a per-frame `SPENT` mutex using the same reserve-and-refund pattern as `wait()`, extracted into `run_with_frame_budget`) using `until_made()` only—never `make_here()` on the title thread. If the budget runs out before a worker finishes, `ready()` returns `None` so the draw is dropped until the worker completes. - **Lasting pipelines unchanged:** Compute pipelines and `BAKE_PIXEL_SHADERS` (`Pending::lasting()`) keep the existing `wait_for()` / `wait()` + `wait_lasting()` behavior. - **Unit test:** Added `parse_wait_budget_handles_opt_in_values` covering unset, empty, `0`, negative, invalid, and positive millisecond values (recommended value: `8`). ### Verification - `cargo test --locked -p larp-gpu parse_wait_budget`: 1 passed, 0 failed - `cargo clippy --locked --tests -p larp-gpu`: 0 warnings in the changed code Made with the help of Gemini 4 Neon.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 17:21:30 +00:00
github manually merged commit 15cdc7f41c into gh-pr/3/base 2026-12-05 17:21:32 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.