X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=glxwrap.c;h=7b90ceb4008d2d98976ce3645a352d901c3eeb8d;hb=refs%2Fheads%2Fframe-timings;hp=d7d4191ce528ae5b59c5f8a9317b8e99a179d679;hpb=e3e2309eccbd742a868986e8bef75db48510155d;p=fips diff --git a/glxwrap.c b/glxwrap.c index d7d4191..7b90ceb 100644 --- a/glxwrap.c +++ b/glxwrap.c @@ -27,6 +27,7 @@ #include #include +#include "context.h" #include "dlwrap.h" #include "glwrap.h" #include "metrics.h" @@ -34,9 +35,11 @@ void glXSwapBuffers (Display *dpy, GLXDrawable drawable) { + context_end_frame_pre_swap (); + GLWRAP_DEFER (glXSwapBuffers, dpy, drawable); - metrics_end_frame (); + context_end_frame_post_swap (); } /* glXGetProcAddressARB is a function which accepts a string and @@ -47,10 +50,14 @@ glXSwapBuffers (Display *dpy, GLXDrawable drawable) */ void (*glXGetProcAddressARB (const GLubyte *func))(void) { + static void *libfips_handle = NULL; void *ret; + if (libfips_handle == NULL) + libfips_handle = dlwrap_dlopen_libfips (); + /* If our library has this symbol, that's what we want to give. */ - ret = dlwrap_real_dlsym (NULL, (const char *) func); + ret = dlwrap_real_dlsym (libfips_handle, (const char *) func); if (ret) return ret; @@ -76,9 +83,25 @@ glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx) { Bool ret; - fips_dispatch_init (FIPS_API_GLX); + context_leave (); GLWRAP_DEFER_WITH_RETURN (ret, glXMakeCurrent, dpy, drawable, ctx); + context_enter (FIPS_API_GLX, ctx); + + return ret; +} + +Bool +glXMakeContextCurrent (Display *dpy, GLXDrawable drawable, GLXDrawable read, GLXContext ctx) +{ + Bool ret; + + context_leave (); + + GLWRAP_DEFER_WITH_RETURN (ret, glXMakeContextCurrent, dpy, drawable, read, ctx); + + context_enter (FIPS_API_GLX, ctx); + return ret; }