diff options
author | marha <marha@users.sourceforge.net> | 2012-03-27 17:04:46 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-27 17:04:46 +0200 |
commit | ec617f09d07e32d6f57c0da133f53ad3d43a568a (patch) | |
tree | 336f2ef770cf4bd48005f99fcbac22ec64ff51db /xorg-server/hw/xquartz/GL/glcontextmodes.c | |
parent | 1d6d472342aee7b9c68e9f1d92762ef808d35ac2 (diff) | |
download | vcxsrv-ec617f09d07e32d6f57c0da133f53ad3d43a568a.tar.gz vcxsrv-ec617f09d07e32d6f57c0da133f53ad3d43a568a.tar.bz2 vcxsrv-ec617f09d07e32d6f57c0da133f53ad3d43a568a.zip |
fontconfig libxcb xcb-proto mesa xserver git update 27 Mar 2012
Diffstat (limited to 'xorg-server/hw/xquartz/GL/glcontextmodes.c')
-rw-r--r-- | xorg-server/hw/xquartz/GL/glcontextmodes.c | 145 |
1 files changed, 97 insertions, 48 deletions
diff --git a/xorg-server/hw/xquartz/GL/glcontextmodes.c b/xorg-server/hw/xquartz/GL/glcontextmodes.c index 79fadf876..dc97f89e4 100644 --- a/xorg-server/hw/xquartz/GL/glcontextmodes.c +++ b/xorg-server/hw/xquartz/GL/glcontextmodes.c @@ -47,31 +47,31 @@ #include <stdlib.h> #include <string.h> #define _mesa_malloc(b) malloc(b) -#define _mesa_free(m) free(m) -#define _mesa_memset memset +#define _mesa_free(m) free(m) +#define _mesa_memset memset #else #ifdef XFree86Server #include <os.h> #include <string.h> #define _mesa_malloc(b) malloc(b) #define _mesa_free(m) free(m) -#define _mesa_memset memset +#define _mesa_memset memset #else #include <X11/Xlibint.h> #define _mesa_memset memset #define _mesa_malloc(b) Xmalloc(b) -#define _mesa_free(m) free(m) -#endif /* XFree86Server */ -#endif /* !defined(IN_MINI_GLX) */ +#define _mesa_free(m) free(m) +#endif /* XFree86Server */ +#endif /* !defined(IN_MINI_GLX) */ #include "glcontextmodes.h" #if !defined(IN_MINI_GLX) -#define NUM_VISUAL_TYPES 6 +#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 @@ -81,19 +81,19 @@ 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_GRAY, GLX_GRAY_SCALE, GLX_STATIC_COLOR, GLX_PSEUDO_COLOR, - GLX_TRUE_COLOR, GLX_DIRECT_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; } /** * Convert a GLX visual type to an X visual type. - * - * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR, + * + * \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. @@ -102,13 +102,13 @@ GLint _gl_convert_to_x_visual_type(int visualType) { static const int x_visual_types[NUM_VISUAL_TYPES] = { - TrueColor, DirectColor, + TrueColor, DirectColor, PseudoColor, StaticColor, - GrayScale, StaticGray + 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; } /** @@ -117,10 +117,10 @@ _gl_convert_to_x_visual_type(int visualType) * \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 derived 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. @@ -129,9 +129,9 @@ void _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)); + (void)_mesa_memset(mode, 0, sizeof(__GLcontextModes)); mode->next = next; mode->visualID = config->vid; @@ -190,17 +190,18 @@ _gl_copy_visual_to_context_mode(__GLcontextModes * mode, mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE; mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ? - GL_TRUE : GL_FALSE; + 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; + 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. @@ -208,151 +209,193 @@ _gl_copy_visual_to_context_mode(__GLcontextModes * mode, * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned. */ int -_gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, +_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 == GL_TRUE ? GL_TRUE : - GL_FALSE; + 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. - */ + /* 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) */ +#endif /* !defined(IN_MINI_GLX) */ /** * Allocate a linked list of \c __GLcontextModes structures. The fields of @@ -362,7 +405,7 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, * 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 @@ -370,7 +413,7 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute, * 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 @@ -384,21 +427,21 @@ __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; + ? minimum_size : sizeof(__GLcontextModes); + __GLcontextModes * base = NULL; + __GLcontextModes ** next; unsigned i; next = &base; for (i = 0; i < count; i++) { - *next = (__GLcontextModes *) _mesa_malloc(size); + *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; @@ -426,7 +469,7 @@ _gl_context_modes_create(unsigned count, size_t minimum_size) /** * 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. */ @@ -434,7 +477,7 @@ void _gl_context_modes_destroy(__GLcontextModes * modes) { while (modes != NULL) { - __GLcontextModes *const next = modes->next; + __GLcontextModes * const next = modes->next; _mesa_free(modes); modes = next; @@ -451,7 +494,7 @@ _gl_context_modes_destroy(__GLcontextModes * modes) */ __GLcontextModes * -_gl_context_modes_find_visual(__GLcontextModes * modes, int vid) +_gl_context_modes_find_visual(__GLcontextModes *modes, int vid) { __GLcontextModes *m; @@ -463,7 +506,7 @@ _gl_context_modes_find_visual(__GLcontextModes * modes, int vid) } __GLcontextModes * -_gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid) +_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid) { __GLcontextModes *m; @@ -477,7 +520,7 @@ _gl_context_modes_find_fbconfig(__GLcontextModes * modes, int fbid) /** * 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 @@ -494,11 +537,13 @@ _gl_context_modes_are_same(const __GLcontextModes * a, (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->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) && + (a->blueMask == b->blueMask) && + (a->alphaMask == b->alphaMask) && #endif (a->rgbBits == b->rgbBits) && (a->indexBits == b->indexBits) && @@ -512,14 +557,18 @@ _gl_context_modes_are_same(const __GLcontextModes * a, (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) && |