*
**************************************************************************/
-/*
- * Abstraction for GL window system specific APIs (GLX, WGL).
- */
-
#ifndef _GLRETRACE_HPP_
#define _GLRETRACE_HPP_
+#include "trace_parser.hpp"
+#include "glws.hpp"
+#include "retrace.hpp"
-namespace glretrace {
-
-
-class Visual
-{
-public:
- unsigned long redMask;
- unsigned long greenMask;
- unsigned long blueMask;
- unsigned long alphaMask;
- bool doubleBuffer;
-
- virtual ~Visual() {}
-};
-
-
-class Drawable
-{
-public:
- const Visual *visual;
- unsigned width;
- unsigned height;
-
- Drawable(const Visual *vis) :
- visual(vis)
- {}
- virtual ~Drawable() {}
-
- virtual void
- resize(unsigned w, unsigned h) {
- width = w;
- height = h;
- }
-
- virtual void swapBuffers(void) = 0;
-};
-
-
-class Context
-{
-public:
- const Visual *visual;
-
- Context(const Visual *vis) :
- visual(vis)
- {}
-
- virtual ~Context() {}
-};
-
-
-class WindowSystem
-{
-public:
- Drawable *currentDrawable;
- Context *currentContext;
+namespace glretrace {
- inline WindowSystem() :
- currentDrawable(NULL),
- currentContext(NULL)
- {}
+extern bool double_buffer;
+extern bool insideGlBeginEnd;
+extern trace::Parser parser;
+extern glws::Profile defaultProfile;
+extern glws::Visual *visual[glws::PROFILE_MAX];
+extern glws::Drawable *drawable;
+extern glws::Context *context;
- virtual ~WindowSystem() {}
+extern unsigned frame;
+extern long long startTime;
+extern bool wait;
- virtual Visual *
- createVisual(bool doubleBuffer=false) = 0;
-
- virtual Drawable *
- createDrawable(const Visual *visual) = 0;
+extern bool benchmark;
- virtual Context *
- createContext(const Visual *visual) = 0;
-
- virtual bool
- makeCurrent(Drawable *drawable, Context *context) = 0;
+extern unsigned dump_state;
- virtual bool
- processEvents(void) = 0;
-};
+void
+checkGlError(trace::Call &call);
+extern const retrace::Entry gl_callbacks[];
+extern const retrace::Entry cgl_callbacks[];
+extern const retrace::Entry glx_callbacks[];
+extern const retrace::Entry wgl_callbacks[];
+extern const retrace::Entry egl_callbacks[];
-WindowSystem *createNativeWindowSystem(void);
+void frame_complete(trace::Call &call);
+void updateDrawable(int width, int height);
} /* namespace glretrace */