feat(webgl): Add GAL native test harness for visual regression testing
Add a standalone test application that compiles KiCad's actual OPENGL_GAL
against system wxWidgets to generate baseline screenshots for comparing
native OpenGL rendering against WebGL rendering in the browser.
Architecture:
- Compiles 18 KiCad GAL source files from the kicad submodule
- Uses template-based private member accessor (safer than #define private public)
- Generates shader C++ files from GLSL (10 shader pairs for SMAA AA)
- Minimal stubs for KiCad dependencies (PGM_BASE, ADVANCED_CFG, etc.)
Test coverage:
- 11 scenarios testing ~19% of GAL API
- basic-lines, line-widths, circles, arcs, rectangles, polygons
- alpha-blending, transforms, grid-cursor, segments, complex-scene
Key insights documented:
- GAL uses world-to-screen transformation requiring 1:1 pixel mapping
- FBO reading required for clean screenshots on macOS
- Layer depth needed for proper z-ordering in complex scenes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 09:42:31 +01:00
|
|
|
/**
|
|
|
|
|
* GAL Test Accessor
|
|
|
|
|
*
|
|
|
|
|
* Provides access to OPENGL_GAL internal members for testing purposes.
|
|
|
|
|
* This uses a technique to access private members without modifying KiCad headers.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef GAL_TEST_ACCESSOR_H
|
|
|
|
|
#define GAL_TEST_ACCESSOR_H
|
|
|
|
|
|
|
|
|
|
#include <GL/glew.h>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
// Forward declarations
|
|
|
|
|
namespace KIGFX {
|
|
|
|
|
class OPENGL_GAL;
|
|
|
|
|
class OPENGL_COMPOSITOR;
|
2026-01-07 13:37:08 +01:00
|
|
|
class SHADER;
|
feat(webgl): Add GAL native test harness for visual regression testing
Add a standalone test application that compiles KiCad's actual OPENGL_GAL
against system wxWidgets to generate baseline screenshots for comparing
native OpenGL rendering against WebGL rendering in the browser.
Architecture:
- Compiles 18 KiCad GAL source files from the kicad submodule
- Uses template-based private member accessor (safer than #define private public)
- Generates shader C++ files from GLSL (10 shader pairs for SMAA AA)
- Minimal stubs for KiCad dependencies (PGM_BASE, ADVANCED_CFG, etc.)
Test coverage:
- 11 scenarios testing ~19% of GAL API
- basic-lines, line-widths, circles, arcs, rectangles, polygons
- alpha-blending, transforms, grid-cursor, segments, complex-scene
Key insights documented:
- GAL uses world-to-screen transformation requiring 1:1 pixel mapping
- FBO reading required for clean screenshots on macOS
- Layer depth needed for proper z-ordering in complex scenes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 09:42:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Test accessor functions - implemented in gal_test_accessor.cpp
|
|
|
|
|
GLuint GetCompositorMainBufferTexture(KIGFX::OPENGL_GAL* gal);
|
|
|
|
|
void GetCompositorBufferSize(KIGFX::OPENGL_GAL* gal, int* width, int* height);
|
|
|
|
|
GLuint GetCompositorMainFBO(KIGFX::OPENGL_GAL* gal);
|
|
|
|
|
unsigned int GetMainBufferHandle(KIGFX::OPENGL_GAL* gal);
|
|
|
|
|
|
|
|
|
|
// Read pixels directly from the compositor's FBO
|
|
|
|
|
bool ReadCompositorFBOPixels(KIGFX::OPENGL_GAL* gal, std::vector<uint8_t>& pixels, int* width, int* height);
|
|
|
|
|
|
2026-01-07 13:37:08 +01:00
|
|
|
// Get the shader pointer for deactivating before fixed-function rendering (DrawBitmap)
|
|
|
|
|
KIGFX::SHADER* GetGALShader(KIGFX::OPENGL_GAL* gal);
|
|
|
|
|
|
|
|
|
|
// Deactivate shader to allow fixed-function pipeline (glBegin/glEnd) rendering
|
|
|
|
|
void DeactivateGALShader(KIGFX::OPENGL_GAL* gal);
|
|
|
|
|
|
|
|
|
|
// Reactivate shader after fixed-function rendering
|
|
|
|
|
void ActivateGALShader(KIGFX::OPENGL_GAL* gal);
|
|
|
|
|
|
feat(webgl): Add GAL native test harness for visual regression testing
Add a standalone test application that compiles KiCad's actual OPENGL_GAL
against system wxWidgets to generate baseline screenshots for comparing
native OpenGL rendering against WebGL rendering in the browser.
Architecture:
- Compiles 18 KiCad GAL source files from the kicad submodule
- Uses template-based private member accessor (safer than #define private public)
- Generates shader C++ files from GLSL (10 shader pairs for SMAA AA)
- Minimal stubs for KiCad dependencies (PGM_BASE, ADVANCED_CFG, etc.)
Test coverage:
- 11 scenarios testing ~19% of GAL API
- basic-lines, line-widths, circles, arcs, rectangles, polygons
- alpha-blending, transforms, grid-cursor, segments, complex-scene
Key insights documented:
- GAL uses world-to-screen transformation requiring 1:1 pixel mapping
- FBO reading required for clean screenshots on macOS
- Layer depth needed for proper z-ordering in complex scenes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 09:42:31 +01:00
|
|
|
#endif // GAL_TEST_ACCESSOR_H
|