Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ jobs:
# debug info off: with it the test binaries of the app crates filled 27 GB of a runner's disk (#90)
env:
CARGO_PROFILE_TEST_DEBUG: "0"
run: cargo test --locked -p raea-io-media -p raea-core-fonts -p raea-native -p raea-core-brief -p raea-core-k -p raea-bundle -p raea-app-check -p raea-app-check-flash -p raea-io-ffmpeg -p raea-app-workspace -p raea-app-tools -p raea-app-targets
run: cargo test --locked -p raea-runtime-plugins -p raea-io-media -p raea-core-fonts -p raea-native -p raea-core-brief -p raea-core-k -p raea-bundle -p raea-app-check -p raea-app-check-flash -p raea-io-ffmpeg -p raea-app-workspace -p raea-app-tools -p raea-app-targets
4 changes: 2 additions & 2 deletions engine/page/src/motion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ impl BlitzPage {
if let Some(render_creation) = render {
group = group.set(bevy::render::RenderPlugin { render_creation, ..default() });
}
// a registered Bevy plugin may change the group, as it does raea-render's Engine's: one that brings bevy_winit
// turns WinitPlugin off (two Apps in a process can't each make an event loop: the plugin build's page panicked)
// the registered Bevy plugins' changes, as raea-render's Engine's, and no WinitPlugin (raea_runtime_plugins::group):
// two Apps in a process can't each make an event loop (the plugin build's page panicked; #182 on Linux)
app.add_plugins(raea_runtime_plugins::group(group)).add_plugins(PagePlugin);
app.finish();
app.cleanup();
Expand Down
2 changes: 1 addition & 1 deletion engine/render/src/engine/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Engine {
// no render thread: a frame is drawn by the update that asks for it (wasm32 has no pipelined rendering to turn off)
#[cfg(not(target_arch = "wasm32"))]
let group = group.disable::<bevy::render::pipelined_rendering::PipelinedRenderingPlugin>();
// a registered Bevy plugin may change the group (plugins.rs: one that brings bevy_winit turns WinitPlugin off)
// the registered Bevy plugins' changes, and no WinitPlugin: an Engine makes no event loop (raea_runtime_plugins::group, #182)
app.add_plugins(plugins::group(group));
#[cfg(feature = "raytracing")]
if raea_render_raytrace::wanted(prog) {
Expand Down
10 changes: 10 additions & 0 deletions runtime/plugins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ serde = "1"
raea-core-shape = { path = "../../core/shape" }
raea-bevy-world = { path = "../../engine/bevy-world" }
serde_json = "1"

# Bevy's window plugin compiled in on the desktop, so `group` always has it to leave out (#182): raea's Engines are
# headless, and a build that brings bevy_winit any other way (raea-page-host's window, a plugin's x11, or cargo unifying
# features across `-p raea-cli -p raea-page-host`) made an event loop in each of a process's Apps; winit allows one, so
# the second panicked. Linux's winit needs a backend to compile: x11, loaded at run time and never opened here
[target.'cfg(any(target_os = "macos", target_os = "windows"))'.dependencies]
bevy = { version = "=0.20.0", default-features = false, features = ["bevy_winit"] }

[target.'cfg(target_os = "linux")'.dependencies]
bevy = { version = "=0.20.0", default-features = false, features = ["bevy_winit", "x11"] }
9 changes: 9 additions & 0 deletions runtime/plugins/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,16 @@ pub fn names() -> Vec<&'static str> {
PLUGINS.lock().unwrap().iter().map(|r| r.name).collect()
}

/// Bevy's plugin group for one of raea's Engines (raea-render's, the page's BlitzPage): each registered plugin's change
/// to it, and Bevy's window plugin left out. The Engines are headless, and what shows one in a window makes that window
/// itself; WinitPlugin would make an event loop in every App, and winit allows one a process, so a process's second App
/// panicked "Failed to build event loop: RecreationAttempt" (#182: Linux, a build cargo had unified bevy_winit into).
/// It's compiled in on the desktop (Cargo.toml), so it's always here to leave out, however the build brought it.
pub fn group(mut b: PluginGroupBuilder) -> PluginGroupBuilder {
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))]
if b.contains::<bevy::winit::WinitPlugin>() {
b = b.disable::<bevy::winit::WinitPlugin>();
}
for r in PLUGINS.lock().unwrap().iter().filter(|r| !r.on_demand) {
if let Some(g) = r.group {
b = g(b);
Expand Down
9 changes: 9 additions & 0 deletions runtime/plugins/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,12 @@ fn a_pure_clocks_time_is_the_frame_drawns() {
let held = at(&mut app, 500);
assert!(held.0 < 1.0, "a stepping clock's Time isn't set to the frame's: {held:?}");
}

/// #182: an Engine's group leaves Bevy's window plugin out in every desktop build, so no App of raea's makes an event loop
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))]
#[test]
fn an_engine_makes_no_event_loop() {
let b = group(bevy::app::PluginGroup::build(bevy::DefaultPlugins));
assert!(b.contains::<bevy::winit::WinitPlugin>(), "bevy_winit is compiled in on the desktop (Cargo.toml)");
assert!(!b.enabled::<bevy::winit::WinitPlugin>(), "WinitPlugin left in: a second App in the process panics RecreationAttempt");
}
41 changes: 40 additions & 1 deletion tools/release-check.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
# The check every release archive passes (tools/release.sh runs it on the archive it just made; release.yml's
# windows-verify job runs it again on a fresh Windows runner, from the archive alone): unpacked into a fresh folder,
# with RAEA_NO_TREE=1 so it can't be reading a checkout, its raea renders a frame, has the plugin catalog, prints a
# with RAEA_NO_TREE=1 so it can't be reading a checkout, its raea renders a frame (and a 3D one), has the plugin catalog, prints a
# craft guide, writes styles.gen.ts and maps a song; its binaries name none of raea's API, nothing in it looks like a
# key, and a Windows archive holds no Microsoft file (the CRT comes from the VC++ redistributable;
# docs/handoff/ports.md).
Expand Down Expand Up @@ -35,6 +35,45 @@ TSX
# hello.tsx draws white text on black, so a frame raea finds all black lost its page (Windows' c:\ paths read as a URL
# scheme drew nothing but the black behind it, 11-05)
! grep -q "is all black" "$check/p/render.log" || { grep "all black" "$check/p/render.log" >&2; fail "the unpacked raea rendered a black frame"; }
# a 3D frame too, Bevy's camera, lights and a mesh: on Linux every 3D render panicked in a build whose Engines each made
# an event loop (#182), while the page above rendered. On black, so a 3D pass that drew nothing is all black; on Linux
# once more with no display at all, as a render needs none. Not on Windows, whose runners have only WARP
mkdir -p "$check/3d"
cat > "$check/3d/cube.tsx" <<'TSX'
import { AbsoluteFill, Composition, registerRoot } from "raea";
import { Camera3d } from "raea/camera";
import { AmbientLight, DirectionalLight } from "raea/light";
import { Cuboid, Mesh3d } from "raea/mesh";
import { StandardMaterial } from "raea/pbr";
import { Transform } from "raea/transform";
function Cube() {
return (
<AbsoluteFill style={{ background: "#000" }}>
<>
<Camera3d transform={Transform.fromXyz(0, 2, 5).lookingAt([0, 0, 0])} />
<AmbientLight brightness={200} />
<DirectionalLight transform={Transform.fromXyz(3, 6, 4).lookingAt([0, 0, 0])} illuminance={10000} />
<Mesh3d>
<Cuboid half_size={[1, 1, 1]} />
<StandardMaterial base_color="#e76f51" />
</Mesh3d>
</>
</AbsoluteFill>
);
}
registerRoot(() => <Composition id="cube" component={Cube} width={320} height={180} fps={30} durationInFrames={10} />);
TSX
cube() { # FRAME [ENV ARGS]: cube.tsx's frame FRAME, rendered under `env ENV ARGS`
local f=$1; shift
(cd "$check/3d" && env "$@" RAEA_NO_TREE=1 RUST_BACKTRACE=1 "$raea" render cube.tsx --frame "$f" -o "cube-$f.png" > "render-$f.log" 2>&1) \
|| { local s=$?; tail -40 "$check/3d/render-$f.log" >&2; fail "the unpacked raea didn't render a 3D frame${1:+ ($*)} (exit $s)"; }
[ -s "$check/3d/cube-$f.png" ] || fail "no 3D frame written${1:+ ($*)}"
! grep -q "is all black" "$check/3d/render-$f.log" || fail "the unpacked raea's 3D frame is all black${1:+ ($*)}"
}
case $(uname -s) in
Linux) cube 3; cube 7 -u DISPLAY -u WAYLAND_DISPLAY ;;
Darwin) cube 3 ;;
esac
# the plugin catalog is in it (track 3, raea/plugins): a headless App with avian and Bevy's input, raea/input's virtual
# gamepad pressed and read back. A raea built without --features "bevy-plugins,..." says "no plugin "avian" in this
# build" here
Expand Down
Loading