From 34f754c5a9a3d3bb68157965c445cb6f15801628 Mon Sep 17 00:00:00 2001
From: pkuzic
Date: Fri, 25 Sep 2026 18:06:45 +0100
Subject: [PATCH] MONKEY (integration): warm the shafts, fog and AO pipelines
on every 3-D view
Co-Authored-By: Claude Opus 5.5
---
crates/benilla-app/src/pipe_warm/menagerie.rs | 6 ++++++
crates/benilla-app/src/post/sun_shafts.rs | 7 +++++++
crates/benilla-app/src/ssao.rs | 13 +++++++++++++
3 files changed, 26 insertions(+)
diff --git a/crates/benilla-app/src/pipe_warm/menagerie.rs b/crates/benilla-app/src/pipe_warm/menagerie.rs
index c4f45c50..f10869ea 100644
--- a/crates/benilla-app/src/pipe_warm/menagerie.rs
+++ b/crates/benilla-app/src/pipe_warm/menagerie.rs
@@ -931,6 +931,12 @@ mod tests {
// also has its OWN pair, for the frames nothing claims it, and 2262 found it compiling
// live at app exit. `prepare_textures` now specialises that pair on every frame rather
// than only on the frame it first needs it.)
+ // - MONKEY (integration) ShaftPipeline (`post::sun_shafts`), FogPipeline
+ // (`volumetric_fog`, incl. lamp fog) and AoPipeline (`ssao`): fullscreen passes keyed
+ // only on the view's target format and MSAA (plus the AO stage/debug flag). Each lane's
+ // `prepare_pipelines` specialises every such key for EVERY `Camera3d` view on every
+ // frame, whether its cvar is on or not, so the variants compile behind the entry cover
+ // and a player enabling the row later hits the cache, not a live compile.
let exempt = ["UiGammaPipeline"];
let own_src = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
let warm_src = std::fs::read_to_string(own_src.join("pipe_warm/mod.rs")).unwrap()
diff --git a/crates/benilla-app/src/post/sun_shafts.rs b/crates/benilla-app/src/post/sun_shafts.rs
index f509fd48..9f3dc4dc 100644
--- a/crates/benilla-app/src/post/sun_shafts.rs
+++ b/crates/benilla-app/src/post/sun_shafts.rs
@@ -221,7 +221,14 @@ fn prepare_pipelines(
pipeline: Res,
mut specialized: ResMut>,
views: Query<(Entity, &ViewTarget, &Msaa), With>,
+ all_views: Query<(&ViewTarget, &Msaa), With>,
) {
+ // MONKEY (integration): warm every reachable key on every 3-D view, feature on or off, so the
+ // compile happens under the entry cover and never live when the player turns the row on.
+ // (Named in `pipe_warm/menagerie.rs`'s custom-lane census.)
+ for (target, msaa) in &all_views {
+ specialized.specialize(&cache, &pipeline, (target.main_texture_format(), msaa.samples() > 1));
+ }
for (entity, target, msaa) in &views {
let id = specialized.specialize(
&cache,
diff --git a/crates/benilla-app/src/ssao.rs b/crates/benilla-app/src/ssao.rs
index d81d75e6..489ea9a7 100644
--- a/crates/benilla-app/src/ssao.rs
+++ b/crates/benilla-app/src/ssao.rs
@@ -292,8 +292,21 @@ fn prepare_pipelines(
pipeline: Res,
mut specialized: ResMut>,
views: Query<(Entity, &ViewTarget, &Msaa), With>,
+ all_views: Query<(&ViewTarget, &Msaa), With>,
) {
let debug = debug_view();
+ // MONKEY (integration): warm every reachable key on every 3-D view, feature on or off, so the
+ // compile happens under the entry cover and never live when the player turns the row on.
+ // (Named in `pipe_warm/menagerie.rs`'s custom-lane census.)
+ for (target, msaa) in &all_views {
+ for stage in [Stage::Ao, Stage::Blur, Stage::Apply] {
+ specialized.specialize(
+ &cache,
+ &pipeline,
+ (stage, target.main_texture_format(), msaa.samples(), debug),
+ );
+ }
+ }
for (entity, target, msaa) in &views {
let format = target.main_texture_format();
let samples = msaa.samples();