Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

raea render ends on an error when a pipeline's shader didn't compile: the frame came out without that pass (Solari's light) under "0 errors"; said once a pipeline, as the check "shader"

shinyobjectz8cbf43848851
diff --git a/Cargo.lock b/Cargo.lock
index ddf4cc73..b44a9820 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -15003,6 +15003,7 @@ dependencies = [
"bytemuck",
"dunce",
"image",
+ "raea-core-facts",
"raea-core-program",
"raea-core-shape",
"raea-gpu-device",
diff --git a/engine/render/Cargo.toml b/engine/render/Cargo.toml
index 0eae2cf8..882b3b6e 100644
--- a/engine/render/Cargo.toml
+++ b/engine/render/Cargo.toml
@@ -23,6 +23,7 @@ raea-sys-gi = { path = "../../systems/gi" }
bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app", "multi_threaded", "3d_bevy_render", "ui_bevy_render", "png", "tonemapping_luts", "ktx2", "zstd_rust"] }
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "hdr"] }
# an edit as rows keyed per frame, and 3D shapes as values (docs/media.feature M2)
+raea-core-facts = { path = "../../core/facts" }
raea-core-program = { path = "../../core/program" }
# procedural surfaces on a mesh row (`proc`)
raea-sys-procmat = { path = "../../systems/procmat" }
diff --git a/engine/render/src/engine/open.rs b/engine/render/src/engine/open.rs
index 844ef061..79fc8bb1 100644
--- a/engine/render/src/engine/open.rs
+++ b/engine/render/src/engine/open.rs
@@ -128,7 +128,7 @@ impl Engine {
app.add_plugins((raea_plugins::RaeaPlugins, raea_plugins::RegisteredPlugins { fps: prog.fps }));
app.sub_app_mut(bevy::render::RenderApp).add_systems(
bevy::render::Render,
- wait_pipelines.in_set(bevy::render::RenderSystems::Render).before(bevy::render::renderer::render_system),
+ (wait_pipelines, failed_pipelines).chain().in_set(bevy::render::RenderSystems::Render).before(bevy::render::renderer::render_system),
);
// overlapping fog volumes composited in one order whatever frames came before (raea-sys-fog's FogRank)
app.sub_app_mut(bevy::render::RenderApp)
@@ -292,3 +292,22 @@ fn solari_cut(mut cams: Query<(&raea_sys_post::cut::CameraCut, &mut bevy::solari
}
}
}
+
+/// A pipeline whose shader didn't compile draws nothing, and the frame comes out without its pass (Solari's light, a
+/// material): an error of the render, said once a pipeline, so `raea render` ends on it instead of "0 errors" over a
+/// picture that isn't the scene's (11-25: a reserved word in a shader, and three held runs measured as if lit). A
+/// shader still loading is Bevy's to retry, not a failure.
+fn failed_pipelines(cache: Res<bevy::render::render_resource::PipelineCache>, mut told: Local<std::collections::HashSet<usize>>) {
+ use bevy::render::render_resource::CachedPipelineState;
+ use bevy::shader::ShaderCacheError;
+ for (i, p) in cache.pipelines().enumerate() {
+ let CachedPipelineState::Err(e) = &p.state else { continue };
+ if matches!(e, ShaderCacheError::ShaderNotLoaded(_) | ShaderCacheError::ShaderImportNotYetAvailable) || !told.insert(i) {
+ continue;
+ }
+ let why = e.to_string();
+ let found = raea_core_facts::Finding::new("shader", raea_core_facts::Level::Error, format!("a shader didn't compile, so its pass isn't in the picture: {}", why.lines().map(str::trim).filter(|l| !l.is_empty()).take(4).collect::<Vec<_>>().join(" ")), "raea render");
+ eprintln!("raea: {}", found.line());
+ raea_core_facts::finding::said(&[found]);
+ }
+}