feat(webgl): Wire up WEBGL_GAL test harness with proper canvas setup

- Add wasm_stubs.cpp with WASM-specific stub implementations for
  COLOR4D::BLACK/WHITE, GLU tesselator, PGM_BASE, and other KiCad
  dependencies
- Update Makefile to include KiCad sources (GAL base class, display
  options, HiDPI canvas) and test scenarios
- Fix kiglew.h to define GLEW guard (__glew_h__) preventing conflicts
  with Emscripten's GLEW header
- Update test HTML to create canvas before module load (MODULARIZE
  requires passing canvas in Module config, not preRun)
- Update Playwright tests to find canvas elements correctly
- Add #window-container for wxWidgets GL canvas support

Build produces 8.4MB WASM with full WEBGL_GAL implementation.
Tests pass but rendering still shows dark output (debugging in progress).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2026-01-07 21:32:53 +01:00
commit c23bc974be
7 changed files with 747 additions and 180 deletions

View file

@ -32,6 +32,12 @@
#include <wx/platform.h>
#if defined( __EMSCRIPTEN__ )
// Prevent real GLEW header from being included (Emscripten has one too)
// We provide our own compatibility stubs below
#ifndef __glew_h__
#define __glew_h__
#endif
// WebGL2/GLES3: Modern shader functions (glUseProgram, etc.)
#include <GLES3/gl3.h>
// Legacy GL emulation: glMatrixMode, glColor4d, glBegin/glEnd, etc.