[Xquartz-changes] [385] AppleSGLX/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 21 12:27:04 PST 2009


Revision: 385
          http://trac.macosforge.org/projects/xquartz/changeset/385
Author:   jeremyhu at freedesktop.org
Date:     2009-12-21 12:27:02 -0800 (Mon, 21 Dec 2009)
Log Message:
-----------
Partial rebase against mesa master

Modified Paths:
--------------
    AppleSGLX/trunk/compsize.c
    AppleSGLX/trunk/glcontextmodes.c
    AppleSGLX/trunk/glx_pbuffer.c
    AppleSGLX/trunk/glx_query.c
    AppleSGLX/trunk/include/GL/glx.h
    AppleSGLX/trunk/include/GL/glxext.h
    AppleSGLX/trunk/include/GL/internal/glcore.h

Modified: AppleSGLX/trunk/compsize.c
===================================================================
--- AppleSGLX/trunk/compsize.c	2009-12-18 07:07:49 UTC (rev 384)
+++ AppleSGLX/trunk/compsize.c	2009-12-21 20:27:02 UTC (rev 385)
@@ -29,156 +29,164 @@
  */
 
 #include <GL/gl.h>
+#ifndef __APPLE__
+#include "indirect_size.h"
+#endif
 #include "glxclient.h"
 
 /*
 ** Return the number of elements per group of a specified format
 */
-GLint __glElementsPerGroup(GLenum format, GLenum type) 
+GLint
+__glElementsPerGroup(GLenum format, GLenum type)
 {
-    /*
+   /*
     ** To make row length computation valid for image extraction,
     ** packed pixel types assume elements per group equals one.
     */
-    switch(type) {
-    case GL_UNSIGNED_BYTE_3_3_2:
-    case GL_UNSIGNED_BYTE_2_3_3_REV:
-    case GL_UNSIGNED_SHORT_5_6_5:
-    case GL_UNSIGNED_SHORT_5_6_5_REV:
-    case GL_UNSIGNED_SHORT_4_4_4_4:
-    case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-    case GL_UNSIGNED_SHORT_5_5_5_1:
-    case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-	//case GL_UNSIGNED_SHORT_8_8_APPLE:
-	//case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
-	//case GL_UNSIGNED_SHORT_15_1_MESA:
-	// case GL_UNSIGNED_SHORT_1_15_REV_MESA:
-    case GL_UNSIGNED_INT_8_8_8_8:
-    case GL_UNSIGNED_INT_8_8_8_8_REV:
-    case GL_UNSIGNED_INT_10_10_10_2:
-    case GL_UNSIGNED_INT_2_10_10_10_REV:
-	//  case GL_UNSIGNED_INT_24_8_NV:
-	//case GL_UNSIGNED_INT_24_8_MESA:
-	// case GL_UNSIGNED_INT_8_24_REV_MESA:
+   switch (type) {
+   case GL_UNSIGNED_BYTE_3_3_2:
+   case GL_UNSIGNED_BYTE_2_3_3_REV:
+   case GL_UNSIGNED_SHORT_5_6_5:
+   case GL_UNSIGNED_SHORT_5_6_5_REV:
+   case GL_UNSIGNED_SHORT_4_4_4_4:
+   case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+   case GL_UNSIGNED_SHORT_5_5_5_1:
+   case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+   case GL_UNSIGNED_SHORT_8_8_APPLE:
+   case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+   case GL_UNSIGNED_SHORT_15_1_MESA:
+   case GL_UNSIGNED_SHORT_1_15_REV_MESA:
+   case GL_UNSIGNED_INT_8_8_8_8:
+   case GL_UNSIGNED_INT_8_8_8_8_REV:
+   case GL_UNSIGNED_INT_10_10_10_2:
+   case GL_UNSIGNED_INT_2_10_10_10_REV:
+   case GL_UNSIGNED_INT_24_8_NV:
+   case GL_UNSIGNED_INT_24_8_MESA:
+   case GL_UNSIGNED_INT_8_24_REV_MESA:
       return 1;
-    default:
+   default:
       break;
-    }
+   }
 
-    switch(format) {
-      case GL_RGB:
-      case GL_BGR:
-	return 3;
-	//case GL_422_EXT:
-	//case GL_422_REV_EXT:
-	//case GL_422_AVERAGE_EXT:
-	//case GL_422_REV_AVERAGE_EXT:
-	//case GL_YCBCR_422_APPLE:
-      case GL_LUMINANCE_ALPHA:
-	return 2;
-      case GL_RGBA:
-      case GL_BGRA:
-	  //case GL_ABGR_EXT:
-	return 4;
-      case GL_COLOR_INDEX:
-      case GL_STENCIL_INDEX:
-      case GL_DEPTH_COMPONENT:
-      case GL_RED:
-      case GL_GREEN:
-      case GL_BLUE:
-      case GL_ALPHA:
-      case GL_LUMINANCE:
-      case GL_INTENSITY:
-	return 1;
-      default:
-	return 0;
-    }
+   switch (format) {
+   case GL_RGB:
+   case GL_BGR:
+      return 3;
+   case GL_422_EXT:
+   case GL_422_REV_EXT:
+   case GL_422_AVERAGE_EXT:
+   case GL_422_REV_AVERAGE_EXT:
+   case GL_YCBCR_422_APPLE:
+   case GL_LUMINANCE_ALPHA:
+      return 2;
+   case GL_RGBA:
+   case GL_BGRA:
+   case GL_ABGR_EXT:
+      return 4;
+   case GL_COLOR_INDEX:
+   case GL_STENCIL_INDEX:
+   case GL_DEPTH_COMPONENT:
+   case GL_RED:
+   case GL_GREEN:
+   case GL_BLUE:
+   case GL_ALPHA:
+   case GL_LUMINANCE:
+   case GL_INTENSITY:
+      return 1;
+   default:
+      return 0;
+   }
 }
 
 /*
 ** Return the number of bytes per element, based on the element type (other
 ** than GL_BITMAP).
 */
-GLint __glBytesPerElement(GLenum type) 
+GLint
+__glBytesPerElement(GLenum type)
 {
-    switch(type) {
-      case GL_UNSIGNED_SHORT:
-      case GL_SHORT:
-      case GL_UNSIGNED_SHORT_5_6_5:
-      case GL_UNSIGNED_SHORT_5_6_5_REV:
-      case GL_UNSIGNED_SHORT_4_4_4_4:
-      case GL_UNSIGNED_SHORT_4_4_4_4_REV:
-      case GL_UNSIGNED_SHORT_5_5_5_1:
-      case GL_UNSIGNED_SHORT_1_5_5_5_REV:
-	  //case GL_UNSIGNED_SHORT_8_8_APPLE:
-	  //case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
-	  //case GL_UNSIGNED_SHORT_15_1_MESA:
-	  //case GL_UNSIGNED_SHORT_1_15_REV_MESA:
-	return 2;
-      case GL_UNSIGNED_BYTE:
-      case GL_BYTE:
-      case GL_UNSIGNED_BYTE_3_3_2:
-      case GL_UNSIGNED_BYTE_2_3_3_REV:
-	return 1;
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-      case GL_FLOAT:
-      case GL_UNSIGNED_INT_8_8_8_8:
-      case GL_UNSIGNED_INT_8_8_8_8_REV:
-      case GL_UNSIGNED_INT_10_10_10_2:
-      case GL_UNSIGNED_INT_2_10_10_10_REV:
-	  //case GL_UNSIGNED_INT_24_8_NV:
-	  //case GL_UNSIGNED_INT_24_8_MESA:
-	  //case GL_UNSIGNED_INT_8_24_REV_MESA:
-	return 4;
-      default:
-	return 0;
-    }
+   switch (type) {
+   case GL_UNSIGNED_SHORT:
+   case GL_SHORT:
+   case GL_UNSIGNED_SHORT_5_6_5:
+   case GL_UNSIGNED_SHORT_5_6_5_REV:
+   case GL_UNSIGNED_SHORT_4_4_4_4:
+   case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+   case GL_UNSIGNED_SHORT_5_5_5_1:
+   case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+   case GL_UNSIGNED_SHORT_8_8_APPLE:
+   case GL_UNSIGNED_SHORT_8_8_REV_APPLE:
+   case GL_UNSIGNED_SHORT_15_1_MESA:
+   case GL_UNSIGNED_SHORT_1_15_REV_MESA:
+      return 2;
+   case GL_UNSIGNED_BYTE:
+   case GL_BYTE:
+   case GL_UNSIGNED_BYTE_3_3_2:
+   case GL_UNSIGNED_BYTE_2_3_3_REV:
+      return 1;
+   case GL_INT:
+   case GL_UNSIGNED_INT:
+   case GL_FLOAT:
+   case GL_UNSIGNED_INT_8_8_8_8:
+   case GL_UNSIGNED_INT_8_8_8_8_REV:
+   case GL_UNSIGNED_INT_10_10_10_2:
+   case GL_UNSIGNED_INT_2_10_10_10_REV:
+   case GL_UNSIGNED_INT_24_8_NV:
+   case GL_UNSIGNED_INT_24_8_MESA:
+   case GL_UNSIGNED_INT_8_24_REV_MESA:
+      return 4;
+   default:
+      return 0;
+   }
 }
 
 /*
 ** Compute memory required for internal packed array of data of given type
 ** and format.
 */
-GLint __glImageSize(GLsizei width, GLsizei height, GLsizei depth,
-		    GLenum format, GLenum type, GLenum target)
+GLint
+__glImageSize(GLsizei width, GLsizei height, GLsizei depth,
+              GLenum format, GLenum type, GLenum target)
 {
-    int bytes_per_row;
-    int components;
+   int bytes_per_row;
+   int components;
 
-    switch( target ) {
-    case GL_PROXY_TEXTURE_1D:
-    case GL_PROXY_TEXTURE_2D:
-    case GL_PROXY_TEXTURE_3D:
-	//case GL_PROXY_TEXTURE_4D_SGIS:
-    case GL_PROXY_TEXTURE_CUBE_MAP:
-	//case GL_PROXY_TEXTURE_RECTANGLE_ARB:
-    case GL_PROXY_HISTOGRAM:
-    case GL_PROXY_COLOR_TABLE:
-	//case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
-    case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
-    case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
-	//case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP:
-	return 0;
-    }
+   switch (target) {
+   case GL_PROXY_TEXTURE_1D:
+   case GL_PROXY_TEXTURE_2D:
+   case GL_PROXY_TEXTURE_3D:
+   case GL_PROXY_TEXTURE_4D_SGIS:
+   case GL_PROXY_TEXTURE_CUBE_MAP:
+   case GL_PROXY_TEXTURE_RECTANGLE_ARB:
+   case GL_PROXY_HISTOGRAM:
+   case GL_PROXY_COLOR_TABLE:
+   case GL_PROXY_TEXTURE_COLOR_TABLE_SGI:
+   case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE:
+   case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE:
+   case GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP:
+      return 0;
+   }
 
-    if (width < 0 || height < 0 || depth < 0) {
-	return 0;
-    }
+   if (width < 0 || height < 0 || depth < 0) {
+      return 0;
+   }
 
-    /*
+   /*
     ** Zero is returned if either format or type are invalid.
     */
-    components = __glElementsPerGroup(format,type);
-    if (type == GL_BITMAP) {
-	if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
-	    bytes_per_row = (width + 7) >> 3;
-	} else {
-	    return 0;
-	}
-    } else {
-	bytes_per_row = __glBytesPerElement(type) * width;
-    }
+   components = __glElementsPerGroup(format, type);
+   if (type == GL_BITMAP) {
+      if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+         bytes_per_row = (width + 7) >> 3;
+      }
+      else {
+         return 0;
+      }
+   }
+   else {
+      bytes_per_row = __glBytesPerElement(type) * width;
+   }
 
-    return bytes_per_row * height * depth * components;
+   return bytes_per_row * height * depth * components;
 }

Modified: AppleSGLX/trunk/glcontextmodes.c
===================================================================
--- AppleSGLX/trunk/glcontextmodes.c	2009-12-18 07:07:49 UTC (rev 384)
+++ AppleSGLX/trunk/glcontextmodes.c	2009-12-21 20:27:02 UTC (rev 385)
@@ -78,16 +78,16 @@
  *         be returned.  Otherwise \c GLX_NONE will be returned.
  */
 GLint
-_gl_convert_from_x_visual_type( int visualType )
+_gl_convert_from_x_visual_type(int visualType)
 {
-    static const int glx_visual_types[ NUM_VISUAL_TYPES ] = {
-	GLX_STATIC_GRAY,  GLX_GRAY_SCALE,
-	GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
-	GLX_TRUE_COLOR,   GLX_DIRECT_COLOR
-    };
+   static const int glx_visual_types[NUM_VISUAL_TYPES] = {
+      GLX_STATIC_GRAY, GLX_GRAY_SCALE,
+      GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
+      GLX_TRUE_COLOR, GLX_DIRECT_COLOR
+   };
 
-    return ( (unsigned) visualType < NUM_VISUAL_TYPES )
-	? glx_visual_types[ visualType ] : GLX_NONE;
+   return ((unsigned) visualType < NUM_VISUAL_TYPES)
+      ? glx_visual_types[visualType] : GLX_NONE;
 }
 
 
@@ -100,16 +100,16 @@
  *         be returned.  Otherwise -1 will be returned.
  */
 GLint
-_gl_convert_to_x_visual_type( int visualType )
+_gl_convert_to_x_visual_type(int visualType)
 {
-    static const int x_visual_types[ NUM_VISUAL_TYPES ] = {
-	TrueColor,   DirectColor,
-	PseudoColor, StaticColor,
-	GrayScale,   StaticGray
-    };
+   static const int x_visual_types[NUM_VISUAL_TYPES] = {
+      TrueColor, DirectColor,
+      PseudoColor, StaticColor,
+      GrayScale, StaticGray
+   };
 
-    return ( (unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES )
-	? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1;
+   return ((unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES)
+      ? x_visual_types[visualType - GLX_TRUE_COLOR] : -1;
 }
 
 
@@ -128,76 +128,76 @@
  * structure will be set to the \c vid of the \c __GLXvisualConfig structure.
  */
 void
-_gl_copy_visual_to_context_mode( __GLcontextModes * mode,
-				 const __GLXvisualConfig * config )
+_gl_copy_visual_to_context_mode(__GLcontextModes * mode,
+                                const __GLXvisualConfig * config)
 {
-    __GLcontextModes * const next = mode->next;
+   __GLcontextModes *const next = mode->next;
 
-    (void) _mesa_memset( mode, 0, sizeof( __GLcontextModes ) );
-    mode->next = next;
+   (void) _mesa_memset(mode, 0, sizeof(__GLcontextModes));
+   mode->next = next;
 
-    mode->visualID = config->vid;
-    mode->visualType = _gl_convert_from_x_visual_type( config->class );
-    mode->xRenderable = GL_TRUE;
-    mode->fbconfigID = config->vid;
-    mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
+   mode->visualID = config->vid;
+   mode->visualType = _gl_convert_from_x_visual_type(config->class);
+   mode->xRenderable = GL_TRUE;
+   mode->fbconfigID = config->vid;
+   mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
 
-    mode->rgbMode = (config->rgba != 0);
-    mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
+   mode->rgbMode = (config->rgba != 0);
+   mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
 
-    mode->colorIndexMode = !(mode->rgbMode);
-    mode->doubleBufferMode = (config->doubleBuffer != 0);
-    mode->stereoMode = (config->stereo != 0);
+   mode->colorIndexMode = !(mode->rgbMode);
+   mode->doubleBufferMode = (config->doubleBuffer != 0);
+   mode->stereoMode = (config->stereo != 0);
 
-    mode->haveAccumBuffer = ((config->accumRedSize +
-			      config->accumGreenSize +
-			      config->accumBlueSize +
-			      config->accumAlphaSize) > 0);
-    mode->haveDepthBuffer = (config->depthSize > 0);
-    mode->haveStencilBuffer = (config->stencilSize > 0);
+   mode->haveAccumBuffer = ((config->accumRedSize +
+                             config->accumGreenSize +
+                             config->accumBlueSize +
+                             config->accumAlphaSize) > 0);
+   mode->haveDepthBuffer = (config->depthSize > 0);
+   mode->haveStencilBuffer = (config->stencilSize > 0);
 
-    mode->redBits = config->redSize;
-    mode->greenBits = config->greenSize;
-    mode->blueBits = config->blueSize;
-    mode->alphaBits = config->alphaSize;
-    mode->redMask = config->redMask;
-    mode->greenMask = config->greenMask;
-    mode->blueMask = config->blueMask;
-    mode->alphaMask = config->alphaMask;
-    mode->rgbBits = mode->rgbMode ? config->bufferSize : 0;
-    mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0;
+   mode->redBits = config->redSize;
+   mode->greenBits = config->greenSize;
+   mode->blueBits = config->blueSize;
+   mode->alphaBits = config->alphaSize;
+   mode->redMask = config->redMask;
+   mode->greenMask = config->greenMask;
+   mode->blueMask = config->blueMask;
+   mode->alphaMask = config->alphaMask;
+   mode->rgbBits = mode->rgbMode ? config->bufferSize : 0;
+   mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0;
 
-    mode->accumRedBits = config->accumRedSize;
-    mode->accumGreenBits = config->accumGreenSize;
-    mode->accumBlueBits = config->accumBlueSize;
-    mode->accumAlphaBits = config->accumAlphaSize;
-    mode->depthBits = config->depthSize;
-    mode->stencilBits = config->stencilSize;
+   mode->accumRedBits = config->accumRedSize;
+   mode->accumGreenBits = config->accumGreenSize;
+   mode->accumBlueBits = config->accumBlueSize;
+   mode->accumAlphaBits = config->accumAlphaSize;
+   mode->depthBits = config->depthSize;
+   mode->stencilBits = config->stencilSize;
 
-    mode->numAuxBuffers = config->auxBuffers;
-    mode->level = config->level;
+   mode->numAuxBuffers = config->auxBuffers;
+   mode->level = config->level;
 
-    mode->visualRating = config->visualRating;
-    mode->transparentPixel = config->transparentPixel;
-    mode->transparentRed   = config->transparentRed;
-    mode->transparentGreen = config->transparentGreen;
-    mode->transparentBlue  = config->transparentBlue;
-    mode->transparentAlpha = config->transparentAlpha;
-    mode->transparentIndex = config->transparentIndex;
-    mode->samples = config->multiSampleSize;
-    mode->sampleBuffers = config->nMultiSampleBuffers;
-    /* mode->visualSelectGroup = config->visualSelectGroup; ? */
+   mode->visualRating = config->visualRating;
+   mode->transparentPixel = config->transparentPixel;
+   mode->transparentRed = config->transparentRed;
+   mode->transparentGreen = config->transparentGreen;
+   mode->transparentBlue = config->transparentBlue;
+   mode->transparentAlpha = config->transparentAlpha;
+   mode->transparentIndex = config->transparentIndex;
+   mode->samples = config->multiSampleSize;
+   mode->sampleBuffers = config->nMultiSampleBuffers;
+   /* mode->visualSelectGroup = config->visualSelectGroup; ? */
 
-    mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
+   mode->swapMethod = GLX_SWAP_UNDEFINED_OML;
 
-    mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE;
-    mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ?
-	GL_TRUE : GL_FALSE;
-    mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE;
-    mode->bindToTextureTargets = mode->rgbMode ?
-	GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
-	GLX_TEXTURE_RECTANGLE_BIT_EXT : 0;
-    mode->yInverted = GL_FALSE;
+   mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE;
+   mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ?
+      GL_TRUE : GL_FALSE;
+   mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE;
+   mode->bindToTextureTargets = mode->rgbMode ?
+      GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |
+      GLX_TEXTURE_RECTANGLE_BIT_EXT : 0;
+   mode->yInverted = GL_FALSE;
 }
 
 
@@ -211,159 +211,153 @@
  *          returned.  Otherwise \c GLX_BAD_ATTRIBUTE is returned.
  */
 int
-_gl_get_context_mode_data(const __GLcontextModes *mode, int attribute,
-			  int *value_return)
+_gl_get_context_mode_data(const __GLcontextModes * mode, int attribute,
+                          int *value_return)
 {
-    switch (attribute) {
-      case GLX_USE_GL:
-	*value_return = GL_TRUE;
-	return 0;
-      case GLX_BUFFER_SIZE:
-	*value_return = mode->rgbBits;
-	return 0;
-      case GLX_RGBA:
-	*value_return = mode->rgbMode;
-	return 0;
-      case GLX_RED_SIZE:
-	*value_return = mode->redBits;
-	return 0;
-      case GLX_GREEN_SIZE:
-	*value_return = mode->greenBits;
-	return 0;
-      case GLX_BLUE_SIZE:
-	*value_return = mode->blueBits;
-	return 0;
-      case GLX_ALPHA_SIZE:
-	*value_return = mode->alphaBits;
-	return 0;
-      case GLX_DOUBLEBUFFER:
-	*value_return = mode->doubleBufferMode;
-	return 0;
-      case GLX_STEREO:
-	*value_return = mode->stereoMode;
-	return 0;
-      case GLX_AUX_BUFFERS:
-	*value_return = mode->numAuxBuffers;
-	return 0;
-      case GLX_DEPTH_SIZE:
-	*value_return = mode->depthBits;
-	return 0;
-      case GLX_STENCIL_SIZE:
-	*value_return = mode->stencilBits;
-	return 0;
-      case GLX_ACCUM_RED_SIZE:
-	*value_return = mode->accumRedBits;
-	return 0;
-      case GLX_ACCUM_GREEN_SIZE:
-	*value_return = mode->accumGreenBits;
-	return 0;
-      case GLX_ACCUM_BLUE_SIZE:
-	*value_return = mode->accumBlueBits;
-	return 0;
-      case GLX_ACCUM_ALPHA_SIZE:
-	*value_return = mode->accumAlphaBits;
-	return 0;
-      case GLX_LEVEL:
-	*value_return = mode->level;
-	return 0;
-#if 0
-	/* This isn't supported by CGL. */
-      case GLX_TRANSPARENT_TYPE_EXT:
-	*value_return = mode->transparentPixel;
-	return 0;
+   switch (attribute) {
+   case GLX_USE_GL:
+      *value_return = GL_TRUE;
+      return 0;
+   case GLX_BUFFER_SIZE:
+      *value_return = mode->rgbBits;
+      return 0;
+   case GLX_RGBA:
+      *value_return = mode->rgbMode;
+      return 0;
+   case GLX_RED_SIZE:
+      *value_return = mode->redBits;
+      return 0;
+   case GLX_GREEN_SIZE:
+      *value_return = mode->greenBits;
+      return 0;
+   case GLX_BLUE_SIZE:
+      *value_return = mode->blueBits;
+      return 0;
+   case GLX_ALPHA_SIZE:
+      *value_return = mode->alphaBits;
+      return 0;
+   case GLX_DOUBLEBUFFER:
+      *value_return = mode->doubleBufferMode;
+      return 0;
+   case GLX_STEREO:
+      *value_return = mode->stereoMode;
+      return 0;
+   case GLX_AUX_BUFFERS:
+      *value_return = mode->numAuxBuffers;
+      return 0;
+   case GLX_DEPTH_SIZE:
+      *value_return = mode->depthBits;
+      return 0;
+   case GLX_STENCIL_SIZE:
+      *value_return = mode->stencilBits;
+      return 0;
+   case GLX_ACCUM_RED_SIZE:
+      *value_return = mode->accumRedBits;
+      return 0;
+   case GLX_ACCUM_GREEN_SIZE:
+      *value_return = mode->accumGreenBits;
+      return 0;
+   case GLX_ACCUM_BLUE_SIZE:
+      *value_return = mode->accumBlueBits;
+      return 0;
+   case GLX_ACCUM_ALPHA_SIZE:
+      *value_return = mode->accumAlphaBits;
+      return 0;
+   case GLX_LEVEL:
+      *value_return = mode->level;
+      return 0;
+#ifndef __APPLE__ /* This isn't supported by CGL. */
+   case GLX_TRANSPARENT_TYPE_EXT:
+      *value_return = mode->transparentPixel;
+      return 0;
 #endif
-      case GLX_TRANSPARENT_RED_VALUE:
-	*value_return = mode->transparentRed;
-	return 0;
-      case GLX_TRANSPARENT_GREEN_VALUE:
-	*value_return = mode->transparentGreen;
-	return 0;
-      case GLX_TRANSPARENT_BLUE_VALUE:
-	*value_return = mode->transparentBlue;
-	return 0;
-      case GLX_TRANSPARENT_ALPHA_VALUE:
-	*value_return = mode->transparentAlpha;
-	return 0;
-      case GLX_TRANSPARENT_INDEX_VALUE:
-	*value_return = mode->transparentIndex;
-	return 0;
-      case GLX_X_VISUAL_TYPE:
-	*value_return = mode->visualType;
-	return 0;
-      case GLX_CONFIG_CAVEAT:
-	*value_return = mode->visualRating;
-	return 0;
-      case GLX_VISUAL_ID:
-	*value_return = mode->visualID;
-	return 0;
-      case GLX_DRAWABLE_TYPE:
-	*value_return = mode->drawableType;
-	return 0;
-      case GLX_RENDER_TYPE:
-	*value_return = mode->renderType;
-	return 0;
-      case GLX_X_RENDERABLE:
-	*value_return = mode->xRenderable;
-	return 0;
-      case GLX_FBCONFIG_ID:
-	*value_return = mode->fbconfigID;
-	return 0;
-      case GLX_MAX_PBUFFER_WIDTH:
-	*value_return = mode->maxPbufferWidth;
-	return 0;
-      case GLX_MAX_PBUFFER_HEIGHT:
-	*value_return = mode->maxPbufferHeight;
-	return 0;
-      case GLX_MAX_PBUFFER_PIXELS:
-	*value_return = mode->maxPbufferPixels;
-	return 0;
-#if 0
-	/* These aren't supported by CGL. */
-      case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
-	*value_return = mode->optimalPbufferWidth;
-	return 0;
-      case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
-	*value_return = mode->optimalPbufferHeight;
-	return 0;
-      case GLX_SWAP_METHOD_OML:
-	*value_return = mode->swapMethod;
-	return 0;
+   case GLX_TRANSPARENT_RED_VALUE:
+      *value_return = mode->transparentRed;
+      return 0;
+   case GLX_TRANSPARENT_GREEN_VALUE:
+      *value_return = mode->transparentGreen;
+      return 0;
+   case GLX_TRANSPARENT_BLUE_VALUE:
+      *value_return = mode->transparentBlue;
+      return 0;
+   case GLX_TRANSPARENT_ALPHA_VALUE:
+      *value_return = mode->transparentAlpha;
+      return 0;
+   case GLX_TRANSPARENT_INDEX_VALUE:
+      *value_return = mode->transparentIndex;
+      return 0;
+   case GLX_X_VISUAL_TYPE:
+      *value_return = mode->visualType;
+      return 0;
+   case GLX_CONFIG_CAVEAT:
+      *value_return = mode->visualRating;
+      return 0;
+   case GLX_VISUAL_ID:
+      *value_return = mode->visualID;
+      return 0;
+   case GLX_DRAWABLE_TYPE:
+      *value_return = mode->drawableType;
+      return 0;
+   case GLX_RENDER_TYPE:
+      *value_return = mode->renderType;
+      return 0;
+   case GLX_X_RENDERABLE:
+      *value_return = mode->xRenderable;
+      return 0;
+   case GLX_FBCONFIG_ID:
+      *value_return = mode->fbconfigID;
+      return 0;
+   case GLX_MAX_PBUFFER_WIDTH:
+      *value_return = mode->maxPbufferWidth;
+      return 0;
+   case GLX_MAX_PBUFFER_HEIGHT:
+      *value_return = mode->maxPbufferHeight;
+      return 0;
+   case GLX_MAX_PBUFFER_PIXELS:
+      *value_return = mode->maxPbufferPixels;
+      return 0;
+#ifndef __APPLE__ /* These aren't supported by CGL. */
+   case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
+      *value_return = mode->optimalPbufferWidth;
+      return 0;
+   case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
+      *value_return = mode->optimalPbufferHeight;
+      return 0;
+   case GLX_SWAP_METHOD_OML:
+      *value_return = mode->swapMethod;
+      return 0;
 #endif
+   case GLX_SAMPLE_BUFFERS_SGIS:
+      *value_return = mode->sampleBuffers;
+      return 0;
+   case GLX_SAMPLES_SGIS:
+      *value_return = mode->samples;
+      return 0;
+   case GLX_BIND_TO_TEXTURE_RGB_EXT:
+      *value_return = mode->bindToTextureRgb;
+      return 0;
+   case GLX_BIND_TO_TEXTURE_RGBA_EXT:
+      *value_return = mode->bindToTextureRgba;
+      return 0;
+   case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
+      *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE :
+         GL_FALSE;
+      return 0;
+   case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
+      *value_return = mode->bindToTextureTargets;
+      return 0;
+   case GLX_Y_INVERTED_EXT:
+      *value_return = mode->yInverted;
+      return 0;
 
-      case GLX_SAMPLE_BUFFERS:
-	*value_return = mode->sampleBuffers;
-	return 0;
-      case GLX_SAMPLES:
-	*value_return = mode->samples;
-	return 0;
-      case GLX_BIND_TO_TEXTURE_RGB_EXT:
-	*value_return = mode->bindToTextureRgb;
-	return 0;
-      case GLX_BIND_TO_TEXTURE_RGBA_EXT:
-	*value_return = mode->bindToTextureRgba;
-	return 0;
-      case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
-	*value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE :
-	    GL_FALSE;
-	return 0;
-      case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
-	*value_return = mode->bindToTextureTargets;
-	return 0;
-      case GLX_Y_INVERTED_EXT:
-	*value_return = mode->yInverted;
-	return 0;
       /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX.
        * It is ONLY for communication between the GLX client and the GLX
        * server.
        */
-#if 0
-	/* Not supported by AppleSGLX. */
-      case GLX_VISUAL_SELECT_GROUP_SGIX:
-#endif
-
-      default:
-	return GLX_BAD_ATTRIBUTE;
-    }
+   case GLX_VISUAL_SELECT_GROUP_SGIX:
+   default:
+      return GLX_BAD_ATTRIBUTE;
+   }
 }
 #endif /* !defined(IN_MINI_GLX) */
 
@@ -395,24 +389,24 @@
  *          extend the \c __GLcontextModes data-structure.
  */
 __GLcontextModes *
-_gl_context_modes_create( unsigned count, size_t minimum_size )
+_gl_context_modes_create(unsigned count, size_t minimum_size)
 {
-   const size_t size = (minimum_size > sizeof( __GLcontextModes ))
-       ? minimum_size : sizeof( __GLcontextModes );
-   __GLcontextModes * base = NULL;
-   __GLcontextModes ** next;
-   unsigned   i;
+   const size_t size = (minimum_size > sizeof(__GLcontextModes))
+      ? minimum_size : sizeof(__GLcontextModes);
+   __GLcontextModes *base = NULL;
+   __GLcontextModes **next;
+   unsigned i;
 
-   next = & base;
-   for ( i = 0 ; i < count ; i++ ) {
-      *next = (__GLcontextModes *) _mesa_malloc( size );
-      if ( *next == NULL ) {
-	 _gl_context_modes_destroy( base );
-	 base = NULL;
-	 break;
+   next = &base;
+   for (i = 0; i < count; i++) {
+      *next = (__GLcontextModes *) _mesa_malloc(size);
+      if (*next == NULL) {
+         _gl_context_modes_destroy(base);
+         base = NULL;
+         break;
       }
-      
-      (void) _mesa_memset( *next, 0, size );
+
+      (void) _mesa_memset(*next, 0, size);
       (*next)->visualID = GLX_DONT_CARE;
       (*next)->visualType = GLX_DONT_CARE;
       (*next)->visualRating = GLX_NONE;
@@ -431,7 +425,7 @@
       (*next)->bindToTextureTargets = GLX_DONT_CARE;
       (*next)->yInverted = GLX_DONT_CARE;
 
-      next = & ((*next)->next);
+      next = &((*next)->next);
    }
 
    return base;
@@ -446,12 +440,12 @@
  *               in the list will be freed.
  */
 void
-_gl_context_modes_destroy( __GLcontextModes * modes )
+_gl_context_modes_destroy(__GLcontextModes * modes)
 {
-   while ( modes != NULL ) {
-      __GLcontextModes * const next = modes->next;
+   while (modes != NULL) {
+      __GLcontextModes *const next = modes->next;
 
-      _mesa_free( modes );
+      _mesa_free(modes);
       modes = next;
    }
 }
@@ -467,27 +461,27 @@
  */
 
 __GLcontextModes *
-_gl_context_modes_find_visual(__GLcontextModes *modes, int vid)
+_gl_context_modes_find_visual(__GLcontextModes * modes, int vid)
 {
-    __GLcontextModes *m;
+   __GLcontextModes *m;
 
-    for (m = modes; m != NULL; m = m->next)
-	if (m->visualID == vid)
-	    return m;
+   for (m = modes; m != NULL; m = m->next)
+      if (m->visualID == vid)
+         return m;
 
-    return NULL;
+   return NULL;
 }
 
 __GLcontextModes *
-_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid)
+_gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid)
 {
-    __GLcontextModes *m;
+   __GLcontextModes *m;
 
-    for (m = modes; m != NULL; m = m->next)
-	if (m->fbconfigID == fbid)
-	    return m;
+   for (m = modes; m != NULL; m = m->next)
+      if (m->fbconfigID == fbid)
+         return m;
 
-    return NULL;
+   return NULL;
 }
 
 /**
@@ -500,61 +494,55 @@
  *          returned otherwise.
  */
 GLboolean
-_gl_context_modes_are_same( const __GLcontextModes * a,
-			    const __GLcontextModes * b )
+_gl_context_modes_are_same(const __GLcontextModes * a,
+                           const __GLcontextModes * b)
 {
-    return( (a->rgbMode == b->rgbMode) &&
-	    (a->floatMode == b->floatMode) &&
-	    (a->colorIndexMode == b->colorIndexMode) &&
-	    (a->doubleBufferMode == b->doubleBufferMode) &&
-	    (a->stereoMode == b->stereoMode) &&
-	    (a->redBits == b->redBits) &&
-	    (a->greenBits == b->greenBits) &&
-	    (a->blueBits == b->blueBits) &&
-	    (a->alphaBits == b->alphaBits) &&
-#if 0 /* For some reason these don't get set on the client-side in libGL. */
-	    (a->redMask == b->redMask) &&
-	    (a->greenMask == b->greenMask) &&
-	    (a->blueMask == b->blueMask) &&
-	    (a->alphaMask == b->alphaMask) &&
+   return ((a->rgbMode == b->rgbMode) &&
+           (a->floatMode == b->floatMode) &&
+           (a->colorIndexMode == b->colorIndexMode) &&
+           (a->doubleBufferMode == b->doubleBufferMode) &&
+           (a->stereoMode == b->stereoMode) &&
+           (a->redBits == b->redBits) &&
+           (a->greenBits == b->greenBits) &&
+           (a->blueBits == b->blueBits) && (a->alphaBits == b->alphaBits) &&
+#if 0                           /* For some reason these don't get set on the client-side in libGL. */
+           (a->redMask == b->redMask) &&
+           (a->greenMask == b->greenMask) &&
+           (a->blueMask == b->blueMask) && (a->alphaMask == b->alphaMask) &&
 #endif
-	    (a->rgbBits == b->rgbBits) &&
-	    (a->indexBits == b->indexBits) &&
-	    (a->accumRedBits == b->accumRedBits) &&
-	    (a->accumGreenBits == b->accumGreenBits) &&
-	    (a->accumBlueBits == b->accumBlueBits) &&
-	    (a->accumAlphaBits == b->accumAlphaBits) &&
-	    (a->depthBits == b->depthBits) &&
-	    (a->stencilBits == b->stencilBits) &&
-	    (a->numAuxBuffers == b->numAuxBuffers) &&
-	    (a->level == b->level) &&
-	    (a->pixmapMode == b->pixmapMode) &&
-	    (a->visualRating == b->visualRating) &&
-
-	    (a->transparentPixel == b->transparentPixel) &&
-
-	    ((a->transparentPixel != GLX_TRANSPARENT_RGB) ||
-	     ((a->transparentRed == b->transparentRed) &&
-	      (a->transparentGreen == b->transparentGreen) &&
-	      (a->transparentBlue == b->transparentBlue) &&
-	      (a->transparentAlpha == b->transparentAlpha))) &&
-
-	    ((a->transparentPixel != GLX_TRANSPARENT_INDEX) || 
-	     (a->transparentIndex == b->transparentIndex)) &&
-
-	    (a->sampleBuffers == b->sampleBuffers) &&
-	    (a->samples == b->samples) &&
-	    ((a->drawableType & b->drawableType) != 0) &&
-	    (a->renderType == b->renderType) &&
-	    (a->maxPbufferWidth == b->maxPbufferWidth) &&
-	    (a->maxPbufferHeight == b->maxPbufferHeight) &&
-	    (a->maxPbufferPixels == b->maxPbufferPixels) &&
-	    (a->optimalPbufferWidth == b->optimalPbufferWidth) &&
-	    (a->optimalPbufferHeight == b->optimalPbufferHeight) &&
-	    (a->swapMethod == b->swapMethod) &&
-	    (a->bindToTextureRgb == b->bindToTextureRgb) &&
-	    (a->bindToTextureRgba == b->bindToTextureRgba) &&
-	    (a->bindToMipmapTexture == b->bindToMipmapTexture) &&
-	    (a->bindToTextureTargets == b->bindToTextureTargets) &&
-	    (a->yInverted == b->yInverted) );
+           (a->rgbBits == b->rgbBits) &&
+           (a->indexBits == b->indexBits) &&
+           (a->accumRedBits == b->accumRedBits) &&
+           (a->accumGreenBits == b->accumGreenBits) &&
+           (a->accumBlueBits == b->accumBlueBits) &&
+           (a->accumAlphaBits == b->accumAlphaBits) &&
+           (a->depthBits == b->depthBits) &&
+           (a->stencilBits == b->stencilBits) &&
+           (a->numAuxBuffers == b->numAuxBuffers) &&
+           (a->level == b->level) &&
+           (a->pixmapMode == b->pixmapMode) &&
+           (a->visualRating == b->visualRating) &&
+           (a->transparentPixel == b->transparentPixel) &&
+           ((a->transparentPixel != GLX_TRANSPARENT_RGB) ||
+            ((a->transparentRed == b->transparentRed) &&
+             (a->transparentGreen == b->transparentGreen) &&
+             (a->transparentBlue == b->transparentBlue) &&
+             (a->transparentAlpha == b->transparentAlpha))) &&
+           ((a->transparentPixel != GLX_TRANSPARENT_INDEX) ||
+            (a->transparentIndex == b->transparentIndex)) &&
+           (a->sampleBuffers == b->sampleBuffers) &&
+           (a->samples == b->samples) &&
+           ((a->drawableType & b->drawableType) != 0) &&
+           (a->renderType == b->renderType) &&
+           (a->maxPbufferWidth == b->maxPbufferWidth) &&
+           (a->maxPbufferHeight == b->maxPbufferHeight) &&
+           (a->maxPbufferPixels == b->maxPbufferPixels) &&
+           (a->optimalPbufferWidth == b->optimalPbufferWidth) &&
+           (a->optimalPbufferHeight == b->optimalPbufferHeight) &&
+           (a->swapMethod == b->swapMethod) &&
+           (a->bindToTextureRgb == b->bindToTextureRgb) &&
+           (a->bindToTextureRgba == b->bindToTextureRgba) &&
+           (a->bindToMipmapTexture == b->bindToMipmapTexture) &&
+           (a->bindToTextureTargets == b->bindToTextureTargets) &&
+           (a->yInverted == b->yInverted));
 }

Modified: AppleSGLX/trunk/glx_pbuffer.c
===================================================================
--- AppleSGLX/trunk/glx_pbuffer.c	2009-12-18 07:07:49 UTC (rev 384)
+++ AppleSGLX/trunk/glx_pbuffer.c	2009-12-21 20:27:02 UTC (rev 385)
@@ -1,6 +1,5 @@
 /*
  * (C) Copyright IBM Corporation 2004
- * Copyright (C) 2009 Apple Inc.
  * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -26,75 +25,631 @@
 /**
  * \file glx_pbuffer.c
  * Implementation of pbuffer related functions.
- * 
+ *
  * \author Ian Romanick <idr at us.ibm.com>
  */
 
 #include <inttypes.h>
-#include <pthread.h>
 #include "glxclient.h"
 #include <X11/extensions/extutil.h>
 #include <X11/extensions/Xext.h>
 #include <assert.h>
 #include <string.h>
+#ifdef __APPLE__
+#include <pthread.h>
+#include "apple_glx_drawable.h"
+#include "glx_error.h"
+#else
+#include "glapi.h"
+#endif
 #include "glxextensions.h"
 #include "glcontextmodes.h"
 
+#define WARN_ONCE_GLX_1_3(a, b) {		\
+		static int warned=1;		\
+		if(warned) {			\
+			warn_GLX_1_3((a), b );	\
+			warned=0;		\
+		}				\
+	}
 
-#include "apple_glx_drawable.h"
-#include "glx_error.h"
+/**
+ * Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems.
+ */
+static void
+warn_GLX_1_3(Display *dpy, const char *function_name)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
 
+   if (priv->minorVersion < 3) {
+      fprintf(stderr, 
+	      "WARNING: Application calling GLX 1.3 function \"%s\" "
+	      "when GLX 1.3 is not supported!  This is an application bug!\n",
+	      function_name);
+   }
+}
+
+#ifndef __APPLE__
 /**
+ * Change a drawable's attribute.
+ *
+ * This function is used to implement \c glXSelectEvent and
+ * \c glXSelectEventSGIX.
+ *
+ * \note
+ * This function dynamically determines whether to use the SGIX_pbuffer
+ * version of the protocol or the GLX 1.3 version of the protocol.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static void
+ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
+                        const CARD32 * attribs, size_t num_attribs)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+   CARD32 *output;
+   CARD8 opcode;
+
+   if ((dpy == NULL) || (drawable == 0)) {
+      return;
+   }
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return;
+
+   LockDisplay(dpy);
+
+   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+      xGLXChangeDrawableAttributesReq *req;
+
+      GetReqExtra(GLXChangeDrawableAttributes, 8 + (8 * num_attribs), req);
+      output = (CARD32 *) (req + 1);
+
+      req->reqType = opcode;
+      req->glxCode = X_GLXChangeDrawableAttributes;
+      req->drawable = drawable;
+      req->numAttribs = (CARD32) num_attribs;
+   }
+   else {
+      xGLXVendorPrivateWithReplyReq *vpreq;
+
+      GetReqExtra(GLXVendorPrivateWithReply, 4 + (8 * num_attribs), vpreq);
+      output = (CARD32 *) (vpreq + 1);
+
+      vpreq->reqType = opcode;
+      vpreq->glxCode = X_GLXVendorPrivateWithReply;
+      vpreq->vendorCode = X_GLXvop_ChangeDrawableAttributesSGIX;
+
+      output[0] = (CARD32) drawable;
+      output++;
+   }
+
+   (void) memcpy(output, attribs, sizeof(CARD32) * 2 * num_attribs);
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return;
+}
+
+
+/**
+ * Destroy a pbuffer.
+ *
+ * This function is used to implement \c glXDestroyPbuffer and
+ * \c glXDestroyGLXPbufferSGIX.
+ *
+ * \note
+ * This function dynamically determines whether to use the SGIX_pbuffer
+ * version of the protocol or the GLX 1.3 version of the protocol.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static void
+DestroyPbuffer(Display * dpy, GLXDrawable drawable)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+   CARD8 opcode;
+
+   if ((dpy == NULL) || (drawable == 0)) {
+      return;
+   }
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return;
+
+   LockDisplay(dpy);
+
+   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+      xGLXDestroyPbufferReq *req;
+
+      GetReq(GLXDestroyPbuffer, req);
+      req->reqType = opcode;
+      req->glxCode = X_GLXDestroyPbuffer;
+      req->pbuffer = (GLXPbuffer) drawable;
+   }
+   else {
+      xGLXVendorPrivateWithReplyReq *vpreq;
+      CARD32 *data;
+
+      GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
+      data = (CARD32 *) (vpreq + 1);
+
+      data[0] = (CARD32) drawable;
+
+      vpreq->reqType = opcode;
+      vpreq->glxCode = X_GLXVendorPrivateWithReply;
+      vpreq->vendorCode = X_GLXvop_DestroyGLXPbufferSGIX;
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return;
+}
+
+
+#ifdef GLX_DIRECT_RENDERING
+extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy,
+                                           GLXDrawable drawable,
+                                           int *const scrn_num);
+
+static GLenum
+determineTextureTarget(const int *attribs, int numAttribs)
+{
+   GLenum target = 0;
+   int i;
+
+   for (i = 0; i < numAttribs; i++) {
+      if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) {
+         switch (attribs[2 * i + 1]) {
+         case GLX_TEXTURE_2D_EXT:
+            target = GL_TEXTURE_2D;
+            break;
+         case GLX_TEXTURE_RECTANGLE_EXT:
+            target = GL_TEXTURE_RECTANGLE_ARB;
+            break;
+         }
+      }
+   }
+
+   return target;
+}
+
+
+static GLenum
+determineTextureFormat(const int *attribs, int numAttribs)
+{
+   int i;
+
+   for (i = 0; i < numAttribs; i++) {
+      if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
+         return attribs[2 * i + 1];
+   }
+
+   return 0;
+}
+#endif
+
+/**
+ * Get a drawable's attribute.
+ *
+ * This function is used to implement \c glXGetSelectedEvent and
+ * \c glXGetSelectedEventSGIX.
+ *
+ * \note
+ * This function dynamically determines whether to use the SGIX_pbuffer
+ * version of the protocol or the GLX 1.3 version of the protocol.
+ *
+ * \todo
+ * The number of attributes returned is likely to be small, probably less than
+ * 10.  Given that, this routine should try to use an array on the stack to
+ * capture the reply rather than always calling Xmalloc.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static int
+GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
+                     int attribute, unsigned int *value)
+{
+   __GLXdisplayPrivate *priv;
+   xGLXGetDrawableAttributesReply reply;
+   CARD32 *data;
+   CARD8 opcode;
+   unsigned int length;
+   unsigned int i;
+   unsigned int num_attributes;
+   GLboolean use_glx_1_3;
+
+   if ((dpy == NULL) || (drawable == 0)) {
+      return 0;
+   }
+
+   priv = __glXInitialize(dpy);
+   use_glx_1_3 = ((priv->majorVersion > 1) || (priv->minorVersion >= 3));
+
+   *value = 0;
+
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return 0;
+
+   LockDisplay(dpy);
+
+   if (use_glx_1_3) {
+      xGLXGetDrawableAttributesReq *req;
+
+      GetReqExtra(GLXGetDrawableAttributes, 4, req);
+      req->reqType = opcode;
+      req->glxCode = X_GLXGetDrawableAttributes;
+      req->drawable = drawable;
+   }
+   else {
+      xGLXVendorPrivateWithReplyReq *vpreq;
+
+      GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
+      data = (CARD32 *) (vpreq + 1);
+      data[0] = (CARD32) drawable;
+
+      vpreq->reqType = opcode;
+      vpreq->glxCode = X_GLXVendorPrivateWithReply;
+      vpreq->vendorCode = X_GLXvop_GetDrawableAttributesSGIX;
+   }
+
+   _XReply(dpy, (xReply *) & reply, 0, False);
+
+   if (reply.type == X_Error) {
+      UnlockDisplay(dpy);
+      SyncHandle();
+      return 0;
+   }
+
+   length = reply.length;
+   if (length) {
+      num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
+      data = (CARD32 *) Xmalloc(length * sizeof(CARD32));
+      if (data == NULL) {
+         /* Throw data on the floor */
+         _XEatData(dpy, length);
+      }
+      else {
+         _XRead(dpy, (char *) data, length * sizeof(CARD32));
+
+         /* Search the set of returned attributes for the attribute requested by
+          * the caller.
+          */
+         for (i = 0; i < num_attributes; i++) {
+            if (data[i * 2] == attribute) {
+               *value = data[(i * 2) + 1];
+               break;
+            }
+         }
+
+#ifdef GLX_DIRECT_RENDERING
+         {
+            __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
+
+            if (pdraw != NULL && !pdraw->textureTarget)
+               pdraw->textureTarget =
+                  determineTextureTarget((const int *) data, num_attributes);
+            if (pdraw != NULL && !pdraw->textureFormat)
+               pdraw->textureFormat =
+                  determineTextureFormat((const int *) data, num_attributes);
+         }
+#endif
+
+         Xfree(data);
+      }
+   }
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return 0;
+}
+
+/**
+ * Create a non-pbuffer GLX drawable.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static GLXDrawable
+CreateDrawable(Display * dpy, const __GLcontextModes * fbconfig,
+               Drawable drawable, const int *attrib_list, CARD8 glxCode)
+{
+   xGLXCreateWindowReq *req;
+   CARD32 *data;
+   unsigned int i;
+   CARD8 opcode;
+
+   i = 0;
+   if (attrib_list) {
+      while (attrib_list[i * 2] != None)
+         i++;
+   }
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return None;
+
+   LockDisplay(dpy);
+   GetReqExtra(GLXCreateWindow, 8 * i, req);
+   data = (CARD32 *) (req + 1);
+
+   req->reqType = opcode;
+   req->glxCode = glxCode;
+   req->screen = (CARD32) fbconfig->screen;
+   req->fbconfig = fbconfig->fbconfigID;
+   req->window = (CARD32) drawable;
+   req->glxwindow = (GLXWindow) XAllocID(dpy);
+   req->numAttribs = (CARD32) i;
+
+   memcpy(data, attrib_list, 8 * i);
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+#ifdef GLX_DIRECT_RENDERING
+   do {
+      /* FIXME: Maybe delay __DRIdrawable creation until the drawable
+       * is actually bound to a context... */
+
+      __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+      __GLXDRIdrawable *pdraw;
+      __GLXscreenConfigs *psc;
+
+      psc = &priv->screenConfigs[fbconfig->screen];
+      if (psc->driScreen == NULL)
+         break;
+      pdraw = psc->driScreen->createDrawable(psc, drawable,
+                                             req->glxwindow, fbconfig);
+      if (pdraw == NULL) {
+         fprintf(stderr, "failed to create drawable\n");
+         break;
+      }
+
+      if (__glxHashInsert(psc->drawHash, req->glxwindow, pdraw)) {
+         (*pdraw->destroyDrawable) (pdraw);
+         return None;           /* FIXME: Check what we're supposed to do here... */
+      }
+
+      pdraw->textureTarget = determineTextureTarget(attrib_list, i);
+      pdraw->textureFormat = determineTextureFormat(attrib_list, i);
+   } while (0);
+#endif
+
+   return (GLXDrawable) req->glxwindow;
+}
+
+
+/**
+ * Destroy a non-pbuffer GLX drawable.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static void
+DestroyDrawable(Display * dpy, GLXDrawable drawable, CARD32 glxCode)
+{
+   xGLXDestroyPbufferReq *req;
+   CARD8 opcode;
+
+   if ((dpy == NULL) || (drawable == 0)) {
+      return;
+   }
+
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return;
+
+   LockDisplay(dpy);
+
+   GetReqExtra(GLXDestroyPbuffer, 4, req);
+   req->reqType = opcode;
+   req->glxCode = glxCode;
+   req->pbuffer = (GLXPbuffer) drawable;
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+#ifdef GLX_DIRECT_RENDERING
+   {
+      int screen;
+      __GLXdisplayPrivate *const priv = __glXInitialize(dpy);
+      __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
+      __GLXscreenConfigs *psc = &priv->screenConfigs[screen];
+
+      if (pdraw != NULL) {
+         (*pdraw->destroyDrawable) (pdraw);
+         __glxHashDelete(psc->drawHash, drawable);
+      }
+   }
+#endif
+
+   return;
+}
+
+
+/**
+ * Create a pbuffer.
+ *
+ * This function is used to implement \c glXCreatePbuffer and
+ * \c glXCreateGLXPbufferSGIX.
+ *
+ * \note
+ * This function dynamically determines whether to use the SGIX_pbuffer
+ * version of the protocol or the GLX 1.3 version of the protocol.
+ *
+ * \todo
+ * This function needs to be modified to work with direct-rendering drivers.
+ */
+static GLXDrawable
+CreatePbuffer(Display * dpy, const __GLcontextModes * fbconfig,
+              unsigned int width, unsigned int height,
+              const int *attrib_list, GLboolean size_in_attribs)
+{
+   __GLXdisplayPrivate *priv = __glXInitialize(dpy);
+   GLXDrawable id = 0;
+   CARD32 *data;
+   CARD8 opcode;
+   unsigned int i;
+
+   i = 0;
+   if (attrib_list) {
+      while (attrib_list[i * 2])
+         i++;
+   }
+
+   opcode = __glXSetupForCommand(dpy);
+   if (!opcode)
+      return None;
+
+   LockDisplay(dpy);
+   id = XAllocID(dpy);
+
+   if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) {
+      xGLXCreatePbufferReq *req;
+      unsigned int extra = (size_in_attribs) ? 0 : 2;
+
+      GetReqExtra(GLXCreatePbuffer, (8 * (i + extra)), req);
+      data = (CARD32 *) (req + 1);
+
+      req->reqType = opcode;
+      req->glxCode = X_GLXCreatePbuffer;
+      req->screen = (CARD32) fbconfig->screen;
+      req->fbconfig = fbconfig->fbconfigID;
+      req->pbuffer = (GLXPbuffer) id;
+      req->numAttribs = (CARD32) (i + extra);
+
+      if (!size_in_attribs) {
+         data[(2 * i) + 0] = GLX_PBUFFER_WIDTH;
+         data[(2 * i) + 1] = width;
+         data[(2 * i) + 2] = GLX_PBUFFER_HEIGHT;
+         data[(2 * i) + 3] = height;
+         data += 4;
+      }
+   }
+   else {
+      xGLXVendorPrivateReq *vpreq;
+
+      GetReqExtra(GLXVendorPrivate, 20 + (8 * i), vpreq);
+      data = (CARD32 *) (vpreq + 1);
+
+      vpreq->reqType = opcode;
+      vpreq->glxCode = X_GLXVendorPrivate;
+      vpreq->vendorCode = X_GLXvop_CreateGLXPbufferSGIX;
+
+      data[0] = (CARD32) fbconfig->screen;
+      data[1] = (CARD32) fbconfig->fbconfigID;
+      data[2] = (CARD32) id;
+      data[3] = (CARD32) width;
+      data[4] = (CARD32) height;
+      data += 5;
+   }
+
+   (void) memcpy(data, attrib_list, sizeof(CARD32) * 2 * i);
+
+   UnlockDisplay(dpy);
+   SyncHandle();
+
+   return id;
+}
+
+/**
  * Create a new pbuffer.
  */
+PUBLIC GLXPbufferSGIX
+glXCreateGLXPbufferSGIX(Display * dpy, GLXFBConfigSGIX config,
+                        unsigned int width, unsigned int height,
+                        int *attrib_list)
+{
+   return (GLXPbufferSGIX) CreatePbuffer(dpy, (__GLcontextModes *) config,
+                                         width, height,
+                                         attrib_list, GL_FALSE);
+}
+
+#endif /* __APPLE__ */
+
+/**
+ * Create a new pbuffer.
+ */
 PUBLIC GLXPbuffer
-glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attrib_list) {
-    int i, width, height;
-    GLXPbuffer result;
-    int errorcode;
-    
-    width = 0;
-    height = 0;
-    
+glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list)
+{
+   int i, width, height;
+#ifdef __APPLE__
+   GLXPbuffer result;
+   int errorcode;
+#endif
+
+   width = 0;
+   height = 0;
+
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+
+#ifdef __APPLE__
     for(i = 0; attrib_list[i]; ++i) {
-	switch(attrib_list[i]) {
-	case GLX_PBUFFER_WIDTH:
-	    width = attrib_list[i + 1];
-	    ++i;
-	    break;
-	    
-	case GLX_PBUFFER_HEIGHT:
-	    height = attrib_list[i + 1];
-	    ++i;
-	    break;
-	    
-	case GLX_LARGEST_PBUFFER:
-	    /* This is a hint we should probably handle, but how? */
-	    ++i;
-	    break;
+       switch(attrib_list[i]) {
+       case GLX_PBUFFER_WIDTH:
+           width = attrib_list[i + 1];
+           ++i;
+           break;
+           
+       case GLX_PBUFFER_HEIGHT:
+           height = attrib_list[i + 1];
+           ++i;
+           break;
+           
+       case GLX_LARGEST_PBUFFER:
+           /* This is a hint we should probably handle, but how? */
+           ++i;
+           break;
 
-	case GLX_PRESERVED_CONTENTS:
-	    /* The contents are always preserved with AppleSGLX with CGL. */
-	    ++i;
-	    break;
-	    
-	default:
-	    return None;
-	}
+       case GLX_PRESERVED_CONTENTS:
+           /* The contents are always preserved with AppleSGLX with CGL. */
+           ++i;
+           break;
+           
+       default:
+           return None;
+       }
     }
-    
+
     if(apple_glx_pbuffer_create(dpy, config, width, height, &errorcode, 
-				&result)) {
-	/* 
-	 * apple_glx_pbuffer_create only sets the errorcode to core X11
-	 * errors. 
-	 */
-	__glXSendError(dpy, errorcode, 0, X_GLXCreatePbuffer, true);
-	
-	return None;
+                               &result)) {
+       /* 
+        * apple_glx_pbuffer_create only sets the errorcode to core X11
+        * errors. 
+        */
+       __glXSendError(dpy, errorcode, 0, X_GLXCreatePbuffer, true);
+       
+       return None;
     }
     
    return result;
+#else
+   for (i = 0; attrib_list[i * 2]; i++) {
+      switch (attrib_list[i * 2]) {
+      case GLX_PBUFFER_WIDTH:
+         width = attrib_list[i * 2 + 1];
+         break;
+      case GLX_PBUFFER_HEIGHT:
+         height = attrib_list[i * 2 + 1];
+         break;
+      }
+   }
+
+   return (GLXPbuffer) CreatePbuffer(dpy, (__GLcontextModes *) config,
+                                     width, height, attrib_list, GL_TRUE);
+#endif
 }
 
 
@@ -102,28 +657,36 @@
  * Destroy an existing pbuffer.
  */
 PUBLIC void
-glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
+glXDestroyPbuffer(Display * dpy, GLXPbuffer pbuf)
 {
+#ifdef __APPLE__
     if(apple_glx_pbuffer_destroy(dpy, pbuf)) {
-	__glXSendError(dpy, GLXBadPbuffer, pbuf, X_GLXDestroyPbuffer, false);
+       __glXSendError(dpy, GLXBadPbuffer, pbuf, X_GLXDestroyPbuffer, false);
     }
+#else
+   DestroyPbuffer(dpy, pbuf);
+#endif
 }
 
+
 /**
  * Query an attribute of a drawable.
  */
 PUBLIC void
-glXQueryDrawable(Display *dpy, GLXDrawable drawable,
-		 int attribute, unsigned int *value) {
+glXQueryDrawable(Display * dpy, GLXDrawable drawable,
+                 int attribute, unsigned int *value)
+{
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+#ifdef __APPLE__
     Window root;
     int x, y;
     unsigned int width, height, bd, depth;
 
     if(apple_glx_pixmap_query(drawable, attribute, value))
-	return; /*done*/
+       return; /*done*/
 
     if(apple_glx_pbuffer_query(drawable, attribute, value))
-	return; /*done*/
+       return; /*done*/
 
     /*
      * The OpenGL spec states that we should report GLXBadDrawable if
@@ -137,41 +700,64 @@
      * X11 apps using GLX shouldn't notice a difference.
      */
     if(XGetGeometry(dpy, drawable, &root, &x, &y, &width, &height, &bd, &depth)) {
-	switch(attribute) {
-	case GLX_WIDTH:
-	    *value = width;
-	    break;
+       switch(attribute) {
+       case GLX_WIDTH:
+           *value = width;
+           break;
 
-	case GLX_HEIGHT:
-	    *value = height;
-	    break;
-	}
+       case GLX_HEIGHT:
+           *value = height;
+           break;
+       }
     }
+#else
+   GetDrawableAttribute(dpy, drawable, attribute, value);
+#endif
 }
 
 
+#ifndef __APPLE__
 /**
+ * Query an attribute of a pbuffer.
+ */
+PUBLIC int
+glXQueryGLXPbufferSGIX(Display * dpy, GLXPbufferSGIX drawable,
+                       int attribute, unsigned int *value)
+{
+   return GetDrawableAttribute(dpy, drawable, attribute, value);
+}
+#endif
+
+/**
  * Select the event mask for a drawable.
  */
 PUBLIC void
-glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
+glXSelectEvent(Display * dpy, GLXDrawable drawable, unsigned long mask)
 {
+#ifdef __APPLE__
     XWindowAttributes xwattr;
     
     if(apple_glx_pbuffer_set_event_mask(drawable, mask))
-	return; /*done*/
+       return; /*done*/
 
     /* 
      * The spec allows a window, but currently there are no valid
      * events for a window, so do nothing.
      */
     if(XGetWindowAttributes(dpy, drawable, &xwattr))
-	return; /*done*/
-
+       return; /*done*/
     /* The drawable seems to be invalid.  Report an error. */
+ 
+    __glXSendError(dpy, GLXBadDrawable, drawable, 
+                  X_GLXChangeDrawableAttributes, false);
+#else
+   CARD32 attribs[2];
 
-    __glXSendError(dpy, GLXBadDrawable, drawable, 
-		   X_GLXChangeDrawableAttributes, false);
+   attribs[0] = (CARD32) GLX_EVENT_MASK;
+   attribs[1] = (CARD32) mask;
+
+   ChangeDrawableAttribute(dpy, drawable, attribs, 1);
+#endif
 }
 
 
@@ -179,47 +765,68 @@
  * Get the selected event mask for a drawable.
  */
 PUBLIC void
-glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
+glXGetSelectedEvent(Display * dpy, GLXDrawable drawable, unsigned long *mask)
 {
+#ifdef __APPLE__
     XWindowAttributes xwattr;
     
     if(apple_glx_pbuffer_get_event_mask(drawable, mask))
-	return; /*done*/
+       return; /*done*/
 
     /* 
      * The spec allows a window, but currently there are no valid
      * events for a window, so do nothing, but set the mask to 0.
      */
     if(XGetWindowAttributes(dpy, drawable, &xwattr)) {
-	/* The window is valid, so set the mask to 0.*/
-	*mask = 0;
-	return; /*done*/
+       /* The window is valid, so set the mask to 0.*/
+       *mask = 0;
+       return; /*done*/
     }
-
     /* The drawable seems to be invalid.  Report an error. */
+ 
+    __glXSendError(dpy, GLXBadDrawable, drawable, X_GLXGetDrawableAttributes,
+                  true);
+#else
+   unsigned int value;
 
-    __glXSendError(dpy, GLXBadDrawable, drawable, X_GLXGetDrawableAttributes,
-		   true);
+
+   /* The non-sense with value is required because on LP64 platforms
+    * sizeof(unsigned int) != sizeof(unsigned long).  On little-endian
+    * we could just type-cast the pointer, but why?
+    */
+
+   GetDrawableAttribute(dpy, drawable, GLX_EVENT_MASK_SGIX, &value);
+   *mask = value;
+#endif
 }
 
 
 PUBLIC GLXPixmap
-glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap,
-		 const int *attrib_list )
+glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap,
+                const int *attrib_list)
 {
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+
+#ifdef __APPLE__
     const __GLcontextModes *modes = (const __GLcontextModes *)config;
 
     if(apple_glx_pixmap_create(dpy, modes->screen, pixmap, modes))
-	return None;
+       return None;
 
     return pixmap;
+#else
+   return CreateDrawable(dpy, (__GLcontextModes *) config,
+                         (Drawable) pixmap, attrib_list, X_GLXCreatePixmap);
+#endif
 }
 
 
 PUBLIC GLXWindow
-glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
-		 const int *attrib_list )
+glXCreateWindow(Display * dpy, GLXFBConfig config, Window win,
+                const int *attrib_list)
 {
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+#ifdef __APPLE__
     XWindowAttributes xwattr;
     XVisualInfo *visinfo;
 
@@ -230,31 +837,62 @@
     visinfo = glXGetVisualFromFBConfig(dpy, config);
 
     if(NULL == visinfo) {
-	__glXSendError(dpy, GLXBadFBConfig, 0, X_GLXCreateWindow, false);
-	return None;
+       __glXSendError(dpy, GLXBadFBConfig, 0, X_GLXCreateWindow, false);
+       return None;
     }
 
     if(visinfo->visualid != XVisualIDFromVisual(xwattr.visual)) {
-	__glXSendError(dpy, BadMatch, 0, X_GLXCreateWindow, true);
-	return None;
+       __glXSendError(dpy, BadMatch, 0, X_GLXCreateWindow, true);
+       return None;
     }
 
     XFree(visinfo);
 
     return win;
+#else
+   return CreateDrawable(dpy, (__GLcontextModes *) config,
+                         (Drawable) win, attrib_list, X_GLXCreateWindow);
+#endif
 }
 
 
 PUBLIC void
-glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
+glXDestroyPixmap(Display * dpy, GLXPixmap pixmap)
 {
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+#ifdef __APPLE__
     if(apple_glx_pixmap_destroy(dpy, pixmap))
-	__glXSendError(dpy, GLXBadPixmap, pixmap, X_GLXDestroyPixmap, false);
+       __glXSendError(dpy, GLXBadPixmap, pixmap, X_GLXDestroyPixmap, false);
+#else
+   DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap);
+#endif
 }
 
 
 PUBLIC void
-glXDestroyWindow(Display *dpy, GLXWindow win)
+glXDestroyWindow(Display * dpy, GLXWindow win)
 {
-    /* no-op */
+   WARN_ONCE_GLX_1_3(dpy, __func__);
+#ifndef __APPLE__
+   DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow);
+#endif
 }
+
+#ifndef __APPLE__
+PUBLIC
+GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
+               (Display * dpy, GLXPbufferSGIX pbuf),
+               (dpy, pbuf), glXDestroyPbuffer)
+
+PUBLIC
+GLX_ALIAS_VOID(glXSelectEventSGIX,
+               (Display * dpy, GLXDrawable drawable,
+                unsigned long mask), (dpy, drawable, mask), glXSelectEvent)
+
+PUBLIC
+GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
+               (Display * dpy, GLXDrawable drawable,
+                unsigned long *mask), (dpy, drawable, mask),
+               glXGetSelectedEvent)
+
+#endif

Modified: AppleSGLX/trunk/glx_query.c
===================================================================
--- AppleSGLX/trunk/glx_query.c	2009-12-18 07:07:49 UTC (rev 384)
+++ AppleSGLX/trunk/glx_query.c	2009-12-21 20:27:02 UTC (rev 385)
@@ -25,26 +25,85 @@
 /**
  * \file glx_query.c
  * Generic utility functions to query internal data from the server.
- * 
+ *
  * \author Ian Romanick <idr at us.ibm.com>
  */
 
 #include "glxclient.h"
 
+#if defined(USE_XCB)
+# include <X11/Xlib-xcb.h>
+# include <xcb/xcb.h>
+# include <xcb/glx.h>
+#endif
+
+#ifdef USE_XCB
+
 /**
+ * Exchange a protocol request for glXQueryServerString.
+ */
+char *
+__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
+{
+   xcb_connection_t *c = XGetXCBConnection(dpy);
+   xcb_glx_query_server_string_reply_t *reply =
+      xcb_glx_query_server_string_reply(c,
+                                        xcb_glx_query_server_string(c,
+                                                                    screen,
+                                                                    name),
+                                        NULL);
+
+   /* The spec doesn't mention this, but the Xorg server replies with
+    * a string already terminated with '\0'. */
+   uint32_t len = xcb_glx_query_server_string_string_length(reply);
+   char *buf = Xmalloc(len);
+   memcpy(buf, xcb_glx_query_server_string_string(reply), len);
+   free(reply);
+
+   return buf;
+}
+
+/**
+ * Exchange a protocol request for glGetString.
+ */
+char *
+__glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name)
+{
+   xcb_connection_t *c = XGetXCBConnection(dpy);
+   xcb_glx_get_string_reply_t *reply = xcb_glx_get_string_reply(c,
+                                                                xcb_glx_get_string
+                                                                (c,
+                                                                 contextTag,
+                                                                 name),
+                                                                NULL);
+
+   /* The spec doesn't mention this, but the Xorg server replies with
+    * a string already terminated with '\0'. */
+   uint32_t len = xcb_glx_get_string_string_length(reply);
+   char *buf = Xmalloc(len);
+   memcpy(buf, xcb_glx_get_string_string(reply), len);
+   free(reply);
+
+   return buf;
+}
+
+#else
+
+/**
  * GLX protocol structure for the ficticious "GXLGenericGetString" request.
- * 
+ *
  * This is a non-existant protocol packet.  It just so happens that all of
  * the real protocol packets used to request a string from the server have
  * an identical binary layout.  The only difference between them is the
  * meaning of the \c for_whom field and the value of the \c glxCode.
  */
-typedef struct GLXGenericGetString {
-    CARD8 reqType;
-    CARD8 glxCode;
-    CARD16 length B16;
-    CARD32 for_whom B32;
-    CARD32 name B32;
+typedef struct GLXGenericGetString
+{
+   CARD8 reqType;
+   CARD8 glxCode;
+   CARD16 length B16;
+   CARD32 for_whom B32;
+   CARD32 name B32;
 } xGLXGenericGetStringReq;
 
 /* These defines are only needed to make the GetReq macro happy.
@@ -53,50 +112,66 @@
 #define X_GLXGenericGetString 0
 
 /**
- * Query the Server GLX string and cache it in the display private.
+ * Query the Server GLX string.
  * This routine will allocate the necessay space for the string.
  */
-char *
-__glXGetStringFromServer( Display * dpy, int opcode, CARD32 glxCode,
-			  CARD32 for_whom, CARD32 name )
+static char *
+__glXGetStringFromServer(Display * dpy, int opcode, CARD32 glxCode,
+                         CARD32 for_whom, CARD32 name)
 {
-    xGLXGenericGetStringReq *req;
-    xGLXSingleReply reply;
-    int length;
-    int numbytes;
-    char * buf;
+   xGLXGenericGetStringReq *req;
+   xGLXSingleReply reply;
+   int length;
+   int numbytes;
+   char *buf;
 
 
-    LockDisplay( dpy );
+   LockDisplay(dpy);
 
 
-    /* All of the GLX protocol requests for getting a string from the server
-     * look the same.  The exact meaning of the for_whom field is usually
-     * either the screen number (for glXQueryServerString) or the context tag
-     * (for GLXSingle).
-     */
+   /* All of the GLX protocol requests for getting a string from the server
+    * look the same.  The exact meaning of the for_whom field is usually
+    * either the screen number (for glXQueryServerString) or the context tag
+    * (for GLXSingle).
+    */
 
-    GetReq( GLXGenericGetString, req );
-    req->reqType = opcode;
-    req->glxCode = glxCode;
-    req->for_whom = for_whom;
-    req->name = name;
+   GetReq(GLXGenericGetString, req);
+   req->reqType = opcode;
+   req->glxCode = glxCode;
+   req->for_whom = for_whom;
+   req->name = name;
 
-    _XReply( dpy, (xReply *) & reply, 0, False );
+   _XReply(dpy, (xReply *) & reply, 0, False);
 
-    length = reply.length * 4;
-    numbytes = reply.size;
+   length = reply.length * 4;
+   numbytes = reply.size;
 
-    buf = (char *) Xmalloc( numbytes );
-    if ( buf != NULL ) {
-        _XRead( dpy, buf, numbytes );
-	length -= numbytes;
-    }
+   buf = (char *) Xmalloc(numbytes);
+   if (buf != NULL) {
+      _XRead(dpy, buf, numbytes);
+      length -= numbytes;
+   }
 
-    _XEatData( dpy, length );
+   _XEatData(dpy, length);
 
-    UnlockDisplay( dpy );
-    SyncHandle();
+   UnlockDisplay(dpy);
+   SyncHandle();
 
-    return buf;
+   return buf;
 }
+
+char *
+__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
+{
+   return __glXGetStringFromServer(dpy, opcode,
+                                   X_GLXQueryServerString, screen, name);
+}
+
+char *
+__glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name)
+{
+   return __glXGetStringFromServer(dpy, opcode, X_GLsop_GetString,
+                                   contextTag, name);
+}
+
+#endif /* USE_XCB */

Modified: AppleSGLX/trunk/include/GL/glx.h
===================================================================
--- AppleSGLX/trunk/include/GL/glx.h	2009-12-18 07:07:49 UTC (rev 384)
+++ AppleSGLX/trunk/include/GL/glx.h	2009-12-21 20:27:02 UTC (rev 385)
@@ -290,19 +290,27 @@
 extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
                                  unsigned long *mask );
 
+/* GLX 1.3 function pointer typedefs */
+typedef GLXFBConfig * (* PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
+typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
+typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
+typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
+typedef GLXWindow (* PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
+typedef void (* PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
+typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
+typedef void (* PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
+typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
+typedef void (* PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
+typedef void (* PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
+typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
+typedef Bool (* PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
+typedef GLXDrawable (* PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
+typedef Display * (* PFNGLXGETCURRENTDISPLAYPROC) (void);
+typedef int (* PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
+typedef void (* PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
+typedef void (* PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
 
-/* GLX 1.4 and later */
-extern void (*glXGetProcAddress(const GLubyte *procname))( void );
 
-
-#ifndef GLX_GLXEXT_LEGACY
-
-#include <GL/glxext.h>
-
-#else
-
-
-
 /*
  * ARB 2. GLX_ARB_get_proc_address
  */
@@ -316,6 +324,17 @@
 
 
 
+/* GLX 1.4 and later */
+extern void (*glXGetProcAddress(const GLubyte *procname))( void );
+
+/* GLX 1.4 function pointer typedefs */
+typedef __GLXextFuncPtr (* PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
+
+
+#ifndef GLX_GLXEXT_LEGACY
+
+#include <GL/glxext.h>
+
 #endif /* GLX_GLXEXT_LEGACY */
 
 
@@ -386,10 +405,10 @@
 #ifndef GLX_MESA_swap_frame_usage
 #define GLX_MESA_swap_frame_usage 1
 
-extern GLint glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, float *usage);
-extern GLint glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
-extern GLint glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
-extern GLint glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
+extern int glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, float *usage);
+extern int glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
+extern int glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
+extern int glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
 
 typedef int (*PFNGLXGETFRAMEUSAGEMESAPROC) (Display *dpy, GLXDrawable drawable, float *usage);
 typedef int (*PFNGLXBEGINFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);

Modified: AppleSGLX/trunk/include/GL/glxext.h
===================================================================
--- AppleSGLX/trunk/include/GL/glxext.h	2009-12-18 07:07:49 UTC (rev 384)
+++ AppleSGLX/trunk/include/GL/glxext.h	2009-12-21 20:27:02 UTC (rev 385)
@@ -6,7 +6,7 @@
 #endif
 
 /*
-** Copyright (c) 2007 The Khronos Group Inc.
+** Copyright (c) 2007-2009 The Khronos Group Inc.
 ** 
 ** Permission is hereby granted, free of charge, to any person obtaining a
 ** copy of this software and/or associated documentation files (the
@@ -28,40 +28,7 @@
 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
 */
 
-#define GLX_ARB_fbconfig_float 0
-#define GLX_EXT_visual_info 0
-#define GLX_EXT_import_context 0
-#define GLX_SGIS_shared_multisample 0
-#define GLX_SGIX_visual_select_group 0
-#define GLX_NV_present_video 0
-#define GLX_EXT_framebuffer_sRGB 0
-#define GLX_EXT_fbconfig_packed_float 0
-#define GLX_NV_float_buffer 0
-#define GLX_MESA_release_buffers 0
-#define GLX_SGIS_blended_overlay 0
-#define GLX_ARB_create_context 0
-#define GLX_SGIX_pbuffer 0
-#define GLX_SGIX_dmbuffer 0
-#define GLX_SGI_swap_control 0
-#define GLX_SGI_video_sync 0
-#define GLX_SGI_make_current_read 0
-#define GLX_SGIX_hyperpipe 0
-#define GLX_MESA_pixmap_colormap 0
-#define GLX_NV_video_out 0
-#define GLX_MESA_set_3dfx_mode 0
-#define GLX_3DFX_multisample 0
-#define GLX_SGIX_swap_group 0
-#define GLX_SGIX_video_source 0
-#define GLX_NV_swap_group 0
-#define GLX_EXT_texture_from_pixmap 0
-#define GLX_OML_swap_method 0
-#define GLX_MESA_copy_sub_buffer 0
-#define GLX_SGIX_video_resize 0
-#define GLX_MESA_agp_offset 0
-#define GLX_SGIX_swap_barrier 0
-#define GLX_SGI_cushion 0
-#define GLX_OML_sync_control 0
-#define GLX_SUN_get_transparent_index 0
+/* Function declaration macros - to move into glplatform.h */
 
 #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
 #define WIN32_LEAN_AND_MEAN 1
@@ -81,9 +48,9 @@
 /*************************************************************/
 
 /* Header file version number, required by OpenGL ABI for Linux */
-/* glxext.h last updated 2008/10/22 */
+/* glxext.h last updated 2009/10/08 */
 /* Current version at http://www.opengl.org/registry/ */
-#define GLX_GLXEXT_VERSION 21
+#define GLX_GLXEXT_VERSION 25
 
 #ifndef GLX_VERSION_1_3
 #define GLX_WINDOW_BIT                     0x00000001
@@ -170,6 +137,12 @@
 #define GLX_CONTEXT_FLAGS_ARB              0x2094
 #endif
 
+#ifndef GLX_ARB_create_context_profile
+#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB   0x00000001
+#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#define GLX_CONTEXT_PROFILE_MASK_ARB       0x9126
+#endif
+
 #ifndef GLX_SGIS_multisample
 #define GLX_SAMPLE_BUFFERS_SGIS            100000
 #define GLX_SAMPLES_SGIS                   100001
@@ -409,7 +382,21 @@
 #ifndef GLX_NV_swap_group
 #endif
 
+#ifndef GLX_NV_video_capture
+#define GLX_DEVICE_ID_NV                   0x20CD
+#define GLX_UNIQUE_ID_NV                   0x20CE
+#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV     0x20CF
+#endif
 
+#ifndef GLX_EXT_swap_control
+#define GLX_SWAP_INTERVAL_EXT              0x20F1
+#define GLX_MAX_SWAP_INTERVAL_EXT          0x20F2
+#endif
+
+#ifndef GLX_NV_copy_image
+#endif
+
+
 /*************************************************************/
 
 #ifndef GLX_ARB_get_proc_address
@@ -442,6 +429,14 @@
 } GLXBufferClobberEventSGIX;
 #endif
 
+#ifndef GLX_NV_video_output
+typedef unsigned int GLXVideoDeviceNV;
+#endif
+
+#ifndef GLX_NV_video_capture
+typedef XID GLXVideoCaptureDeviceNV;
+#endif
+
 #ifndef GLEXT_64_TYPES_DEFINED
 /* This code block is duplicated in glext.h, so must be protected */
 #define GLEXT_64_TYPES_DEFINED
@@ -553,6 +548,10 @@
 typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
 #endif
 
+#ifndef GLX_ARB_create_context_profile
+#define GLX_ARB_create_context_profile 1
+#endif
+
 #ifndef GLX_SGIS_multisample
 #define GLX_SGIS_multisample 1
 #endif
@@ -850,51 +849,83 @@
 
 #ifndef GLX_NV_present_video
 #define GLX_NV_present_video 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern unsigned int * glXEnumerateVideoDevicesNV (Display *, int, int *);
+extern int glXBindVideoDeviceNV (Display *, unsigned int, unsigned int, const int *);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef unsigned int * ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);
+typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
 #endif
 
-#ifndef GLX_NV_video_out
-#define GLX_NV_video_out 1
+#ifndef GLX_NV_video_output
+#define GLX_NV_video_output 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern int glXGetVideoDeviceNV (Display *, int, int, GLXVideoDeviceNV *);
+extern int glXReleaseVideoDeviceNV (Display *, int, GLXVideoDeviceNV);
+extern int glXBindVideoImageNV (Display *, GLXVideoDeviceNV, GLXPbuffer, int);
+extern int glXReleaseVideoImageNV (Display *, GLXPbuffer);
+extern int glXSendPbufferToVideoNV (Display *, GLXPbuffer, int, unsigned long *, GLboolean);
+extern int glXGetVideoInfoNV (Display *, int, GLXVideoDeviceNV, unsigned long *, unsigned long *);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
+typedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
+typedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
+typedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf);
+typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
+typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
 #endif
 
 #ifndef GLX_NV_swap_group
 #define GLX_NV_swap_group 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern Bool glXJoinSwapGroupNV (Display *, GLXDrawable, GLuint);
+extern Bool glXBindSwapBarrierNV (Display *, GLuint, GLuint);
+extern Bool glXQuerySwapGroupNV (Display *, GLXDrawable, GLuint *, GLuint *);
+extern Bool glXQueryMaxSwapGroupsNV (Display *, int, GLuint *, GLuint *);
+extern Bool glXQueryFrameCountNV (Display *, int, GLuint *);
+extern Bool glXResetFrameCountNV (Display *, int);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
+typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier);
+typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
+typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
+typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count);
+typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen);
 #endif
 
-#undef GLX_ARB_fbconfig_float
-#undef GLX_EXT_visual_info
-#undef GLX_EXT_import_context
-#undef GLX_SGIS_shared_multisample
-#undef GLX_SGIX_visual_select_group
-#undef GLX_NV_present_video
-#undef GLX_EXT_framebuffer_sRGB
-#undef GLX_EXT_fbconfig_packed_float
-#undef GLX_NV_float_buffer
-#undef GLX_MESA_release_buffers
-#undef GLX_SGIS_blended_overlay
-#undef GLX_ARB_create_context
-#undef GLX_SGIX_pbuffer
-#undef GLX_SGIX_dmbuffer
-#undef GLX_SGI_swap_control
-#undef GLX_SGI_video_sync
-#undef GLX_SGI_make_current_read
-#undef GLX_SGIX_hyperpipe
-#undef GLX_MESA_pixmap_colormap
-#undef GLX_NV_video_out
-#undef GLX_MESA_set_3dfx_mode
-#undef GLX_3DFX_multisample
-#undef GLX_SGIX_swap_group
-#undef GLX_SGIX_video_source
-#undef GLX_NV_swap_group
-#undef GLX_EXT_texture_from_pixmap
-#undef GLX_OML_swap_method
-#undef GLX_MESA_copy_sub_buffer
-#undef GLX_SGIX_video_resize
-#undef GLX_MESA_agp_offset
-#undef GLX_SGIX_swap_barrier
-#undef GLX_SGI_cushion
-#undef GLX_OML_sync_control
-#undef GLX_SUN_get_transparent_index
+#ifndef GLX_NV_video_capture
+#define GLX_NV_video_capture 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern int glXBindVideoCaptureDeviceNV (Display *, unsigned int, GLXVideoCaptureDeviceNV);
+extern GLXVideoCaptureDeviceNV * glXEnumerateVideoCaptureDevicesNV (Display *, int, int *);
+extern void glXLockVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV);
+extern int glXQueryVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV, int, int *);
+extern void glXReleaseVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
+typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements);
+typedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
+typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
+typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
+#endif
 
+#ifndef GLX_EXT_swap_control
+#define GLX_EXT_swap_control 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern int glXSwapIntervalEXT (Display *, GLXDrawable, int);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef int ( * PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval);
+#endif
+
+#ifndef GLX_NV_copy_image
+#define GLX_NV_copy_image 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern void glXCopyImageSubDataNV (Display *, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+
+
 #ifdef __cplusplus
 }
 #endif

Modified: AppleSGLX/trunk/include/GL/internal/glcore.h
===================================================================
--- AppleSGLX/trunk/include/GL/internal/glcore.h	2009-12-18 07:07:49 UTC (rev 384)
+++ AppleSGLX/trunk/include/GL/internal/glcore.h	2009-12-21 20:27:02 UTC (rev 385)
@@ -31,9 +31,9 @@
  * Silicon Graphics, Inc.
  */
 
+#if !defined(_WIN32_WCE)
 #include <sys/types.h>
-#include <GL/gl.h>
-#include <GL/glxint.h>
+#endif
 
 #define GL_CORE_SGI  1
 #define GL_CORE_MESA 2
@@ -139,8 +139,6 @@
     GLint bindToMipmapTexture;
     GLint bindToTextureTargets;
     GLint yInverted;
-
-    void *apple;
 } __GLcontextModes;
 
 /* Several fields of __GLcontextModes can take these as values.  Since
@@ -180,4 +178,8 @@
 #define GLX_TEXTURE_2D_BIT_EXT             0x00000002
 #define GLX_TEXTURE_RECTANGLE_BIT_EXT      0x00000004
 
+#define GLX_TEXTURE_FORMAT_NONE_EXT        0x20D8
+#define GLX_TEXTURE_FORMAT_RGB_EXT         0x20D9
+#define GLX_TEXTURE_FORMAT_RGBA_EXT        0x20DA
+
 #endif /* __gl_core_h_ */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/xquartz-changes/attachments/20091221/d5123ebc/attachment-0001.html>


More information about the Xquartz-changes mailing list