]> git.cworth.org Git - apitrace/blobdiff - glretrace.hpp
D3D retrace checkpoint.
[apitrace] / glretrace.hpp
index a56606c5a89ab9a87cc37ae0487147d57ea308b2..f7d244fa36290cf75e155d9e549ee1eb027de5ab 100644 (file)
  *
  **************************************************************************/
 
-/*
- * Abstraction for GL window system specific APIs (GLX, WGL).
- */
-
 #ifndef _GLRETRACE_HPP_
 #define _GLRETRACE_HPP_
 
-
-namespace glretrace {
+#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 glws::Profile defaultProfile;
+extern glws::Visual *visual[glws::PROFILE_MAX];
+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[];
+extern const retrace::Entry egl_callbacks[];
 
-WindowSystem *createNativeWindowSystem(void);
+void snapshot(unsigned call_no);
+void frame_complete(trace::Call &call);
 
+void updateDrawable(int width, int height);
 
 } /* namespace glretrace */