#ifdef GLX_USE_APPLEGL
#include <pthread.h>
-#include "apple_glx_drawable.h"
+#include "apple/apple_glx_drawable.h"
#endif
#include "glx_error.h"
struct glx_display *priv = __glXInitialize(dpy);
#ifdef GLX_DIRECT_RENDERING
__GLXDRIdrawable *pdraw;
+ int i;
#endif
CARD32 *output;
CARD8 opcode;
- int i;
if ((priv == NULL) || (dpy == NULL) || (drawable == 0)) {
return;
* 10. Given that, this routine should try to use an array on the stack to
* capture the reply rather than always calling Xmalloc.
*/
-static int
-GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
- int attribute, unsigned int *value)
+int
+__glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
+ int attribute, unsigned int *value)
{
struct glx_display *priv;
xGLXGetDrawableAttributesReply reply;
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;
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 == &dummyContext || 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) {
_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
UnlockDisplay(dpy);
SyncHandle();
- return 0;
+ return 1;
}
static void
/**
* Create a new pbuffer.
*/
-_X_EXPORT GLXPbufferSGIX
+_GLX_PUBLIC GLXPbufferSGIX
glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config,
unsigned int width, unsigned int height,
int *attrib_list)
/**
* Create a new pbuffer.
*/
-_X_EXPORT GLXPbuffer
+_GLX_PUBLIC GLXPbuffer
glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
{
int i, width, height;
/**
* Destroy an existing pbuffer.
*/
-_X_EXPORT void
+_GLX_PUBLIC void
glXDestroyPbuffer(Display * dpy, GLXPbuffer pbuf)
{
#ifdef GLX_USE_APPLEGL
/**
* Query an attribute of a drawable.
*/
-_X_EXPORT void
+_GLX_PUBLIC void
glXQueryDrawable(Display * dpy, GLXDrawable drawable,
int attribute, unsigned int *value)
{
}
}
#else
- GetDrawableAttribute(dpy, drawable, attribute, value);
+ __glXGetDrawableAttribute(dpy, drawable, attribute, value);
#endif
}
/**
* Query an attribute of a pbuffer.
*/
-_X_EXPORT int
+_GLX_PUBLIC void
glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
int attribute, unsigned int *value)
{
- return GetDrawableAttribute(dpy, drawable, attribute, value);
+ __glXGetDrawableAttribute(dpy, drawable, attribute, value);
}
#endif
/**
* Select the event mask for a drawable.
*/
-_X_EXPORT void
+_GLX_PUBLIC void
glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask)
{
#ifdef GLX_USE_APPLEGL
/**
* Get the selected event mask for a drawable.
*/
-_X_EXPORT void
+_GLX_PUBLIC void
glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask)
{
#ifdef GLX_USE_APPLEGL
__glXSendError(dpy, GLXBadDrawable, drawable, X_GLXGetDrawableAttributes,
true);
#else
- unsigned int value;
+ unsigned int value = 0;
/* The non-sense with value is required because on LP64 platforms
* we could just type-cast the pointer, but why?
*/
- GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
+ __glXGetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
*mask = value;
#endif
}
-_X_EXPORT GLXPixmap
+_GLX_PUBLIC GLXPixmap
glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
const int *attrib_list)
{
}
-_X_EXPORT GLXWindow
+_GLX_PUBLIC GLXWindow
glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
const int *attrib_list)
{
}
-_X_EXPORT void
+_GLX_PUBLIC void
glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
{
WARN_ONCE_GLX_1_3(dpy, __func__);
}
-_X_EXPORT void
+_GLX_PUBLIC void
glXDestroyWindow(Display * dpy, GLXWindow win)
{
WARN_ONCE_GLX_1_3(dpy, __func__);
#endif
}
-#ifndef GLX_USE_APPLEGL
-_X_EXPORT
+_GLX_PUBLIC
GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
(Display * dpy, GLXPbufferSGIX pbuf),
(dpy, pbuf), glXDestroyPbuffer)
-_X_EXPORT
+_GLX_PUBLIC
GLX_ALIAS_VOID(glXSelectEventSGIX,
(Display * dpy, GLXDrawable drawable,
unsigned long mask), (dpy, drawable, mask), glXSelectEvent)
-_X_EXPORT
+_GLX_PUBLIC
GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
(Display * dpy, GLXDrawable drawable,
unsigned long *mask), (dpy, drawable, mask),
glXGetSelectedEvent)
-#endif