*
**************************************************************************/
-/*
- * Abstraction for GL window system specific APIs (GLX, WGL).
- */
-
#ifndef _GLRETRACE_HPP_
#define _GLRETRACE_HPP_
+#include "trace_parser.hpp"
+#include "glws.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;
- }
+namespace glretrace {
- virtual void swapBuffers(void) = 0;
-};
+extern bool double_buffer;
+extern bool insideGlBeginEnd;
+extern Trace::Parser parser;
+extern glws::WindowSystem *ws;
+extern glws::Visual *visual;
+extern glws::Drawable *drawable;
+extern glws::Context *context;
-class Context
-{
-public:
- const Visual *visual;
-
- Context(const Visual *vis) :
- visual(vis)
- {}
+extern unsigned frame;
+extern long long startTime;
+extern bool wait;
- virtual ~Context() {}
+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() {}
-
- virtual Visual *
- createVisual(bool doubleBuffer=false) = 0;
-
- virtual Drawable *
- createDrawable(const Visual *visual) = 0;
-
- virtual Context *
- createContext(const Visual *visual) = 0;
-
- virtual bool
- makeCurrent(Drawable *drawable, Context *context) = 0;
-
- virtual bool
- processEvents(void) = 0;
-};
+void
+checkGlError(Trace::Call &call);
+void retrace_call_cgl(Trace::Call &call);
+void retrace_call_glx(Trace::Call &call);
+void retrace_call_wgl(Trace::Call &call);
-WindowSystem *createNativeWindowSystem(void);
+void snapshot(unsigned call_no);
+void frame_complete(unsigned call_no);
} /* namespace glretrace */