diff options
author | Julien Cristau <jcristau@debian.org> | 2007-04-21 20:27:55 +0200 |
---|---|---|
committer | Julien Cristau <jcristau@debian.org> | 2007-04-21 20:27:55 +0200 |
commit | d890ebdd2591c5c09038c8986341da17127ba930 (patch) | |
tree | 46b3b277f2dca3a2ee7741be0f0ec41db7bd5313 /src/glx | |
parent | 5ee9b3ce729c41dff80dc7ee2db8fdc30585c9e2 (diff) | |
parent | 5ca8d4ccf24af1c174ff791f15cf9f19defd9b7e (diff) |
Merge branch 'upstream-experimental' into debian-experimental
Conflicts:
doxygen/Makefile
doxygen/common.doxy
doxygen/doxy.bat
doxygen/glapi.doxy
doxygen/header.html
doxygen/main.doxy
doxygen/math.doxy
doxygen/shader.doxy
doxygen/swrast.doxy
doxygen/swrast_setup.doxy
doxygen/tnl.doxy
doxygen/tnl_dd.doxy
progs/tests/Makefile
progs/tests/fbotest1.c
progs/tests/fbotest2.c
progs/tests/fbotexture.c
progs/tests/mipmap_limits.c
progs/tests/sharedtex.c
progs/tools/trace/gltrace_support.cc
progs/trivial/Makefile
src/egl/docs/EGL_MESA_screen_surface
src/egl/main/egllog.c
src/glx/mini/Makefile
src/glx/mini/driver.h
src/mesa/drivers/allegro/amesa.c
src/mesa/drivers/windows/gldirect/dx7/gld_driver_dx7.c
src/mesa/drivers/windows/gldirect/dx7/gld_ext_dx7.c
src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c
src/mesa/drivers/windows/gldirect/dx8/gld_driver_dx8.c
src/mesa/drivers/windows/gldirect/dx8/gld_ext_dx8.c
src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c
src/mesa/drivers/windows/gldirect/dx9/gld_driver_dx9.c
src/mesa/drivers/windows/gldirect/dx9/gld_ext_dx9.c
src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c
src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c
Diffstat (limited to 'src/glx')
-rw-r--r-- | src/glx/x11/.gitignore | 1 | ||||
-rw-r--r-- | src/glx/x11/Makefile | 6 | ||||
-rw-r--r-- | src/glx/x11/dri_glx.c | 35 | ||||
-rw-r--r--[l---------] | src/glx/x11/glcontextmodes.c | 538 | ||||
-rw-r--r-- | src/glx/x11/glcontextmodes.h | 52 | ||||
-rw-r--r-- | src/glx/x11/glxcmds.c | 3 | ||||
-rw-r--r-- | src/glx/x11/glxext.c | 84 | ||||
-rw-r--r-- | src/glx/x11/indirect.c | 50 | ||||
-rw-r--r-- | src/glx/x11/indirect.h | 2 | ||||
-rw-r--r-- | src/glx/x11/indirect_vertex_array.c | 6 | ||||
-rw-r--r-- | src/glx/x11/single2.c | 18 |
11 files changed, 735 insertions, 60 deletions
diff --git a/src/glx/x11/.gitignore b/src/glx/x11/.gitignore new file mode 100644 index 00000000000..ffc14ab7660 --- /dev/null +++ b/src/glx/x11/.gitignore @@ -0,0 +1 @@ +glcontextmodes.c diff --git a/src/glx/x11/Makefile b/src/glx/x11/Makefile index c509d4e0851..296747e0dda 100644 --- a/src/glx/x11/Makefile +++ b/src/glx/x11/Makefile @@ -46,7 +46,6 @@ INCLUDES = -I. \ -I$(TOP)/include/GL/internal \ -I$(TOP)/src/mesa/main \ -I$(TOP)/src/mesa/glapi \ - -I$(TOP)/src/mesa/drivers/dri/common \ $(LIBDRM_CFLAGS) \ $(X11_INCLUDES) @@ -63,9 +62,6 @@ INCLUDES = -I. \ default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) -glcontextmodes.c: - ln -s $(TOP)/src/mesa/drivers/dri/common/glcontextmodes.c . - # Make libGL $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \ @@ -81,7 +77,7 @@ depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_ASM_API) Makefile # Emacs tags tags: - etags `find . -name \*.[ch]` `find ../include` + etags `find . -name \*.[ch]` `find $(TOP)/include` # Dummy install target install: diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 0875361d0b6..5cf9923979a 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -39,6 +39,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <X11/Xlibint.h> #include <X11/extensions/Xext.h> #include <X11/extensions/extutil.h> +#include "glheader.h" #include "glxclient.h" #include "xf86dri.h" #include "sarea.h" @@ -81,11 +82,15 @@ static void InfoMessageF(const char *f, ...) } } +/** + * Print error to stderr, unless LIBGL_DEBUG=="quiet". + */ static void ErrorMessageF(const char *f, ...) { va_list args; + const char *env; - if (getenv("LIBGL_DEBUG")) { + if ((env = getenv("LIBGL_DEBUG")) && !strstr(env, "quiet")) { fprintf(stderr, "libGL error: "); va_start(args, f); vfprintf(stderr, f, args); @@ -338,7 +343,7 @@ __DRIdriver *driGetDriver(Display *dpy, int scrNum) * The returned char pointer points to a static array that will be * overwritten by subsequent calls. */ -const char *glXGetScreenDriver (Display *dpy, int scrNum) { +PUBLIC const char *glXGetScreenDriver (Display *dpy, int scrNum) { static char ret[32]; char *driverName; if (GetDriverName(dpy, scrNum, &driverName)) { @@ -367,7 +372,7 @@ const char *glXGetScreenDriver (Display *dpy, int scrNum) { * * Note: The driver remains opened after this function returns. */ -const char *glXGetDriverConfig (const char *driverName) { +PUBLIC const char *glXGetDriverConfig (const char *driverName) { __DRIdriver *driver = OpenDriver (driverName); if (driver) return dlsym (driver->handle, "__driConfigOptions"); @@ -376,7 +381,7 @@ const char *glXGetDriverConfig (const char *driverName) { } -/* This function isn't currently used. +/* Called from __glXFreeDisplayPrivate. */ static void driDestroyDisplay(Display *dpy, void *private) { @@ -386,8 +391,26 @@ static void driDestroyDisplay(Display *dpy, void *private) const int numScreens = ScreenCount(dpy); int i; for (i = 0; i < numScreens; i++) { - if (pdpyp->libraryHandles[i]) - dlclose(pdpyp->libraryHandles[i]); + if (pdpyp->libraryHandles[i]) { + __DRIdriver *driver, *prev; + + /* Remove driver from Drivers list */ + for (prev = NULL, driver = Drivers; driver; + prev = driver, driver = driver->next) { + if (driver->handle == pdpyp->libraryHandles[i]) { + if (prev) + prev->next = driver->next; + else + Drivers = driver->next; + + Xfree(driver->name); + Xfree(driver); + break; + } + } + + dlclose(pdpyp->libraryHandles[i]); + } } Xfree(pdpyp->libraryHandles); Xfree(pdpyp); diff --git a/src/glx/x11/glcontextmodes.c b/src/glx/x11/glcontextmodes.c index ca6b8c0b58a..c1651849031 120000..100644 --- a/src/glx/x11/glcontextmodes.c +++ b/src/glx/x11/glcontextmodes.c @@ -1 +1,537 @@ -../../../src/mesa/drivers/dri/common/glcontextmodes.c
\ No newline at end of file +/* + * (C) Copyright IBM Corporation 2003 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file glcontextmodes.c + * Utility routines for working with \c __GLcontextModes structures. At + * some point most or all of these functions will be moved to the Mesa + * code base. + * + * \author Ian Romanick <idr@us.ibm.com> + */ + +#if defined(IN_MINI_GLX) +#include <GL/gl.h> +#else +#if defined(HAVE_DIX_CONFIG_H) +# include <dix-config.h> +#endif +#include <X11/X.h> +#include <GL/glx.h> +#include "GL/glxint.h" +#endif + +/* Memory macros */ +#if defined(IN_MINI_GLX) +# include <stdlib.h> +# include <string.h> +# define _mesa_malloc(b) malloc(b) +# define _mesa_free(m) free(m) +# define _mesa_memset memset +#else +# ifdef XFree86Server +# include <os.h> +# include <string.h> +# define _mesa_malloc(b) xalloc(b) +# define _mesa_free(m) xfree(m) +# define _mesa_memset memset +# else +# include <X11/Xlibint.h> +# define _mesa_memset memset +# define _mesa_malloc(b) Xmalloc(b) +# define _mesa_free(m) Xfree(m) +# endif /* XFree86Server */ +#endif /* !defined(IN_MINI_GLX) */ + +#include "glcontextmodes.h" + +#if !defined(IN_MINI_GLX) +#define NUM_VISUAL_TYPES 6 + +/** + * Convert an X visual type to a GLX visual type. + * + * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.) + * to be converted. + * \return If \c visualType is a valid X visual type, a GLX visual type will + * be returned. Otherwise \c GLX_NONE will be returned. + */ +GLint +_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 + }; + + return ( (unsigned) visualType < NUM_VISUAL_TYPES ) + ? glx_visual_types[ visualType ] : GLX_NONE; +} + + +/** + * Convert a GLX visual type to an X visual type. + * + * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR, + * \c GLX_STATIC_GRAY, etc.) to be converted. + * \return If \c visualType is a valid GLX visual type, an X visual type will + * be returned. Otherwise -1 will be returned. + */ +GLint +_gl_convert_to_x_visual_type( int visualType ) +{ + 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; +} + + +/** + * Copy a GLX visual config structure to a GL context mode structure. All + * of the fields in \c config are copied to \c mode. Additional fields in + * \c mode that can be derrived from the fields of \c config (i.e., + * \c haveDepthBuffer) are also filled in. The remaining fields in \c mode + * that cannot be derrived are set to default values. + * + * \param mode Destination GL context mode. + * \param config Source GLX visual config. + * + * \note + * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes + * 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 ) +{ + __GLcontextModes * const next = mode->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->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->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->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->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->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; +} + + +/** + * Get data from a GL context mode. + * + * \param mode GL context mode whose data is to be returned. + * \param attribute Attribute of \c mode that is to be returned. + * \param value_return Location to store the data member of \c mode. + * \return If \c attribute is a valid attribute of \c mode, zero is + * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned. + */ +int +_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; + case GLX_TRANSPARENT_TYPE_EXT: + *value_return = mode->transparentPixel; + 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; + 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_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; + 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. + */ + case GLX_VISUAL_SELECT_GROUP_SGIX: + default: + return GLX_BAD_ATTRIBUTE; + } +} +#endif /* !defined(IN_MINI_GLX) */ + + +/** + * Allocate a linked list of \c __GLcontextModes structures. The fields of + * each structure will be initialized to "reasonable" default values. In + * most cases this is the default value defined by table 3.4 of the GLX + * 1.3 specification. This means that most values are either initialized to + * zero or \c GLX_DONT_CARE (which is -1). As support for additional + * extensions is added, the new values will be initialized to appropriate + * values from the extension specification. + * + * \param count Number of structures to allocate. + * \param minimum_size Minimum size of a structure to allocate. This allows + * for differences in the version of the + * \c __GLcontextModes stucture used in libGL and in a + * DRI-based driver. + * \returns A pointer to the first element in a linked list of \c count + * stuctures on success, or \c NULL on failure. + * + * \warning Use of \c minimum_size does \b not guarantee binary compatibility. + * The fundamental assumption is that if the \c minimum_size + * specified by the driver and the size of the \c __GLcontextModes + * structure in libGL is the same, then the meaning of each byte in + * the structure is the same in both places. \b Be \b careful! + * Basically this means that fields have to be added in libGL and + * then propagated to drivers. Drivers should \b never arbitrarilly + * extend the \c __GLcontextModes data-structure. + */ +__GLcontextModes * +_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; + + 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 ); + (*next)->visualID = GLX_DONT_CARE; + (*next)->visualType = GLX_DONT_CARE; + (*next)->visualRating = GLX_NONE; + (*next)->transparentPixel = GLX_NONE; + (*next)->transparentRed = GLX_DONT_CARE; + (*next)->transparentGreen = GLX_DONT_CARE; + (*next)->transparentBlue = GLX_DONT_CARE; + (*next)->transparentAlpha = GLX_DONT_CARE; + (*next)->transparentIndex = GLX_DONT_CARE; + (*next)->xRenderable = GLX_DONT_CARE; + (*next)->fbconfigID = GLX_DONT_CARE; + (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML; + (*next)->bindToTextureRgb = GLX_DONT_CARE; + (*next)->bindToTextureRgba = GLX_DONT_CARE; + (*next)->bindToMipmapTexture = GLX_DONT_CARE; + (*next)->bindToTextureTargets = 0; + (*next)->yInverted = GLX_DONT_CARE; + + next = & ((*next)->next); + } + + return base; +} + + +/** + * Destroy a linked list of \c __GLcontextModes structures created by + * \c _gl_context_modes_create. + * + * \param modes Linked list of structures to be destroyed. All structres + * in the list will be freed. + */ +void +_gl_context_modes_destroy( __GLcontextModes * modes ) +{ + while ( modes != NULL ) { + __GLcontextModes * const next = modes->next; + + _mesa_free( modes ); + modes = next; + } +} + + +/** + * Find a context mode matching a Visual ID. + * + * \param modes List list of context-mode structures to be searched. + * \param vid Visual ID to be found. + * \returns A pointer to a context-mode in \c modes if \c vid was found in + * the list, or \c NULL if it was not. + */ + +__GLcontextModes * +_gl_context_modes_find_visual( __GLcontextModes * modes, int vid ) +{ + while ( modes != NULL ) { + if ( modes->visualID == vid ) { + break; + } + + modes = modes->next; + } + + return modes; +} + + +/** + * Determine if two context-modes are the same. This is intended to be used + * by libGL implementations to compare to sets of driver generated FBconfigs. + * + * \param a Context-mode to be compared. + * \param b Context-mode to be compared. + * \returns \c GL_TRUE if the two context-modes are the same. \c GL_FALSE is + * returned otherwise. + */ +GLboolean +_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) && +#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) ); +} diff --git a/src/glx/x11/glcontextmodes.h b/src/glx/x11/glcontextmodes.h new file mode 100644 index 00000000000..4b5c6f68b8f --- /dev/null +++ b/src/glx/x11/glcontextmodes.h @@ -0,0 +1,52 @@ +/* + * (C) Copyright IBM Corporation 2003 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file glcontextmodes.h + * \author Ian Romanick <idr@us.ibm.com> + */ + +#ifndef GLCONTEXTMODES_H +#define GLCONTEXTMODES_H + +#include "GL/internal/glcore.h" + +#if !defined(IN_MINI_GLX) +extern GLint _gl_convert_from_x_visual_type( int visualType ); +extern GLint _gl_convert_to_x_visual_type( int visualType ); +extern void _gl_copy_visual_to_context_mode( __GLcontextModes * mode, + const __GLXvisualConfig * config ); +extern int _gl_get_context_mode_data( const __GLcontextModes *mode, + int attribute, int *value_return ); +#endif /* !defined(IN_MINI_GLX) */ + +extern __GLcontextModes * _gl_context_modes_create( unsigned count, + size_t minimum_size ); +extern void _gl_context_modes_destroy( __GLcontextModes * modes ); +extern __GLcontextModes * _gl_context_modes_find_visual( + __GLcontextModes * modes, int vid ); +extern GLboolean _gl_context_modes_are_same( const __GLcontextModes * a, + const __GLcontextModes * b ); + +#endif /* GLCONTEXTMODES_H */ diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 9d1bb2a0b55..f52b71ffcd2 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -2883,8 +2883,9 @@ int __glXGetInternalVersion(void) * 20050727 - Gut all the old interfaces. This breaks compatability with * any DRI driver built to any previous version. * 20060314 - Added support for GLX_MESA_copy_sub_buffer. + * 20070105 - Added support for damage reporting. */ - return 20060314; + return 20070105; } diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 8bec2c34c60..af3a5166dc6 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -48,6 +48,8 @@ #include <stdio.h> #include <X11/extensions/Xext.h> #include <X11/extensions/extutil.h> +#include <X11/extensions/Xfixes.h> +#include <X11/extensions/Xdamage.h> #include <assert.h> #include "indirect_init.h" #include "glapi.h" @@ -394,6 +396,10 @@ static int __glXFreeDisplayPrivate(XExtData *extension) (*priv->driDisplay.destroyDisplay)(priv->dpy, priv->driDisplay.private); priv->driDisplay.private = NULL; + if (priv->driDisplay.createNewScreen) { + Xfree(priv->driDisplay.createNewScreen); /* free array of ptrs */ + priv->driDisplay.createNewScreen = NULL; + } #endif Xfree((char*) priv); @@ -698,6 +704,69 @@ static __DRIfuncPtr get_proc_address( const char * proc_name ) return NULL; } +#ifdef XDAMAGE_1_1_INTERFACE +static GLboolean has_damage_post(__DRInativeDisplay *dpy) +{ + static GLboolean inited = GL_FALSE; + static GLboolean has_damage; + + if (!inited) { + int major, minor; + + if (XDamageQueryVersion(dpy, &major, &minor) && + major == 1 && minor >= 1) + { + has_damage = GL_TRUE; + } else { + has_damage = GL_FALSE; + } + inited = GL_TRUE; + } + + return has_damage; +} +#endif /* XDAMAGE_1_1_INTERFACE */ + +static void __glXReportDamage(__DRInativeDisplay *dpy, int screen, + __DRIid drawable, + int x, int y, + drm_clip_rect_t *rects, int num_rects, + GLboolean front_buffer) +{ +#ifdef XDAMAGE_1_1_INTERFACE + XRectangle *xrects; + XserverRegion region; + int i; + int x_off, y_off; + + if (!has_damage_post(dpy)) + return; + + if (front_buffer) { + x_off = x; + y_off = y; + drawable = RootWindow(dpy, screen); + } else{ + x_off = 0; + y_off = 0; + } + + xrects = malloc(sizeof(XRectangle) * num_rects); + if (xrects == NULL) + return; + + for (i = 0; i < num_rects; i++) { + xrects[i].x = rects[i].x1 + x_off; + xrects[i].y = rects[i].y1 + y_off; + xrects[i].width = rects[i].x2 - rects[i].x1; + xrects[i].height = rects[i].y2 - rects[i].y1; + } + region = XFixesCreateRegion(dpy, xrects, num_rects); + free(xrects); + XDamageAdd(dpy, drawable, region); + XFixesDestroyRegion(dpy, region); +#endif +} /** * Table of functions exported by the loader to the driver. @@ -720,6 +789,8 @@ static const __DRIinterfaceMethods interface_methods = { __glXGetUST, __glXGetMscRateOML, + + __glXReportDamage, }; @@ -1175,7 +1246,7 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy) __glXUnlock(); return 0; } - dpyPriv = (__GLXdisplayPrivate *) Xmalloc(sizeof(__GLXdisplayPrivate)); + dpyPriv = (__GLXdisplayPrivate *) Xcalloc(1, sizeof(__GLXdisplayPrivate)); if (!dpyPriv) { __glXUnlock(); Xfree((char*) private); @@ -1200,12 +1271,7 @@ __GLXdisplayPrivate *__glXInitialize(Display* dpy) ** Note: This _must_ be done before calling any other DRI routines ** (e.g., those called in AllocAndFetchScreenConfigs). */ - if (getenv("LIBGL_ALWAYS_INDIRECT")) { - /* Assinging zero here assures we'll never go direct */ - dpyPriv->driDisplay.private = 0; - dpyPriv->driDisplay.destroyDisplay = 0; - } - else { + if (getenv("LIBGL_ALWAYS_INDIRECT") == NULL) { dpyPriv->driDisplay.private = driCreateDisplay(dpy, &dpyPriv->driDisplay); } @@ -1417,7 +1483,7 @@ void __glXSendLargeCommand(__GLXcontext *ctx, /************************************************************************/ -GLXContext glXGetCurrentContext(void) +PUBLIC GLXContext glXGetCurrentContext(void) { GLXContext cx = __glXGetCurrentContext(); @@ -1428,7 +1494,7 @@ GLXContext glXGetCurrentContext(void) } } -GLXDrawable glXGetCurrentDrawable(void) +PUBLIC GLXDrawable glXGetCurrentDrawable(void) { GLXContext gc = __glXGetCurrentContext(); return gc->currentDrawable; diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index b5c306c562d..87c523383b5 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -474,7 +474,7 @@ __indirect_glBegin(GLenum mode) void __indirect_glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, - const GLubyte * bitmap) + const GLubyte *bitmap) { __GLXcontext *const gc = __glXGetCurrentContext(); const GLuint compsize = @@ -541,7 +541,7 @@ __indirect_glColor3b(GLbyte red, GLbyte green, GLbyte blue) #define X_GLrop_Color3bv 6 void -__indirect_glColor3bv(const GLbyte * v) +__indirect_glColor3bv(const GLbyte *v) { generic_3_byte(X_GLrop_Color3bv, v); } @@ -656,7 +656,7 @@ __indirect_glColor3ub(GLubyte red, GLubyte green, GLubyte blue) #define X_GLrop_Color3ubv 11 void -__indirect_glColor3ubv(const GLubyte * v) +__indirect_glColor3ubv(const GLubyte *v) { generic_3_byte(X_GLrop_Color3ubv, v); } @@ -726,7 +726,7 @@ __indirect_glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) #define X_GLrop_Color4bv 14 void -__indirect_glColor4bv(const GLbyte * v) +__indirect_glColor4bv(const GLbyte *v) { generic_4_byte(X_GLrop_Color4bv, v); } @@ -847,7 +847,7 @@ __indirect_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) #define X_GLrop_Color4ubv 19 void -__indirect_glColor4ubv(const GLubyte * v) +__indirect_glColor4ubv(const GLubyte *v) { generic_4_byte(X_GLrop_Color4ubv, v); } @@ -1051,7 +1051,7 @@ __indirect_glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz) #define X_GLrop_Normal3bv 28 void -__indirect_glNormal3bv(const GLbyte * v) +__indirect_glNormal3bv(const GLbyte *v) { generic_3_byte(X_GLrop_Normal3bv, v); } @@ -2584,7 +2584,7 @@ __indirect_glPolygonMode(GLenum face, GLenum mode) #define X_GLrop_PolygonStipple 102 void -__indirect_glPolygonStipple(const GLubyte * mask) +__indirect_glPolygonStipple(const GLubyte *mask) { __GLXcontext *const gc = __glXGetCurrentContext(); const GLuint compsize = @@ -4207,7 +4207,7 @@ __indirect_glGetPixelMapusv(GLenum map, GLushort * values) #define X_GLsop_GetPolygonStipple 128 void -__indirect_glGetPolygonStipple(GLubyte * mask) +__indirect_glGetPolygonStipple(GLubyte *mask) { __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; @@ -4977,7 +4977,7 @@ __indirect_glIndexub(GLubyte c) #define X_GLrop_Indexubv 194 void -__indirect_glIndexubv(const GLubyte * c) +__indirect_glIndexubv(const GLubyte *c) { __GLXcontext *const gc = __glXGetCurrentContext(); const GLuint cmdlen = 8; @@ -7935,7 +7935,7 @@ __indirect_glVertexAttrib3svARB(GLuint index, const GLshort * v) #define X_GLrop_VertexAttrib4NbvARB 4235 void -__indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte * v) +__indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte *v) { __GLXcontext *const gc = __glXGetCurrentContext(); const GLuint cmdlen = 12; @@ -7999,7 +7999,7 @@ __indirect_glVertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, #define X_GLrop_VertexAttrib4NubvARB 4201 void -__indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte * v) +__indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte *v) { __GLXcontext *const gc = __glXGetCurrentContext(); const GLuint cmdlen = 12; @@ -8044,7 +8044,7 @@ __indirect_glVertexAttrib4NusvARB(GLuint index, const GLushort * v) #define X_GLrop_VertexAttrib4bvARB 4230 void -__indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte * v) +__indirect_glVertexAttrib4bvARB(GLuint index, const GLbyte *v) { __GLXcontext *const gc = __glXGetCurrentContext(); const GLuint cmdlen = 12; @@ -8176,7 +8176,7 @@ __indirect_glVertexAttrib4svARB(GLuint index, const GLshort * v) #define X_GLrop_VertexAttrib4ubvARB 4232 void -__indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte * v) +__indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte *v) { __GLXcontext *const gc = __glXGetCurrentContext(); const GLuint cmdlen = 12; @@ -8556,7 +8556,7 @@ __indirect_glSecondaryColor3bEXT(GLbyte red, GLbyte green, GLbyte blue) #define X_GLrop_SecondaryColor3bvEXT 4126 void -__indirect_glSecondaryColor3bvEXT(const GLbyte * v) +__indirect_glSecondaryColor3bvEXT(const GLbyte *v) { generic_3_byte(X_GLrop_SecondaryColor3bvEXT, v); } @@ -8671,7 +8671,7 @@ __indirect_glSecondaryColor3ubEXT(GLubyte red, GLubyte green, GLubyte blue) #define X_GLrop_SecondaryColor3ubvEXT 4131 void -__indirect_glSecondaryColor3ubvEXT(const GLubyte * v) +__indirect_glSecondaryColor3ubvEXT(const GLubyte *v) { generic_3_byte(X_GLrop_SecondaryColor3ubvEXT, v); } @@ -8943,7 +8943,7 @@ __indirect_glGetProgramParameterfvNV(GLenum target, GLuint index, #define X_GLvop_GetProgramStringNV 1299 void -__indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program) +__indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte *program) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; @@ -9087,7 +9087,7 @@ __indirect_glIsProgramNV(GLuint program) #define X_GLrop_LoadProgramNV 4183 void __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len, - const GLubyte * program) + const GLubyte *program) { __GLXcontext *const gc = __glXGetCurrentContext(); const GLuint cmdlen = 16 + __GLX_PAD(len); @@ -9656,7 +9656,7 @@ __indirect_glVertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, #define X_GLrop_VertexAttrib4ubvNV 4277 void -__indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte * v) +__indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte *v) { __GLXcontext *const gc = __glXGetCurrentContext(); const GLuint cmdlen = 12; @@ -9887,7 +9887,7 @@ __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v) #define X_GLrop_VertexAttribs4ubvNV 4214 void -__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte * v) +__indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte *v) { __GLXcontext *const gc = __glXGetCurrentContext(); const GLuint cmdlen = 12 + __GLX_PAD((n * 4)); @@ -9951,7 +9951,7 @@ __indirect_glActiveStencilFaceEXT(GLenum face) #define X_GLvop_GetProgramNamedParameterdvNV 1311 void __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, - const GLubyte * name, + const GLubyte *name, GLdouble * params) { __GLXcontext *const gc = __glXGetCurrentContext(); @@ -9975,7 +9975,7 @@ __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, #define X_GLvop_GetProgramNamedParameterfvNV 1310 void __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len, - const GLubyte * name, + const GLubyte *name, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); @@ -9999,7 +9999,7 @@ __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len, #define X_GLrop_ProgramNamedParameter4dvNV 4219 void __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len, - const GLubyte * name, GLdouble x, + const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w) { __GLXcontext *const gc = __glXGetCurrentContext(); @@ -10023,7 +10023,7 @@ __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len, #define X_GLrop_ProgramNamedParameter4dvNV 4219 void __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len, - const GLubyte * name, + const GLubyte *name, const GLdouble * v) { __GLXcontext *const gc = __glXGetCurrentContext(); @@ -10044,7 +10044,7 @@ __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len, #define X_GLrop_ProgramNamedParameter4fvNV 4218 void __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len, - const GLubyte * name, GLfloat x, + const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { __GLXcontext *const gc = __glXGetCurrentContext(); @@ -10068,7 +10068,7 @@ __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len, #define X_GLrop_ProgramNamedParameter4fvNV 4218 void __indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len, - const GLubyte * name, + const GLubyte *name, const GLfloat * v) { __GLXcontext *const gc = __glXGetCurrentContext(); diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h index e5b1fadf2b9..630062e2335 100644 --- a/src/glx/x11/indirect.h +++ b/src/glx/x11/indirect.h @@ -633,7 +633,7 @@ extern HIDDEN void __indirect_glGetProgramParameterfvNV(GLenum target, GLuint in extern HIDDEN void __indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program); extern HIDDEN void __indirect_glGetProgramivNV(GLuint id, GLenum pname, GLint * params); extern HIDDEN void __indirect_glGetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint * params); -extern HIDDEN void __indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid ** params); +extern HIDDEN void __indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid ** pointer); extern HIDDEN void __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params); extern HIDDEN void __indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params); extern HIDDEN void __indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params); diff --git a/src/glx/x11/indirect_vertex_array.c b/src/glx/x11/indirect_vertex_array.c index 429b52ae635..1855547dced 100644 --- a/src/glx/x11/indirect_vertex_array.c +++ b/src/glx/x11/indirect_vertex_array.c @@ -527,7 +527,7 @@ static GLubyte * emit_DrawArrays_header_old( __GLXcontext * gc, struct array_state_vector * arrays, size_t * elements_per_request, - unsigned int * total_requests, + size_t * total_requests, GLenum mode, GLsizei count ) { size_t command_size; @@ -640,7 +640,7 @@ emit_DrawArrays_old( GLenum mode, GLint first, GLsizei count ) GLubyte * pc; size_t elements_per_request; - unsigned total_requests = 0; + size_t total_requests = 0; unsigned i; size_t total_sent = 0; @@ -770,7 +770,7 @@ emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type, GLubyte * pc; size_t elements_per_request; - unsigned total_requests = 0; + size_t total_requests = 0; unsigned i; unsigned req; diff --git a/src/glx/x11/single2.c b/src/glx/x11/single2.c index 1c3b8f08ee2..d535757a9ed 100644 --- a/src/glx/x11/single2.c +++ b/src/glx/x11/single2.c @@ -145,9 +145,10 @@ GLenum __indirect_glGetError(void) * On success \c GL_TRUE is returned. Otherwise, \c GL_FALSE is returned. */ static GLboolean -get_client_data( __GLXattribute * state, GLenum cap, GLintptr * data ) +get_client_data( __GLXcontext * gc, GLenum cap, GLintptr * data ) { GLboolean retval = GL_TRUE; + __GLXattribute * state = (__GLXattribute *)(gc->client_state_private); const GLint tex_unit = __glXGetActiveTextureUnit( state ); @@ -281,6 +282,9 @@ get_client_data( __GLXattribute * state, GLenum cap, GLintptr * data ) case GL_UNPACK_LSB_FIRST: *data = (GLintptr)state->storeUnpack.lsbFirst; break; + case GL_CLIENT_ATTRIB_STACK_DEPTH: + *data = (GLintptr)(gc->attributes.stackPointer - gc->attributes.stack); + break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: *data = (GLintptr)__GL_CLIENT_ATTRIB_STACK_DEPTH; break; @@ -302,7 +306,6 @@ void __indirect_glGetBooleanv(GLenum val, GLboolean *b) { const GLenum origVal = val; __GLX_SINGLE_DECLARE_VARIABLES(); - __GLXattribute * state = (__GLXattribute *)(gc->client_state_private); xGLXSingleReply reply; val = RemapTransposeEnum( val ); @@ -326,7 +329,7 @@ void __indirect_glGetBooleanv(GLenum val, GLboolean *b) ** for example, to call a query between glBegin() and glEnd()). */ - if ( get_client_data( state, val, & data ) ) { + if ( get_client_data( gc, val, & data ) ) { *b = (GLboolean) data; } else { @@ -351,7 +354,6 @@ void __indirect_glGetDoublev(GLenum val, GLdouble *d) { const GLenum origVal = val; __GLX_SINGLE_DECLARE_VARIABLES(); - __GLXattribute * state = (__GLXattribute *)(gc->client_state_private); xGLXSingleReply reply; val = RemapTransposeEnum( val ); @@ -375,7 +377,7 @@ void __indirect_glGetDoublev(GLenum val, GLdouble *d) ** for example, to call a query between glBegin() and glEnd()). */ - if ( get_client_data( state, val, & data ) ) { + if ( get_client_data( gc, val, & data ) ) { *d = (GLdouble) data; } else { @@ -400,7 +402,6 @@ void __indirect_glGetFloatv(GLenum val, GLfloat *f) { const GLenum origVal = val; __GLX_SINGLE_DECLARE_VARIABLES(); - __GLXattribute * state = (__GLXattribute *)(gc->client_state_private); xGLXSingleReply reply; val = RemapTransposeEnum( val ); @@ -424,7 +425,7 @@ void __indirect_glGetFloatv(GLenum val, GLfloat *f) ** for example, to call a query between glBegin() and glEnd()). */ - if ( get_client_data( state, val, & data ) ) { + if ( get_client_data( gc, val, & data ) ) { *f = (GLfloat) data; } else { @@ -449,7 +450,6 @@ void __indirect_glGetIntegerv(GLenum val, GLint *i) { const GLenum origVal = val; __GLX_SINGLE_DECLARE_VARIABLES(); - __GLXattribute * state = (__GLXattribute *)(gc->client_state_private); xGLXSingleReply reply; val = RemapTransposeEnum( val ); @@ -473,7 +473,7 @@ void __indirect_glGetIntegerv(GLenum val, GLint *i) ** for example, to call a query between glBegin() and glEnd()). */ - if ( get_client_data( state, val, & data ) ) { + if ( get_client_data( gc, val, & data ) ) { *i = (GLint) data; } else { |