]> git.cworth.org Git - fips/blobdiff - glxwrap.c
Add collection of (AMD_performance_monitor) performance counters to fips
[fips] / glxwrap.c
index d7d4191ce528ae5b59c5f8a9317b8e99a179d679..9a28d7d0f231cb395b818ceadee564e1a3767cca 100644 (file)
--- a/glxwrap.c
+++ b/glxwrap.c
@@ -36,7 +36,11 @@ glXSwapBuffers (Display *dpy, GLXDrawable drawable)
 {
        GLWRAP_DEFER (glXSwapBuffers, dpy, drawable);
 
+       metrics_counter_stop ();
+
        metrics_end_frame ();
+
+       metrics_counter_start ();
 }
 
 /* glXGetProcAddressARB is a function which accepts a string and
@@ -47,10 +51,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;
 
@@ -80,5 +88,27 @@ glXMakeCurrent (Display *dpy, GLXDrawable drawable, GLXContext ctx)
 
        GLWRAP_DEFER_WITH_RETURN (ret, glXMakeCurrent, dpy, drawable, ctx);
 
+       metrics_info_init ();
+
+       metrics_set_current_op (METRICS_OP_SHADER + 0);
+       metrics_counter_start ();
+
+       return ret;
+}
+
+Bool
+glXMakeContextCurrent (Display *dpy, GLXDrawable drawable, GLXDrawable read, GLXContext ctx)
+{
+       Bool ret;
+
+       fips_dispatch_init (FIPS_API_GLX);
+
+       GLWRAP_DEFER_WITH_RETURN (ret, glXMakeContextCurrent, dpy, drawable, read, ctx);
+
+       metrics_info_init ();
+
+       metrics_set_current_op (METRICS_OP_SHADER + 0);
+       metrics_counter_start ();
+
        return ret;
 }