feat(webgl): Enable all 28 scenarios for WebGL test harness
- Update wasm/Makefile to compile ALL scenario files using wildcard - Add conditional compilation to scenario_bitmap.cpp (#ifdef __EMSCRIPTEN__) to handle OpenGL-specific shader workaround code for native only - Change canvas dimensions to 1600x1200 to match native baseline (2x Retina) - Set white background color to match native screenshots - Update gal-webgl.spec.ts to hide UI overlay before taking screenshots - Improve test-gal-regression.sh with better ImageMagick comparison All 28 scenarios now compile and run on both native and WebGL backends. Native vs baseline: PASSED (28/28 matching) WebGL rendering: In progress (primitives not yet visible) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
18c73c355e
commit
d0e2500048
8 changed files with 129 additions and 35 deletions
|
|
@ -94,7 +94,10 @@ KICAD_SRCS = $(KICAD_ROOT)/common/gal/hidpi_gl_canvas.cpp \
|
|||
$(KICAD_ROOT)/common/gal/gal_display_options.cpp
|
||||
|
||||
# Test scenario sources (shared with native test)
|
||||
SCENARIO_SRCS = ../scenarios/gal_test_scenarios.cpp
|
||||
# Include ALL scenario files - they should use the abstract GAL interface only.
|
||||
# The harness decides whether to use OPENGL_GAL (native) or WEBGL_GAL (wasm).
|
||||
SCENARIO_SRCS = ../scenarios/gal_test_scenarios.cpp \
|
||||
$(wildcard ../scenarios/scenario_*.cpp)
|
||||
|
||||
# GLU tesselator - stub (no actual implementation needed for basic shapes)
|
||||
GLU_SRCS =
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@
|
|||
|
||||
#include <cstdio>
|
||||
|
||||
// Canvas dimensions (matching native test)
|
||||
static const int CANVAS_WIDTH = 800;
|
||||
static const int CANVAS_HEIGHT = 600;
|
||||
// Canvas dimensions (matching native baseline at 2x Retina scale)
|
||||
static const int CANVAS_WIDTH = 1600;
|
||||
static const int CANVAS_HEIGHT = 1200;
|
||||
|
||||
// Global state
|
||||
static int g_currentScenario = -1;
|
||||
|
|
@ -166,7 +166,8 @@ bool GALTestApp::OnInit() {
|
|||
// Set up the GAL
|
||||
g_gal->SetScreenSize(VECTOR2I(CANVAS_WIDTH, CANVAS_HEIGHT));
|
||||
g_gal->ResizeScreen(CANVAS_WIDTH, CANVAS_HEIGHT);
|
||||
g_gal->SetClearColor(KIGFX::COLOR4D(0.1, 0.1, 0.15, 1.0));
|
||||
// Use white background to match native baseline screenshots
|
||||
g_gal->SetClearColor(KIGFX::COLOR4D(1.0, 1.0, 1.0, 1.0));
|
||||
|
||||
// CRITICAL: Set worldUnitLength for 1:1 world-to-screen coordinate mapping
|
||||
// GAL default worldUnitLength is for PCB nanometers, which would compress
|
||||
|
|
|
|||
|
|
@ -203,10 +203,10 @@
|
|||
canvas.style.position = 'absolute';
|
||||
canvas.style.left = '0';
|
||||
canvas.style.top = '0';
|
||||
canvas.width = 800;
|
||||
canvas.height = 600;
|
||||
canvas.style.width = '800px';
|
||||
canvas.style.height = '600px';
|
||||
canvas.width = 1600;
|
||||
canvas.height = 1200;
|
||||
canvas.style.width = '1600px';
|
||||
canvas.style.height = '1200px';
|
||||
canvas.oncontextmenu = function(e) { e.preventDefault(); };
|
||||
canvas.addEventListener("webglcontextlost", function(e) {
|
||||
setStatus('WebGL context lost!');
|
||||
|
|
|
|||
|
|
@ -2050,11 +2050,11 @@ void WEBGL_GAL::Flush()
|
|||
|
||||
void WEBGL_GAL::ClearScreen()
|
||||
{
|
||||
// Clear screen
|
||||
// Clear screen with the configured clear color
|
||||
m_compositor->SetBuffer( WEBGL_COMPOSITOR::DIRECT_RENDERING );
|
||||
|
||||
// NOTE: Black used here instead of m_clearColor; it will be composited later
|
||||
glClearColor( 0, 0, 0, 1 );
|
||||
// Use m_clearColor for background (set via SetClearColor())
|
||||
glClearColor( m_clearColor.r, m_clearColor.g, m_clearColor.b, m_clearColor.a );
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue