X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fglretrace.hpp;h=95a6d7596df230e8dd059194c493bbf58055cad3;hb=eb216e6bd676535a5668bf8c389433c657f51aad;hp=8ba2a80edd477b8e2b418f0c21bfb76b57aace32;hpb=9d27a54b0381610c30964880a5fdd4c27bb6e732;p=apitrace diff --git a/retrace/glretrace.hpp b/retrace/glretrace.hpp index 8ba2a80..95a6d75 100644 --- a/retrace/glretrace.hpp +++ b/retrace/glretrace.hpp @@ -32,21 +32,62 @@ namespace glretrace { - -extern bool double_buffer; +struct Context { + Context(glws::Context* context) + : wsContext(context), + drawable(0), + activeProgram(0), + used(false) + { + } + + ~Context(); + + glws::Context* wsContext; + + // Bound drawable + glws::Drawable *drawable; + + GLuint activeProgram; + bool used; + + // Context must be current + inline bool + hasExtension(const char *extension) const { + return wsContext->hasExtension(extension); + } +}; + +extern bool insideList; 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; -extern bool benchmark; +Context * +getCurrentContext(void); + + +int +parseAttrib(const trace::Value *attribs, int param, int default_); + + +glws::Drawable * +createDrawable(glws::Profile profile); + +glws::Drawable * +createDrawable(void); + +glws::Drawable * +createPbuffer(int width, int height); + +Context * +createContext(Context *shareContext, glws::Profile profile); + +Context * +createContext(Context *shareContext = 0); + +bool +makeCurrent(trace::Call &call, glws::Drawable *drawable, Context *context); -extern unsigned dump_state; void checkGlError(trace::Call &call); @@ -58,9 +99,15 @@ extern const retrace::Entry wgl_callbacks[]; extern const retrace::Entry egl_callbacks[]; void frame_complete(trace::Call &call); +void initContext(); + void updateDrawable(int width, int height); +void flushQueries(); +void beginProfile(trace::Call &call, bool isDraw); +void endProfile(trace::Call &call, bool isDraw); + } /* namespace glretrace */