*
**************************************************************************/
-/*
- * Abstraction for GL window system specific APIs (GLX, WGL).
- */
-
#ifndef _GLRETRACE_HPP_
#define _GLRETRACE_HPP_
-
-namespace glretrace {
+#include "trace_parser.hpp"
+#include "glws.hpp"
+#include "retrace.hpp"
-struct Visual
-{
- unsigned long redMask;
- unsigned long greenMask;
- unsigned long blueMask;
- unsigned long alphaMask;
- bool doubleBuffer;
-};
+namespace glretrace {
-struct Context
-{
- const Visual *visual;
-};
+extern bool double_buffer;
+extern bool insideGlBeginEnd;
+extern Trace::Parser parser;
+extern glws::Visual *visual;
+extern glws::Drawable *drawable;
+extern glws::Context *context;
+extern unsigned frame;
+extern long long startTime;
+extern bool wait;
-struct Drawable
-{
- unsigned width;
- unsigned height;
+enum frequency {
+ FREQUENCY_NEVER = 0,
+ FREQUENCY_FRAME,
+ FREQUENCY_FRAMEBUFFER,
+ FREQUENCY_DRAW,
};
+extern bool benchmark;
+extern const char *compare_prefix;
+extern const char *snapshot_prefix;
+extern enum frequency snapshot_frequency;
-class WindowSystem
-{
-public:
- Drawable *currentDrawable;
- Context *currentContext;
-
-
- inline WindowSystem() :
- currentDrawable(NULL),
- currentContext(NULL)
- {}
+extern unsigned dump_state;
- virtual ~WindowSystem() {}
-
- //
- // Drawables
- //
-
- virtual Drawable *
- createDrawable(unsigned width = 0, unsigned height = 0) = 0;
-
- virtual void
- resizeDrawable(Drawable *drawable, unsigned width, unsigned height) = 0;
-
- virtual Void *
- destroyDrawable(void) = 0;
-
- //
- // Contexts
- //
-
- virtual Context *
- createContext(const Visual *visual) = 0;
-
- virtual void
- deleteContext(Context *) = 0;
-
- virtual bool
- makeCurrent(Drawable *drawable, Context *context) = 0;
-
- 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[];
-WindowSystem *createNativeWindowSystem(void);
+void snapshot(unsigned call_no);
+void frame_complete(Trace::Call &call);
+void updateDrawable(int width, int height);
} /* namespace glretrace */