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.

The black-frame warning reads only elements' boxes: asking a text node for its bounding rect panicked in blitz-dom (transform on a text node), so a render whose frame drew black twice crashed whenever near-black words came before anything with a colour of its own (snapcn's text-build and text-swell, 11-12). bench/black-frame gains RAEA_BLACK_FAULT=3 (every draw black, the canary healthy: the render warns, naming what the page shows) and a text-first case that panicked before this; regression from 559d8274e (#96), which isn't in 0.1.2's rc3

shinyobjectz97e03e74472b
diff --git a/engine/page/src/motion/manifest.rs b/engine/page/src/motion/manifest.rs
index 0e77d892..2f3be823 100644
--- a/engine/page/src/motion/manifest.rs
+++ b/engine/page/src/motion/manifest.rs
@@ -148,8 +148,12 @@ impl BlitzPage {
while let Some(n) = stack.pop() {
let Some(node) = doc.get_node(n) else { continue };
stack.extend(node.children.iter().rev().copied());
+ // an element's box only: the document and text nodes have none to ask for (blitz-dom panics on their transform)
+ if !node.is_element() || node.attr(LocalName::from("data-raea-src")).is_some() {
+ continue;
+ }
let on = doc.get_client_bounding_rect(n).is_some_and(|b| b.width > 0.0 && b.height > 0.0 && b.x < w && b.y < h && b.x + b.width > 0.0 && b.y + b.height > 0.0);
- if !node.is_element() || node.attr(LocalName::from("data-raea-src")).is_some() || !on || alpha(doc, n) <= 0.01 {
+ if !on || alpha(doc, n) <= 0.01 {
continue;
}
let Some(s) = node.primary_styles() else { continue };
diff --git a/sdk/raea/bench/black-frame/check.sh b/sdk/raea/bench/black-frame/check.sh
index bfc73c2a..c77ecba6 100755
--- a/sdk/raea/bench/black-frame/check.sh
+++ b/sdk/raea/bench/black-frame/check.sh
@@ -7,9 +7,11 @@
# RAEA_BLACK_FAULT=1 each frame's first draw comes back black: the render must redraw (its stderr says so) and come
# out the same as the plain render (SSIM >= 0.999)
# RAEA_BLACK_FAULT=2 every draw black and the GPU canary failing: the render must be refused, with the reason
+# RAEA_BLACK_FAULT=3 every draw black and the canary passing (the page cases): the render must finish and warn that the
+# page shows something (#96), not panic reading the page's text nodes
# A black frame that says ok, or a different one with no word, is a failure.
#
-# sdk/raea/bench/black-frame/check.sh [CASE ...] (default: page scene; RAEA_BIN, default raea)
+# sdk/raea/bench/black-frame/check.sh [CASE ...] (default: page text-first scene; RAEA_BIN, default raea)
# Prints a line per case and fault (PASS or MISS) and exits 1 when any misses.
set -u
export RAEA_SIGN=0 RAEA_MARK=0
@@ -17,7 +19,7 @@ HERE=$(cd "$(dirname "$0")" && pwd)
BIN=${RAEA_BIN:-raea}
OUT=$(mktemp -d "${TMPDIR:-/tmp}/raea-black-frame.XXXXXX")
trap 'rm -rf "$OUT"' EXIT
-[ $# -gt 0 ] || set -- page scene
+[ $# -gt 0 ] || set -- page text-first scene
bad=0
for c in "$@"; do
d=$OUT/$c
@@ -46,5 +48,14 @@ for c in "$@"; do
else
echo "MISS $c fault 2: not refused$([ -f "$d/f2/frame-00000.png" ] && echo ", a frame written")"; bad=1
fi
+ # every draw black with a healthy canary: kept, and the page's paint named
+ [ "$c" = page ] || [ "$c" = text-first ] || continue
+ mkdir -p "$d/f3"
+ (cd "$HERE" && RAEA_BLACK_FAULT=3 "$BIN" render "$c.tsx" --at 0 -o "$d/f3/") > "$d/f3.log" 2>&1
+ if grep -q "black-frame" "$d/f3.log" && grep -q "though the page shows" "$d/f3.log" && ! grep -q panicked "$d/f3.log"; then
+ echo "PASS $c fault 3: warned ($(grep -m1 'though the page shows' "$d/f3.log" | cut -c1-140))"
+ else
+ echo "MISS $c fault 3: $(grep -m1 -E 'panicked|REFUSED' "$d/f3.log" | cut -c1-160 || echo 'no warning said')"; bad=1
+ fi
done
exit $bad
diff --git a/sdk/raea/bench/black-frame/text-first.tsx b/sdk/raea/bench/black-frame/text-first.tsx
new file mode 100644
index 00000000..5d3cd02c
--- /dev/null
+++ b/sdk/raea/bench/black-frame/text-first.tsx
@@ -0,0 +1,14 @@
+// The black-frame warning's text case (#96): near-black words come before anything with a colour of its own, so the
+// warning's search for what the page shows reads text nodes on its way to the red box. check.sh renders it with every
+// draw black (RAEA_BLACK_FAULT=3): it must warn, naming the box, not panic on a text node (text-build did, 11-12).
+import { AbsoluteFill, Composition, registerRoot } from "raea";
+
+function Shot() {
+ return (
+ <AbsoluteFill style={{ color: "#050505", fontSize: 40, padding: 40 }}>
+ dark words first
+ <div style={{ width: 200, height: 100, background: "#c03030" }} />
+ </AbsoluteFill>
+ );
+}
+registerRoot(() => <Composition id="main" component={Shot} durationInFrames={2} fps={30} width={640} height={360} />);