test(3d): screenshot-baseline TDD suite for the 3D viewer OpenGL->WebGL port — 47 native goldens + red-state WebGL harness
tests/3d-regression mirrors the gal-regression pattern at renderer scale: shared C++ scenarios call real KiCad 3D-viewer code (opengl_utils, display lists + DrawCulled stencil subtraction, MODEL_3D VBOs, private generators via a rob-template accessor, and full reload()+Redraw() composites over a synthetic BOARD_ADAPTER). A native macOS harness renders them on real OpenGL into 47 committed goldens (bit-deterministic, FBO capture); the wasm harness compiles the same TUs against wasm/stubs/gl_ffp_stub.c no-ops so every scenario renders blank — the TDD red state (parity meter: 47/47 changed). Comparisons use the CI pixelmatch engine via the new generic compare-dirs.ts (floors.json levels; manifest.json cmp-guards registry drift). Documents an upstream bug: appendPostMachiningGeometry's countersink path adds middle quads without normals, silently erasing the walls of any display list it is batched into (3d-post-machining.png keeps the lists separate to record it). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
1a24c2894e
commit
ce1473c9ab
85 changed files with 6797 additions and 1 deletions
55
scripts/build-3d-native-test.sh
Executable file
55
scripts/build-3d-native-test.sh
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Build script for the native 3D-renderer test harness (tests/3d-regression/native).
|
||||
#
|
||||
# Builds a standalone macOS application that renders the shared 3D scenarios
|
||||
# through KiCad's actual RENDER_3D_OPENGL code paths (real desktop OpenGL) and
|
||||
# writes golden baseline PNGs for the OpenGL->WebGL port regression suite.
|
||||
#
|
||||
# Modeled on scripts/build-gal-native-test.sh.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
TEST_DIR="$PROJECT_ROOT/tests/3d-regression/native"
|
||||
BUILD_DIR="$TEST_DIR/build"
|
||||
LOG_FILE="$PROJECT_ROOT/tests/logs/3d-native-build.log"
|
||||
|
||||
mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
echo "Building 3D Renderer Native Test..."
|
||||
echo " Test dir: $TEST_DIR"
|
||||
echo " Build dir: $BUILD_DIR"
|
||||
echo " Log file: $LOG_FILE"
|
||||
|
||||
mkdir -p "$BUILD_DIR"
|
||||
|
||||
echo "Running CMake..."
|
||||
if ! cmake -S "$TEST_DIR" -B "$BUILD_DIR" >> "$LOG_FILE" 2>&1; then
|
||||
echo "CMake configuration failed! Check $LOG_FILE for details."
|
||||
echo ""
|
||||
echo "Last 50 lines of log:"
|
||||
tail -50 "$LOG_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building..."
|
||||
if ! make -C "$BUILD_DIR" -j"$(sysctl -n hw.ncpu 2>/dev/null || echo 4)" >> "$LOG_FILE" 2>&1; then
|
||||
echo "Build failed! Check $LOG_FILE for details."
|
||||
echo ""
|
||||
echo "Last 100 lines of log:"
|
||||
tail -100 "$LOG_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Build successful!"
|
||||
echo "Executable: $BUILD_DIR/scene3d_native_test"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --output <dir> Output directory for 3d-<name>.png"
|
||||
echo " --manifest <file> Write the scenario manifest JSON"
|
||||
echo " --filter <substr> Only run scenarios whose name contains <substr>"
|
||||
echo " --list Print scenario names and exit"
|
||||
echo " --show Keep the window open after rendering"
|
||||
Loading…
Reference in a new issue