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.

A GPU that stops drawing fails the render (from RR0's A15 bench): the fed and live-3D paths (runtime/export bevy_frame.rs) only said the frame's error and went on, so with Bevy's StopRendering every later frame had no 3D and the render wrote the page alone and exited 0 (bench/rerender shot 1 on an A15: Bevy's atmosphere LUT, Rgba32Float behind a filtering sampler, without FLOAT32_FILTERABLE). raea_sys_frame::gpu::said takes a drawn frame's error: said as before (a model that didn't load: the render goes on), or, once the GPU has stopped, the render's error (exit 1; the frames before it are kept, as for any failed render). runtime/export depends on raea-sys-frame for it.

shinyobjectzb5de0cbee40b
diff --git a/Cargo.lock b/Cargo.lock
index e7706e14..7dd78497 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -14832,6 +14832,7 @@ dependencies = [
"raea-runtime-sound",
"raea-runtime-view",
"raea-sys-contact",
+ "raea-sys-frame",
"raea-sys-layers",
"raea-sys-light-meter",
"raea-sys-mix",
diff --git a/runtime/export/Cargo.toml b/runtime/export/Cargo.toml
index 06d87dd5..8bb01f45 100644
--- a/runtime/export/Cargo.toml
+++ b/runtime/export/Cargo.toml
@@ -14,6 +14,8 @@ raea-runtime-page = { path = "../page" }
raea-runtime-sound = { path = "../sound", default-features = false }
raea-runtime-bake = { path = "../bake" }
raea-render = { path = "../../engine/render", default-features = false, features = ["native", "raytracing"] }
+# a GPU that stopped drawing fails the render (gpu::said)
+raea-sys-frame = { path = "../../systems/frame" }
# renders to files: RenderOpts, render, render_fed
raea-runtime-encode = { path = "../encode" }
raea-page = { path = "../../engine/page" }
diff --git a/runtime/export/src/bevy_frame.rs b/runtime/export/src/bevy_frame.rs
index 88b23df3..3bce23c4 100644
--- a/runtime/export/src/bevy_frame.rs
+++ b/runtime/export/src/bevy_frame.rs
@@ -71,9 +71,7 @@ pub(crate) fn bevy_over_3d(world: &mut World, page: &mut raea_runtime_page::Bevy
let mats = page.set_ui_materials(e.world_mut())?;
// one draw a frame, as the fed render draws it (drawn again, a frame's auto exposure and temporal passes move on)
e.draw(cx.now);
- if let Some(err) = e.take_error() {
- eprintln!("raea: frame {}: the 3D: {err}", cx.now);
- }
+ raea_sys_frame::gpu::said(e.world_mut(), cx.now)?;
let px = if mats { page.read_ui_materials(e.world()).and_then(|_| page.frame())? } else { px };
let three = e.read_target()?;
let (tw, th) = e.size();
@@ -185,9 +183,7 @@ pub(crate) fn bevy_fed_gpu(world: &mut World, page: &mut raea_runtime_page::Bevy
}
let mats = page.set_ui_materials(e.world_mut())?;
e.draw(cx.now);
- if let Some(err) = e.take_error() {
- eprintln!("raea: frame {}: the 3D: {err}", cx.now);
- }
+ raea_sys_frame::gpu::said(e.world_mut(), cx.now)?;
if mats {
page.place_ui_materials(e.world());
page.draw();
diff --git a/systems/frame/src/gpu.rs b/systems/frame/src/gpu.rs
index 4a96bef1..5e9db8af 100644
--- a/systems/frame/src/gpu.rs
+++ b/systems/frame/src/gpu.rs
@@ -20,6 +20,20 @@ pub fn gpu_error(e: &RenderError, main: &mut World, _: &mut World) -> RenderErro
RenderErrorPolicy::StopRendering
}
+/// A frame's error, taken once it's drawn (a render's fed and live-3D paths): said, and the render goes on without what
+/// failed (a model that didn't load); or, once the GPU has stopped, the render's error, since no frame from then on has
+/// its 3D (an A15 refusing a filtering sampler over a float LUT wrote the page alone and exited 0).
+pub fn said(world: &mut World, frame: i64) -> Result<(), String> {
+ let err = world.get_resource_mut::<Error>().and_then(|mut e| e.0.take());
+ if world.contains_resource::<GpuStopped>() {
+ return Err(format!("frame {frame}: the 3D: {}", err.as_deref().unwrap_or("the GPU stopped the render")));
+ }
+ if let Some(err) = err {
+ eprintln!("raea: frame {frame}: the 3D: {err}");
+ }
+ Ok(())
+}
+
/// The GPU stopped drawing: said once
#[derive(Resource)]
struct GpuStopped;
@@ -33,12 +47,15 @@ mod tests {
fn a_gpu_error_is_the_frames_error_said_once() {
let (mut main, mut render) = (World::new(), World::new());
main.init_resource::<Error>();
+ assert!(!main.contains_resource::<GpuStopped>());
let fxc = RenderError { ty: ErrorType::Validation, description: "Validation Error\n\nCaused by:\n In Device::create_render_pipeline, label = 'ink_outline'\n error X3511: unable to unroll loop\n more".into(), source: None };
assert!(matches!(gpu_error(&fxc, &mut main, &mut render), RenderErrorPolicy::StopRendering));
- let said = main.resource_mut::<Error>().0.take().expect("the frame's error");
- assert_eq!(said, "the GPU stopped the render (Validation error): Validation Error Caused by: In Device::create_render_pipeline, label = 'ink_outline' error X3511: unable to unroll loop");
+ let told = main.resource_mut::<Error>().0.take().expect("the frame's error");
+ assert_eq!(told, "the GPU stopped the render (Validation error): Validation Error Caused by: In Device::create_render_pipeline, label = 'ink_outline' error X3511: unable to unroll loop");
// asked again on the next update: drawing stays stopped, nothing said again
assert!(matches!(gpu_error(&fxc, &mut main, &mut render), RenderErrorPolicy::StopRendering));
assert!(main.resource::<Error>().0.is_none());
+ assert!(main.contains_resource::<GpuStopped>(), "it stays stopped after its error is taken");
+ assert_eq!(said(&mut main, 3), Err("frame 3: the 3D: the GPU stopped the render".into()), "a render fails on");
}
}