glsl: rename function that processes struct and iface members
[mesa.git] / src / glx / glx_pbuffer.c
index 978730cecb32a0121f6eb591f5c0235cfbafe0ad..231ab206045e28168a4c2a27d7af768c613e6101 100644 (file)
@@ -39,7 +39,7 @@
 
 #ifdef GLX_USE_APPLEGL
 #include <pthread.h>
-#include "apple_glx_drawable.h"
+#include "apple/apple_glx_drawable.h"
 #endif
 
 #include "glx_error.h"
@@ -285,6 +285,10 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
    unsigned int num_attributes;
    GLboolean use_glx_1_3;
 
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+   __GLXDRIdrawable *pdraw;
+#endif
+
    if (dpy == NULL)
       return 0;
 
@@ -311,6 +315,36 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
    if (!opcode)
       return 0;
 
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
+   pdraw = GetGLXDRIDrawable(dpy, drawable);
+
+   if (attribute == GLX_BACK_BUFFER_AGE_EXT) {
+      struct glx_context *gc = __glXGetCurrentContext();
+      struct glx_screen *psc;
+
+      /* The GLX_EXT_buffer_age spec says:
+       *
+       *   "If querying GLX_BACK_BUFFER_AGE_EXT and <draw> is not bound to
+       *   the calling thread's current context a GLXBadDrawable error is
+       *   generated."
+       */
+      if (pdraw == NULL || gc == NULL || gc->currentDpy != dpy ||
+         (gc->currentDrawable != drawable &&
+         gc->currentReadable != drawable)) {
+         __glXSendError(dpy, GLXBadDrawable, drawable,
+                        X_GLXGetDrawableAttributes, false);
+         return 0;
+      }
+
+      psc = pdraw->psc;
+
+      if (psc->driScreen->getBufferAge != NULL)
+         *value = psc->driScreen->getBufferAge(pdraw);
+
+      return 0;
+   }
+#endif
+
    LockDisplay(dpy);
 
    if (use_glx_1_3) {
@@ -350,9 +384,6 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
          _XEatData(dpy, length);
       }
       else {
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
-         __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
-#endif
          _XRead(dpy, (char *) data, length * sizeof(CARD32));
 
          /* Search the set of returned attributes for the attribute requested by