tools/capture.sh <scene-or-scenario> <out.png> renders the real client in a throwaway tidewall-capture-* Docker container (debian:13, Xvfb, Mesa software rendering), with no network, no host display, GPU or audio, and removes the container afterwards. The tidewall-capture image rebuilds only when its recipe changes. Forward+ through Lavapipe is the default, matching the game; CAPTURE_RENDERER=compatibility uses OpenGL through llvmpipe. The script fails if Godot silently falls back to another renderer, and fails on a blank frame, judged by ImageStats (luminance variance and colour count). make capture-test renders the shore test scene with both renderers and proves an empty scene is rejected. ImageStats has unit tests in make check. CLAUDE.md now requires a capture for visual issues, and requires that it be opened and looked at. Closes #7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.2 KiB
Bash
Executable File
37 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Proves the capture harness works and catches blank renders. Needs Docker; not part of
|
|
# `make check`, because it builds an image and renders in software. Run: make capture-test
|
|
set -uo pipefail
|
|
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
|
|
status=0
|
|
dir="captures/selfcheck"
|
|
mkdir -p "$dir"
|
|
|
|
# expect <exit> <renderer> <scenario>
|
|
expect() {
|
|
local wanted="$1" renderer="$2" scenario="$3" code
|
|
CAPTURE_RENDERER="$renderer" tools/capture.sh "$scenario" "$dir/$scenario-$renderer.png" \
|
|
>"$dir/$scenario-$renderer.log" 2>&1
|
|
code=$?
|
|
if [[ "$code" -ne "$wanted" ]]; then
|
|
echo "capture-test FAIL $scenario ($renderer): exit $code, expected $wanted"
|
|
tail -n 15 "$dir/$scenario-$renderer.log"
|
|
status=1
|
|
else
|
|
echo "capture-test ok $scenario ($renderer): exit $code, $(head -n 1 "$dir/$scenario-$renderer.log" | grep -oE '"variance":[0-9.e-]+')"
|
|
fi
|
|
}
|
|
|
|
expect 0 forward_plus smoke
|
|
expect 0 compatibility smoke
|
|
expect 1 forward_plus blank
|
|
|
|
leftover="$(docker ps -a --filter name=tidewall-capture- --format '{{.Names}}')"
|
|
if [[ -n "$leftover" ]]; then
|
|
echo "capture-test FAIL: containers left behind: $leftover"
|
|
status=1
|
|
fi
|
|
[[ "$status" -eq 0 ]] && echo "capture-test: ok. Now open $dir/smoke-forward_plus.png and look at it."
|
|
exit "$status"
|