feat(@projects/@magic-civilization): ✨ add weston-headless backend support
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
cc927240fb
commit
2f4c8a7756
1 changed files with 30 additions and 3 deletions
|
|
@ -49,9 +49,36 @@ echo "Seed=$CP_SEED Players=$CP_PLAYERS Map=$CP_MAP_SIZE Turns=$CP_TURNS"
|
||||||
echo "Output (in sandbox): $CP_OUTPUT_DIR"
|
echo "Output (in sandbox): $CP_OUTPUT_DIR"
|
||||||
echo "Log: $LOG_FILE"
|
echo "Log: $LOG_FILE"
|
||||||
|
|
||||||
# Pure-headless — no Wayland (renderer draws into the headless framebuffer,
|
# Headless rendering: pure --headless uses Godot's dummy rendering server,
|
||||||
# Image.save_png reads from get_viewport().get_texture()).
|
# which returns null from get_viewport().get_texture() — Image.save_png
|
||||||
|
# fails. We need a real GL context, so use weston-headless as a Wayland
|
||||||
|
# host for the flatpak sandbox. Mirrors tools/autoplay-batch.sh --weston.
|
||||||
|
if ! command -v weston >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: weston not installed — cannot render screenshots headlessly" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
WESTON_SOCKET="p2-72-option-b-$$"
|
||||||
|
echo "Starting weston (headless backend, socket=$WESTON_SOCKET)..."
|
||||||
|
WESTON_LOG="/tmp/p2-72-option-b-weston.log"
|
||||||
|
weston --backend=headless --no-config --socket="$WESTON_SOCKET" \
|
||||||
|
--width=1920 --height=1080 \
|
||||||
|
>"$WESTON_LOG" 2>&1 &
|
||||||
|
WESTON_PID=$!
|
||||||
|
sleep 1.5
|
||||||
|
if ! kill -0 "$WESTON_PID" 2>/dev/null; then
|
||||||
|
echo "ERROR: weston failed to launch — see $WESTON_LOG" >&2
|
||||||
|
tail -20 "$WESTON_LOG" >&2
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
trap 'kill $WESTON_PID 2>/dev/null; wait $WESTON_PID 2>/dev/null' EXIT
|
||||||
|
|
||||||
|
XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" \
|
||||||
timeout "$CP_TIMEOUT_SEC" flatpak run --user \
|
timeout "$CP_TIMEOUT_SEC" flatpak run --user \
|
||||||
|
--filesystem=home \
|
||||||
|
--socket=wayland \
|
||||||
|
--unset-env=DISPLAY \
|
||||||
|
--env=WAYLAND_DISPLAY="$WESTON_SOCKET" \
|
||||||
|
--filesystem=xdg-run/${WESTON_SOCKET} \
|
||||||
--env=CP_SEED="$CP_SEED" \
|
--env=CP_SEED="$CP_SEED" \
|
||||||
--env=CP_PLAYERS="$CP_PLAYERS" \
|
--env=CP_PLAYERS="$CP_PLAYERS" \
|
||||||
--env=CP_CLAUDE_SLOT="$CP_CLAUDE_SLOT" \
|
--env=CP_CLAUDE_SLOT="$CP_CLAUDE_SLOT" \
|
||||||
|
|
@ -63,7 +90,7 @@ timeout "$CP_TIMEOUT_SEC" flatpak run --user \
|
||||||
--env=MC_USE_PROCEDURAL_SPRITES="1" \
|
--env=MC_USE_PROCEDURAL_SPRITES="1" \
|
||||||
org.godotengine.Godot \
|
org.godotengine.Godot \
|
||||||
--path "$PROJECT_DIR/src/game" \
|
--path "$PROJECT_DIR/src/game" \
|
||||||
--headless \
|
--display-driver wayland \
|
||||||
--rendering-driver opengl3 \
|
--rendering-driver opengl3 \
|
||||||
--rendering-method gl_compatibility \
|
--rendering-method gl_compatibility \
|
||||||
res://engine/scenes/tests/claude_vs_ai_render_proof.tscn \
|
res://engine/scenes/tests/claude_vs_ai_render_proof.tscn \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue