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>
66 lines
1.9 KiB
C++
66 lines
1.9 KiB
C++
// Stub trace_helpers.h for native GAL test
|
|
// Provides simplified TRACE_MANAGER that doesn't use wxWidgets macros
|
|
|
|
#ifndef TRACE_HELPERS_H_STUB
|
|
#define TRACE_HELPERS_H_STUB
|
|
|
|
#include <wx/wx.h>
|
|
#include <map>
|
|
#include <cstdarg>
|
|
|
|
// Forward declaration
|
|
class wxArrayString;
|
|
|
|
// Trace channel names (extern declarations)
|
|
extern const wxString traceGalProfile;
|
|
extern const wxString traceOpenGL;
|
|
extern const wxString traceGalCachedContainer;
|
|
extern const wxString traceShader;
|
|
|
|
// Definitions
|
|
inline const wxString traceGalProfile = "KICAD_GAL_PROFILE";
|
|
inline const wxString traceOpenGL = "KICAD_OPENGL";
|
|
inline const wxString traceGalCachedContainer = "KICAD_GAL_CACHED_CONTAINER";
|
|
inline const wxString traceShader = "KICAD_SHADER";
|
|
|
|
// TRACE_MANAGER - simplified stub
|
|
class TRACE_MANAGER {
|
|
public:
|
|
TRACE_MANAGER() : m_globalTraceEnabled(false), m_printAllTraces(false) {}
|
|
~TRACE_MANAGER() {}
|
|
|
|
static TRACE_MANAGER& Instance() {
|
|
static TRACE_MANAGER instance;
|
|
return instance;
|
|
}
|
|
|
|
// Trace methods - variadic template version
|
|
template<typename... Args>
|
|
void Trace(const wxString&, Args...) {
|
|
// No-op - tracing disabled for test
|
|
}
|
|
|
|
// wxWidgets-style methods for compatibility
|
|
void DoTrace(const wxString&, const char*, ...) {}
|
|
void DoTraceUtf8(const wxString&, const char*, ...) {}
|
|
|
|
bool IsTraceEnabled(const wxString&) const {
|
|
return false; // Always disabled for test
|
|
}
|
|
|
|
private:
|
|
std::map<wxString, bool> m_enabledTraces;
|
|
bool m_globalTraceEnabled;
|
|
bool m_printAllTraces;
|
|
};
|
|
|
|
// KI_TRACE macro - no-op since IsTraceEnabled always returns false
|
|
#define KI_TRACE(aWhat, ...) \
|
|
if (TRACE_MANAGER::Instance().IsTraceEnabled(aWhat)) { \
|
|
TRACE_MANAGER::Instance().Trace(aWhat, __VA_ARGS__); \
|
|
}
|
|
|
|
// Dump function stub
|
|
inline wxString dump(const wxArrayString&) { return wxString(); }
|
|
|
|
#endif // TRACE_HELPERS_H_STUB
|