#28 (2): a 3D still or --at with --manifest writes the manifest, as a 2D render does. The 3D stills branch (bevy_ui, the page over its 3D) returned without writing it, so none was written and one left from an earlier run stayed, looking current. The three places that write it share write_manifest now (lib.rs); a 3D still's has the frames' boxes and text as drawn, the 3D's clipping from its check, and no sounds. To make room under the crate's 2000-line limit, scene3d.rs (27 lines of wrappers over raea-runtime-scene) is gone: scene.rs keeps items and all_items, and program.rs calls raea-runtime-scene directly. bench/at-3d/check.sh now also needs its --at render's manifest to list the four frames: it fails on the raea before this (no manifest) and passes on this one; a 2D render's manifest is byte-identical before and after.

This commit is contained in:
shinyobjectz committed 2026-11-07 16:57:06 -08:00
1 parent 36cbb99227
commit ca41f80d16
8 files changed
+33 -45

No files matched your search

+6 -2
View File
@@ -2,7 +2,8 @@
# #26: a 3D composition's --at frames step only themselves and their neighbours, and draw as the whole timeline stepped
# draws them. scene.tsx (360 frames) is drawn at four frames with --at and must report the sparse stepping ("N of M
# frames stepped"); frozen.tsx draws the same four frames as a 4-frame composition (each the scene under <Freeze>, so
# its rows come from stepping every frame), and each pair must be pixel-identical. Exits 1 on a failure.
# its rows come from stepping every frame), and each pair must be pixel-identical; its --manifest must list the four
# frames. Exits 1 on a failure.
# bench/at-3d/check.sh (RAEA_BIN: the raea to run, default target/release/raea)
cd "$(dirname "$0")/../.." || exit 2
BIN=${RAEA_BIN:-$PWD/target/release/raea}
@@ -10,11 +11,14 @@ BIN=${RAEA_BIN:-$PWD/target/release/raea}
export RAEA_SIGN=0 RAEA_MARK=0 RAEA_EXPORT_CACHE=0
OUT=$(mktemp -d "${TMPDIR:-/tmp}/raea-at-3d.XXXXXX")
trap 'rm -rf "$OUT"' EXIT
RAEA_STARTUP_TRACE=1 "$BIN" render bench/at-3d/scene.tsx --at 30,150,270,330 -o "$OUT/at" > "$OUT/at.log" 2>&1 || { echo "FAIL: the --at render failed"; tail -5 "$OUT/at.log"; exit 1; }
RAEA_STARTUP_TRACE=1 "$BIN" render bench/at-3d/scene.tsx --at 30,150,270,330 -o "$OUT/at" --manifest "$OUT/at.json" > "$OUT/at.log" 2>&1 || { echo "FAIL: the --at render failed"; tail -5 "$OUT/at.log"; exit 1; }
"$BIN" render bench/at-3d/frozen.tsx -o "$OUT/frozen" > "$OUT/frozen.log" 2>&1 || { echo "FAIL: the frozen render failed"; tail -5 "$OUT/frozen.log"; exit 1; }
status=0
stepped=$(grep -o "[0-9]* of [0-9]* frames stepped" "$OUT/at.log")
[ "$stepped" = "12 of 332 frames stepped" ] || { echo "FAIL: the --at render stepped '${stepped:-every frame}', not 12 of 332"; status=1; }
# --manifest: written for 3D frames too, one entry a frame drawn (#28: a 3D still or --at wrote none)
n=$(python3 -c 'import json,sys;print(len(json.load(open(sys.argv[1]))["frames"]))' "$OUT/at.json" 2>/dev/null)
[ "$n" = 4 ] || { echo "FAIL: the --at render's manifest has ${n:-no} frames, not 4"; status=1; }
for k in 0 1 2 3; do
f=$(printf 'frame-%05d.png' $k)
d=$(magick compare -metric AE "$OUT/at/$f" "$OUT/frozen/$f" null: 2>&1 | cut -d' ' -f1)
+1 -3
View File
@@ -306,9 +306,7 @@ pub(crate) fn render_fed(app: &mut App, js: &Path, w: u32, h: u32, fps: f64, tot
// 3D parts passing through each other on screen: on stderr, and in the manifest for the legacy app's checks
let found = FED_CLIPPING.lock().unwrap().take().and_then(|t| t.join().ok());
let clipping = found.unwrap_or_else(|| scene::told(&frames.borrow(), w, h, fps));
if let (Some(path), Some(frames_seen)) = (MANIFEST.lock().unwrap().clone(), cx.manifest.take()) {
std::fs::write(&path, json!({"width": w, "height": h, "fps": fps, "frames": frames_seen, "clipping": clipping, "sounds": heard(&frames.borrow(), &notes.borrow(), &cx, fps)}).to_string()).map_err(|e| format!("{}: {e}", path.display()))?;
}
write_manifest(cx, (w, h, fps), clipping, |cx| heard(&frames.borrow(), &notes.borrow(), cx, fps))?;
let ms = t0.elapsed().as_secs_f64() * 1e3 / n.max(1) as f64;
Ok(format!("APPLIED {n} frames rendered to {} ({ms:.1} ms a frame, pages handed to raea-render on the GPU)", out.display()))
}
+7 -1
View File
@@ -29,7 +29,6 @@ use serde_json::{Map, Value, json};
pub(crate) use raea_runtime_react::scene::*;
pub(crate) use raea_runtime_react::{ReactKind, ReactOutbox, ReactPlugin, ReactProps};
mod scene3d;
mod bevy_frame;
use bevy_frame::*;
mod pages;
@@ -67,6 +66,13 @@ pub(crate) struct Sound {
/// `render --manifest PATH` (the CLI's; render_bundle keeps its signature for the iPhone): where render.json goes.
static MANIFEST: std::sync::Mutex<Option<PathBuf>> = std::sync::Mutex::new(None);
/// With --manifest, its file: the frames' boxes as drawn (Ctx.manifest), the 3D's clipping and the sounds heard.
fn write_manifest(cx: &mut Ctx, (w, h, fps): (u32, u32, f64), clipping: Vec<Value>, heard: impl FnOnce(&Ctx) -> Value) -> R<()> {
let (Some(path), Some(frames)) = (MANIFEST.lock().unwrap().clone(), cx.manifest.take()) else { return Ok(()) };
let m = json!({"width": w, "height": h, "fps": fps, "frames": frames, "clipping": clipping, "sounds": heard(cx)});
std::fs::write(&path, m.to_string()).map_err(|e| format!("{}: {e}", path.display()))
}
/// `render --stage WxH`: a responsive composition (one that lays out from useVideoConfig) laid out at a stage's size, as
/// the legacy app's stage plays it (live.rs open), so a game's render can be checked against its frames at its own size.
static STAGE: std::sync::Mutex<Option<(u32, u32)>> = std::sync::Mutex::new(None);
+4 -4
View File
@@ -36,8 +36,8 @@ pub(crate) fn program(frames: &[(i64, Frame)], w: u32, h: u32, fps: f64) -> raea
}
}
if has3d {
// where it is and looks, frame by frame; its lens, ambient light and post-processing (scene3d)
scene3d::camera(frames, &mut p, &mut cam);
// where it is and looks, frame by frame; its lens, ambient light and post-processing (raea-runtime-scene)
raea_runtime_scene::camera(&scene::all_items(frames), &mut p, &mut cam);
}
p.spawns.push(("camera".into(), vec![cam]));
// the pages: each distinct page shown for the frames in a row it's the same
@@ -123,8 +123,8 @@ pub(crate) fn program(frames: &[(i64, Frame)], w: u32, h: u32, fps: f64) -> raea
p.spawns.push(("master".into(), vec![row("mix", vec![("lufs", V::N(lufs)), ("ceiling", V::N(ceiling))])]));
}
if has3d {
// lights, meshes, models and pictures in space, matched across frames by identity (scene3d)
scene3d::rows(frames, &mut p);
// lights, meshes, models and pictures in space, matched across frames by identity (raea-runtime-scene)
raea_runtime_scene::rows(&scene::all_items(frames), &mut p);
}
p
}
+4 -6
View File
@@ -283,9 +283,9 @@ pub(crate) fn render_bundle_with(js: &Path, dir: &Path, out: &Path, wanted: Opti
write_aov(out, i, cx.scene3d.as_mut())?;
}
}
if let Some(t) = FED_CLIPPING.lock().unwrap().take() {
let _ = t.join();
}
// with --manifest, its file as a 2D render writes it (it wrote none, and an older one stayed looking current, #28)
let clipping = FED_CLIPPING.lock().unwrap().take().and_then(|t| t.join().ok()).unwrap_or_default();
write_manifest(&mut cx, (w, h, fps), clipping, |_| json!([]))?;
return Ok(if folder {
format!("APPLIED {} frames rendered to {} (bevy_ui, the page over its 3D)", wanted.len(), out.display())
} else {
@@ -340,9 +340,7 @@ pub(crate) fn render_bundle_with(js: &Path, dir: &Path, out: &Path, wanted: Opti
drop(app);
// 3D parts passing through each other on screen: on stderr, and in the manifest for the legacy app's checks
let clipping = scene::told(&frames, w, h, fps);
if let (Some(path), Some(frames_seen)) = (MANIFEST.lock().unwrap().clone(), cx.manifest.take()) {
std::fs::write(&path, json!({"width": w, "height": h, "fps": fps, "frames": frames_seen, "clipping": clipping, "sounds": heard(&frames, &tones, &cx, fps)}).to_string()).map_err(|e| format!("{}: {e}", path.display()))?;
}
write_manifest(&mut cx, (w, h, fps), clipping, |cx| heard(&frames, &tones, cx, fps))?;
let ext = out_ext(out);
// raea-render's IR built directly from the frames and drawn by raea-render (checked equal to the retired rrl's compile of the same
+1 -1
View File
@@ -6,7 +6,7 @@
//! the cameras, each tile's place on the sheets and its exposure, and what the exposure found.
use super::*;
use crate::scene3d::items;
use crate::scene::items;
use raea_core_review::{TILE_W, VIEWS, boxes_of, cameras, ceiling, inside, parts_box, passed, whole};
pub fn review(args: &[String], dir_out: &Path) -> R<String> {
+10 -1
View File
@@ -4,9 +4,18 @@
use serde_json::{Value, json};
use super::scene3d::{all_items, items};
use super::{Frame, bundle_composition, comp_opts, flag, scene_frames_to};
/// A frame's 3D walked into its parts (raea-runtime-scene).
pub(crate) fn items(f: &Frame) -> Vec<raea_core_scene::Item> {
raea_runtime_scene::items_of(&f.scene)
}
/// Each frame's items, walked once (a frame's tree was walked again for each kind of part: 11 times a live frame)
pub(crate) fn all_items(frames: &[(i64, Frame)]) -> Vec<Vec<raea_core_scene::Item>> {
frames.iter().map(|(_, f)| items(f)).collect()
}
/// raea_sys_contact::told on a render's frames: the parts that clip where the camera sees them, said on stderr
/// (RAEA_CLIP_CHECK=0 skips it).
pub(crate) fn told(frames: &[(i64, Frame)], w: u32, h: u32, fps: f64) -> Vec<Value> {
-27
View File
@@ -1,27 +0,0 @@
//! A composition's frames handed to raea-runtime-scene: each frame's 3D walked into its parts once, and the camera's
//! and parts' rows made from them.
use std::collections::BTreeMap;
use raea_core_program::ir::{Program, V};
use raea_core_scene::Item;
use super::Frame;
pub(crate) fn items(f: &Frame) -> Vec<Item> {
raea_runtime_scene::items_of(&f.scene)
}
/// Each frame's items, walked once (a frame's tree was walked again for each kind of part: 11 times a live frame)
pub(crate) fn all_items(frames: &[(i64, Frame)]) -> Vec<Vec<Item>> {
frames.iter().map(|(_, f)| items(f)).collect()
}
/// The camera row's 3D columns: where it is and looks (keyed), its lens, the ambient light, the post-processing.
pub(crate) fn camera(frames: &[(i64, Frame)], p: &mut Program, row: &mut BTreeMap<String, V>) {
raea_runtime_scene::camera(&all_items(frames), p, row)
}
/// The lights, meshes, models and pictures in space, as rows.
pub(crate) fn rows(frames: &[(i64, Frame)], p: &mut Program) {
raea_runtime_scene::rows(&all_items(frames), p)
}