diff options
Diffstat (limited to 'xorg-server/glx')
-rw-r--r-- | xorg-server/glx/extension_string.c | 96 | ||||
-rw-r--r-- | xorg-server/glx/extension_string.h | 36 | ||||
-rw-r--r-- | xorg-server/glx/glxbyteorder.h | 4 | ||||
-rw-r--r-- | xorg-server/glx/glxdrawable.h | 28 | ||||
-rw-r--r-- | xorg-server/glx/glxext.h | 11 | ||||
-rw-r--r-- | xorg-server/glx/glxutil.h | 14 | ||||
-rw-r--r-- | xorg-server/glx/indirect_reqsize.c | 88 | ||||
-rw-r--r-- | xorg-server/glx/indirect_size_get.c | 3 | ||||
-rw-r--r-- | xorg-server/glx/indirect_table.h | 8 | ||||
-rw-r--r-- | xorg-server/glx/singlesize.h | 8 | ||||
-rw-r--r-- | xorg-server/glx/unpack.h | 461 |
11 files changed, 369 insertions, 388 deletions
diff --git a/xorg-server/glx/extension_string.c b/xorg-server/glx/extension_string.c index 7721cb056..866f8bf45 100644 --- a/xorg-server/glx/extension_string.c +++ b/xorg-server/glx/extension_string.c @@ -45,10 +45,10 @@ #define EXT_ENABLED(bit,supported) (IS_SET(supported, bit)) struct extension_info { - const char * const name; - unsigned name_len; + const char *const name; + unsigned name_len; - unsigned char bit; + unsigned char bit; /** * This is the lowest version of GLX that "requires" this extension. @@ -56,37 +56,36 @@ struct extension_info { * SGI_make_current_read. If the extension is not required by any known * version of GLX, use 0, 0. */ - unsigned char version_major; - unsigned char version_minor; + unsigned char version_major; + unsigned char version_minor; /** * Is driver support forced by the ABI? */ - unsigned char driver_support; + unsigned char driver_support; }; static const struct extension_info known_glx_extensions[] = { /* GLX_ARB_get_proc_address is implemented on the client. */ - { GLX(ARB_multisample), VER(1,4), Y, }, - - { GLX(EXT_import_context), VER(0,0), Y, }, - { GLX(EXT_texture_from_pixmap), VER(0,0), Y, }, - { GLX(EXT_visual_info), VER(0,0), Y, }, - { GLX(EXT_visual_rating), VER(0,0), Y, }, - - { GLX(MESA_copy_sub_buffer), VER(0,0), N, }, - { GLX(OML_swap_method), VER(0,0), Y, }, - { GLX(SGI_make_current_read), VER(1,3), N, }, - { GLX(SGI_swap_control), VER(0,0), N, }, - { GLX(SGIS_multisample), VER(0,0), Y, }, - { GLX(SGIX_fbconfig), VER(1,3), Y, }, - { GLX(SGIX_pbuffer), VER(1,3), Y, }, - { GLX(SGIX_visual_select_group), VER(0,0), Y, }, - { GLX(INTEL_swap_event), VER(1,4), N, }, - { NULL } + {GLX(ARB_multisample), VER(1, 4), Y,}, + + {GLX(EXT_import_context), VER(0, 0), Y,}, + {GLX(EXT_texture_from_pixmap), VER(0, 0), Y,}, + {GLX(EXT_visual_info), VER(0, 0), Y,}, + {GLX(EXT_visual_rating), VER(0, 0), Y,}, + + {GLX(MESA_copy_sub_buffer), VER(0, 0), N,}, + {GLX(OML_swap_method), VER(0, 0), Y,}, + {GLX(SGI_make_current_read), VER(1, 3), N,}, + {GLX(SGI_swap_control), VER(0, 0), N,}, + {GLX(SGIS_multisample), VER(0, 0), Y,}, + {GLX(SGIX_fbconfig), VER(1, 3), Y,}, + {GLX(SGIX_pbuffer), VER(1, 3), Y,}, + {GLX(SGIX_visual_select_group), VER(0, 0), Y,}, + {GLX(INTEL_swap_event), VER(1, 4), N,}, + {NULL} }; - /** * Create a GLX extension string for a set of enable bits. * @@ -111,56 +110,51 @@ __glXGetExtensionString(const unsigned char *enable_bits, char *buffer) unsigned i; int length = 0; - for (i = 0; known_glx_extensions[i].name != NULL; i++) { - const unsigned bit = known_glx_extensions[i].bit; - const size_t len = known_glx_extensions[i].name_len; - - if (EXT_ENABLED(bit, enable_bits)) { - if (buffer != NULL) { - (void) memcpy(& buffer[length], known_glx_extensions[i].name, - len); - - buffer[length + len + 0] = ' '; - buffer[length + len + 1] = '\0'; - } - - length += len + 1; - } + const unsigned bit = known_glx_extensions[i].bit; + const size_t len = known_glx_extensions[i].name_len; + + if (EXT_ENABLED(bit, enable_bits)) { + if (buffer != NULL) { + (void) memcpy(&buffer[length], known_glx_extensions[i].name, + len); + + buffer[length + len + 0] = ' '; + buffer[length + len + 1] = '\0'; + } + + length += len + 1; + } } return length + 1; } - void __glXEnableExtension(unsigned char *enable_bits, const char *ext) { const size_t ext_name_len = strlen(ext); unsigned i; - for (i = 0; known_glx_extensions[i].name != NULL; i++) { - if ((ext_name_len == known_glx_extensions[i].name_len) - && (memcmp(ext, known_glx_extensions[i].name, ext_name_len) == 0)) { - SET_BIT(enable_bits, known_glx_extensions[i].bit); - break; - } + if ((ext_name_len == known_glx_extensions[i].name_len) + && (memcmp(ext, known_glx_extensions[i].name, ext_name_len) == 0)) { + SET_BIT(enable_bits, known_glx_extensions[i].bit); + break; + } } } - void __glXInitExtensionEnableBits(unsigned char *enable_bits) { unsigned i; - (void) memset(enable_bits, 0, __GLX_EXT_BYTES); for (i = 0; known_glx_extensions[i].name != NULL; i++) { - if (known_glx_extensions[i].driver_support) { - SET_BIT(enable_bits, known_glx_extensions[i].bit); - } + if (known_glx_extensions[i].driver_support) { + SET_BIT(enable_bits, known_glx_extensions[i].bit); + } } } diff --git a/xorg-server/glx/extension_string.h b/xorg-server/glx/extension_string.h index 912534a04..e02213f8f 100644 --- a/xorg-server/glx/extension_string.h +++ b/xorg-server/glx/extension_string.h @@ -36,29 +36,29 @@ enum { /* GLX_ARB_get_proc_address is implemented on the client. */ - ARB_multisample_bit = 0, - EXT_import_context_bit, - EXT_texture_from_pixmap_bit, - EXT_visual_info_bit, - EXT_visual_rating_bit, - MESA_copy_sub_buffer_bit, - OML_swap_method_bit, - SGI_make_current_read_bit, - SGI_swap_control_bit, - SGI_video_sync_bit, - SGIS_multisample_bit, - SGIX_fbconfig_bit, - SGIX_pbuffer_bit, - SGIX_visual_select_group_bit, - INTEL_swap_event_bit, - __NUM_GLX_EXTS, + ARB_multisample_bit = 0, + EXT_import_context_bit, + EXT_texture_from_pixmap_bit, + EXT_visual_info_bit, + EXT_visual_rating_bit, + MESA_copy_sub_buffer_bit, + OML_swap_method_bit, + SGI_make_current_read_bit, + SGI_swap_control_bit, + SGI_video_sync_bit, + SGIS_multisample_bit, + SGIX_fbconfig_bit, + SGIX_pbuffer_bit, + SGIX_visual_select_group_bit, + INTEL_swap_event_bit, + __NUM_GLX_EXTS, }; #define __GLX_EXT_BYTES ((__NUM_GLX_EXTS + 7) / 8) extern int __glXGetExtensionString(const unsigned char *enable_bits, - char *buffer); + char *buffer); extern void __glXEnableExtension(unsigned char *enable_bits, const char *ext); extern void __glXInitExtensionEnableBits(unsigned char *enable_bits); -#endif /* GLX_EXTENSION_STRING_H */ +#endif /* GLX_EXTENSION_STRING_H */ diff --git a/xorg-server/glx/glxbyteorder.h b/xorg-server/glx/glxbyteorder.h index cdf6b15f0..73f0f7df7 100644 --- a/xorg-server/glx/glxbyteorder.h +++ b/xorg-server/glx/glxbyteorder.h @@ -51,11 +51,11 @@ #define bswap_32(value) \ (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ (uint32_t)bswap_16((uint16_t)((value) >> 16))) - + #define bswap_64(value) \ (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ << 32) | \ (uint64_t)bswap_32((uint32_t)((value) >> 32))) #endif -#endif /* !defined(__GLXBYTEORDER_H__) */ +#endif /* !defined(__GLXBYTEORDER_H__) */ diff --git a/xorg-server/glx/glxdrawable.h b/xorg-server/glx/glxdrawable.h index 2a365c505..007658961 100644 --- a/xorg-server/glx/glxdrawable.h +++ b/xorg-server/glx/glxdrawable.h @@ -44,34 +44,34 @@ enum { }; struct __GLXdrawable { - void (*destroy)(__GLXdrawable *private); - GLboolean (*swapBuffers)(ClientPtr client, __GLXdrawable *); - void (*copySubBuffer)(__GLXdrawable *drawable, - int x, int y, int w, int h); - void (*waitX)(__GLXdrawable *); - void (*waitGL)(__GLXdrawable *); + void (*destroy) (__GLXdrawable * private); + GLboolean(*swapBuffers) (ClientPtr client, __GLXdrawable *); + void (*copySubBuffer) (__GLXdrawable * drawable, + int x, int y, int w, int h); + void (*waitX) (__GLXdrawable *); + void (*waitGL) (__GLXdrawable *); DrawablePtr pDraw; XID drawId; /* - ** Either GLX_DRAWABLE_PIXMAP, GLX_DRAWABLE_WINDOW or - ** GLX_DRAWABLE_PBUFFER. - */ + ** Either GLX_DRAWABLE_PIXMAP, GLX_DRAWABLE_WINDOW or + ** GLX_DRAWABLE_PBUFFER. + */ int type; /* - ** Configuration of the visual to which this drawable was created. - */ + ** Configuration of the visual to which this drawable was created. + */ __GLXconfig *config; GLenum target; GLenum format; /* - ** Event mask - */ + ** Event mask + */ unsigned long eventMask; }; -#endif /* !__GLX_drawable_h__ */ +#endif /* !__GLX_drawable_h__ */ diff --git a/xorg-server/glx/glxext.h b/xorg-server/glx/glxext.h index 58cf0540f..7cd5cb49f 100644 --- a/xorg-server/glx/glxext.h +++ b/xorg-server/glx/glxext.h @@ -35,17 +35,16 @@ * Silicon Graphics, Inc. */ -extern GLboolean __glXFreeContext(__GLXcontext *glxc); +extern GLboolean __glXFreeContext(__GLXcontext * glxc); extern void __glXFlushContextCache(void); -extern void __glXAddToContextList(__GLXcontext *cx); +extern void __glXAddToContextList(__GLXcontext * cx); extern void __glXErrorCallBack(GLenum code); extern void __glXClearErrorOccured(void); extern GLboolean __glXErrorOccured(void); -extern void __glXResetLargeCommandStatus(__GLXclientState*); +extern void __glXResetLargeCommandStatus(__GLXclientState *); extern const char GLServerVersion[]; -extern int DoGetString(__GLXclientState *cl, GLbyte *pc, GLboolean need_swap); - -#endif /* _glxext_h_ */ +extern int DoGetString(__GLXclientState * cl, GLbyte * pc, GLboolean need_swap); +#endif /* _glxext_h_ */ diff --git a/xorg-server/glx/glxutil.h b/xorg-server/glx/glxutil.h index d1a715b4b..314606da2 100644 --- a/xorg-server/glx/glxutil.h +++ b/xorg-server/glx/glxutil.h @@ -35,17 +35,17 @@ * Silicon Graphics, Inc. */ -extern GLboolean __glXDrawableInit(__GLXdrawable *drawable, - __GLXscreen *screen, - DrawablePtr pDraw, int type, XID drawID, - __GLXconfig *config); -extern void __glXDrawableRelease(__GLXdrawable *drawable); +extern GLboolean __glXDrawableInit(__GLXdrawable * drawable, + __GLXscreen * screen, + DrawablePtr pDraw, int type, XID drawID, + __GLXconfig * config); +extern void __glXDrawableRelease(__GLXdrawable * drawable); /* context helper routines */ -extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag); +extern __GLXcontext *__glXLookupContextByTag(__GLXclientState *, GLXContextTag); /* init helper routines */ extern void *__glXglDDXScreenInfo(void); extern void *__glXglDDXExtensionInfo(void); -#endif /* _glxcmds_h_ */ +#endif /* _glxcmds_h_ */ diff --git a/xorg-server/glx/indirect_reqsize.c b/xorg-server/glx/indirect_reqsize.c index 20e2a5de1..86ea9700f 100644 --- a/xorg-server/glx/indirect_reqsize.c +++ b/xorg-server/glx/indirect_reqsize.c @@ -25,7 +25,6 @@ * SOFTWARE. */ - #include <GL/gl.h> #include "glxserver.h" #include "glxbyteorder.h" @@ -48,9 +47,8 @@ { return __glX ## to ## ReqSize( pc, swap ); } #endif - int -__glXCallListsReqSize(const GLbyte *pc, Bool swap) +__glXCallListsReqSize(const GLbyte * pc, Bool swap) { GLsizei n = *(GLsizei *) (pc + 0); GLenum type = *(GLenum *) (pc + 4); @@ -66,7 +64,7 @@ __glXCallListsReqSize(const GLbyte *pc, Bool swap) } int -__glXBitmapReqSize(const GLbyte *pc, Bool swap) +__glXBitmapReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -90,7 +88,7 @@ __glXBitmapReqSize(const GLbyte *pc, Bool swap) } int -__glXFogfvReqSize(const GLbyte *pc, Bool swap) +__glXFogfvReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 0); GLsizei compsize; @@ -104,7 +102,7 @@ __glXFogfvReqSize(const GLbyte *pc, Bool swap) } int -__glXLightfvReqSize(const GLbyte *pc, Bool swap) +__glXLightfvReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; @@ -118,7 +116,7 @@ __glXLightfvReqSize(const GLbyte *pc, Bool swap) } int -__glXLightModelfvReqSize(const GLbyte *pc, Bool swap) +__glXLightModelfvReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 0); GLsizei compsize; @@ -132,7 +130,7 @@ __glXLightModelfvReqSize(const GLbyte *pc, Bool swap) } int -__glXMaterialfvReqSize(const GLbyte *pc, Bool swap) +__glXMaterialfvReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; @@ -146,7 +144,7 @@ __glXMaterialfvReqSize(const GLbyte *pc, Bool swap) } int -__glXPolygonStippleReqSize(const GLbyte *pc, Bool swap) +__glXPolygonStippleReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -166,7 +164,7 @@ __glXPolygonStippleReqSize(const GLbyte *pc, Bool swap) } int -__glXTexParameterfvReqSize(const GLbyte *pc, Bool swap) +__glXTexParameterfvReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; @@ -180,7 +178,7 @@ __glXTexParameterfvReqSize(const GLbyte *pc, Bool swap) } int -__glXTexImage1DReqSize(const GLbyte *pc, Bool swap) +__glXTexImage1DReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -208,7 +206,7 @@ __glXTexImage1DReqSize(const GLbyte *pc, Bool swap) } int -__glXTexImage2DReqSize(const GLbyte *pc, Bool swap) +__glXTexImage2DReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -238,7 +236,7 @@ __glXTexImage2DReqSize(const GLbyte *pc, Bool swap) } int -__glXTexEnvfvReqSize(const GLbyte *pc, Bool swap) +__glXTexEnvfvReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; @@ -252,7 +250,7 @@ __glXTexEnvfvReqSize(const GLbyte *pc, Bool swap) } int -__glXTexGendvReqSize(const GLbyte *pc, Bool swap) +__glXTexGendvReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; @@ -266,7 +264,7 @@ __glXTexGendvReqSize(const GLbyte *pc, Bool swap) } int -__glXTexGenfvReqSize(const GLbyte *pc, Bool swap) +__glXTexGenfvReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; @@ -280,7 +278,7 @@ __glXTexGenfvReqSize(const GLbyte *pc, Bool swap) } int -__glXPixelMapfvReqSize(const GLbyte *pc, Bool swap) +__glXPixelMapfvReqSize(const GLbyte * pc, Bool swap) { GLsizei mapsize = *(GLsizei *) (pc + 4); @@ -292,7 +290,7 @@ __glXPixelMapfvReqSize(const GLbyte *pc, Bool swap) } int -__glXPixelMapusvReqSize(const GLbyte *pc, Bool swap) +__glXPixelMapusvReqSize(const GLbyte * pc, Bool swap) { GLsizei mapsize = *(GLsizei *) (pc + 4); @@ -304,7 +302,7 @@ __glXPixelMapusvReqSize(const GLbyte *pc, Bool swap) } int -__glXDrawPixelsReqSize(const GLbyte *pc, Bool swap) +__glXDrawPixelsReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -332,7 +330,7 @@ __glXDrawPixelsReqSize(const GLbyte *pc, Bool swap) } int -__glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap) +__glXPrioritizeTexturesReqSize(const GLbyte * pc, Bool swap) { GLsizei n = *(GLsizei *) (pc + 0); @@ -344,7 +342,7 @@ __glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap) } int -__glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap) +__glXTexSubImage1DReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -372,7 +370,7 @@ __glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap) } int -__glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap) +__glXTexSubImage2DReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -402,7 +400,7 @@ __glXTexSubImage2DReqSize(const GLbyte *pc, Bool swap) } int -__glXColorTableReqSize(const GLbyte *pc, Bool swap) +__glXColorTableReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -430,7 +428,7 @@ __glXColorTableReqSize(const GLbyte *pc, Bool swap) } int -__glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap) +__glXColorTableParameterfvReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; @@ -444,7 +442,7 @@ __glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap) } int -__glXColorSubTableReqSize(const GLbyte *pc, Bool swap) +__glXColorSubTableReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -472,7 +470,7 @@ __glXColorSubTableReqSize(const GLbyte *pc, Bool swap) } int -__glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap) +__glXConvolutionFilter1DReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -500,7 +498,7 @@ __glXConvolutionFilter1DReqSize(const GLbyte *pc, Bool swap) } int -__glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap) +__glXConvolutionFilter2DReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; @@ -530,7 +528,7 @@ __glXConvolutionFilter2DReqSize(const GLbyte *pc, Bool swap) } int -__glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap) +__glXConvolutionParameterfvReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; @@ -544,7 +542,7 @@ __glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap) } int -__glXTexImage3DReqSize(const GLbyte *pc, Bool swap) +__glXTexImage3DReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = *(GLint *) (pc + 8); @@ -581,7 +579,7 @@ __glXTexImage3DReqSize(const GLbyte *pc, Bool swap) } int -__glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap) +__glXTexSubImage3DReqSize(const GLbyte * pc, Bool swap) { GLint row_length = *(GLint *) (pc + 4); GLint image_height = *(GLint *) (pc + 8); @@ -615,7 +613,7 @@ __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap) } int -__glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap) +__glXCompressedTexImage1DARBReqSize(const GLbyte * pc, Bool swap) { GLsizei imageSize = *(GLsizei *) (pc + 20); @@ -627,7 +625,7 @@ __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap) } int -__glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap) +__glXCompressedTexImage2DARBReqSize(const GLbyte * pc, Bool swap) { GLsizei imageSize = *(GLsizei *) (pc + 24); @@ -639,7 +637,7 @@ __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap) } int -__glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap) +__glXCompressedTexImage3DARBReqSize(const GLbyte * pc, Bool swap) { GLsizei imageSize = *(GLsizei *) (pc + 28); @@ -651,7 +649,7 @@ __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap) } int -__glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap) +__glXCompressedTexSubImage3DARBReqSize(const GLbyte * pc, Bool swap) { GLsizei imageSize = *(GLsizei *) (pc + 36); @@ -663,7 +661,7 @@ __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap) } int -__glXProgramStringARBReqSize(const GLbyte *pc, Bool swap) +__glXProgramStringARBReqSize(const GLbyte * pc, Bool swap) { GLsizei len = *(GLsizei *) (pc + 8); @@ -675,7 +673,7 @@ __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap) } int -__glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap) +__glXDrawBuffersARBReqSize(const GLbyte * pc, Bool swap) { GLsizei n = *(GLsizei *) (pc + 0); @@ -687,7 +685,7 @@ __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap) } int -__glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap) +__glXPointParameterfvEXTReqSize(const GLbyte * pc, Bool swap) { GLenum pname = *(GLenum *) (pc + 0); GLsizei compsize; @@ -701,7 +699,7 @@ __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap) } int -__glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap) +__glXProgramParameters4dvNVReqSize(const GLbyte * pc, Bool swap) { GLsizei num = *(GLsizei *) (pc + 8); @@ -713,7 +711,7 @@ __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap) } int -__glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap) +__glXProgramParameters4fvNVReqSize(const GLbyte * pc, Bool swap) { GLsizei num = *(GLsizei *) (pc + 8); @@ -725,7 +723,7 @@ __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap) } int -__glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap) +__glXVertexAttribs1dvNVReqSize(const GLbyte * pc, Bool swap) { GLsizei n = *(GLsizei *) (pc + 4); @@ -737,7 +735,7 @@ __glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap) } int -__glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap) +__glXVertexAttribs2dvNVReqSize(const GLbyte * pc, Bool swap) { GLsizei n = *(GLsizei *) (pc + 4); @@ -749,7 +747,7 @@ __glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap) } int -__glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap) +__glXVertexAttribs3dvNVReqSize(const GLbyte * pc, Bool swap) { GLsizei n = *(GLsizei *) (pc + 4); @@ -761,7 +759,7 @@ __glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap) } int -__glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap) +__glXVertexAttribs3fvNVReqSize(const GLbyte * pc, Bool swap) { GLsizei n = *(GLsizei *) (pc + 4); @@ -773,7 +771,7 @@ __glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap) } int -__glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap) +__glXVertexAttribs3svNVReqSize(const GLbyte * pc, Bool swap) { GLsizei n = *(GLsizei *) (pc + 4); @@ -785,7 +783,7 @@ __glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap) } int -__glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap) +__glXVertexAttribs4dvNVReqSize(const GLbyte * pc, Bool swap) { GLsizei n = *(GLsizei *) (pc + 4); @@ -797,7 +795,7 @@ __glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap) } int -__glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap) +__glXProgramNamedParameter4fvNVReqSize(const GLbyte * pc, Bool swap) { GLsizei len = *(GLsizei *) (pc + 4); diff --git a/xorg-server/glx/indirect_size_get.c b/xorg-server/glx/indirect_size_get.c index 3e5687d2f..da3a6cb85 100644 --- a/xorg-server/glx/indirect_size_get.c +++ b/xorg-server/glx/indirect_size_get.c @@ -25,7 +25,6 @@ * SOFTWARE. */ - #include <X11/Xfuncproto.h> #include <GL/gl.h> #include "indirect_size_get.h" @@ -45,7 +44,6 @@ #define FASTCALL #endif - #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(GLX_USE_APPLEGL) #undef HAVE_ALIAS #endif @@ -60,7 +58,6 @@ { return __gl ## to ## _size( e ); } #endif - _X_INTERNAL PURE FASTCALL GLint __glCallLists_size(GLenum e) { diff --git a/xorg-server/glx/indirect_table.h b/xorg-server/glx/indirect_table.h index 4af1ccbea..a39dc4e3d 100644 --- a/xorg-server/glx/indirect_table.h +++ b/xorg-server/glx/indirect_table.h @@ -45,8 +45,8 @@ struct __glXDispatchInfo { /** */ - const int_fast16_t * dispatch_tree; - + const int_fast16_t *dispatch_tree; + /** * Array of protocol decode and dispatch functions index by the opcode * search tree (i.e., \c dispatch_tree). The first element in each pair @@ -70,7 +70,7 @@ struct __glXDispatchInfo { * If size checking is not to be performed on this type of protocol * data, this pointer will be \c NULL. */ - const int_fast16_t (*size_table)[2]; + const int_fast16_t(*size_table)[2]; /** * Array of functions used to calculate the variable-size portion of @@ -103,4 +103,4 @@ extern const struct __glXDispatchInfo Single_dispatch_info; extern const struct __glXDispatchInfo Render_dispatch_info; extern const struct __glXDispatchInfo VendorPriv_dispatch_info; -#endif /* INDIRECT_TABLE_H */ +#endif /* INDIRECT_TABLE_H */ diff --git a/xorg-server/glx/singlesize.h b/xorg-server/glx/singlesize.h index 78826dfb0..dc85d3d36 100644 --- a/xorg-server/glx/singlesize.h +++ b/xorg-server/glx/singlesize.h @@ -38,7 +38,7 @@ #include "indirect_size.h" extern GLint __glReadPixels_size(GLenum format, GLenum type, - GLint width, GLint height); + GLint width, GLint height); extern GLint __glGetMap_size(GLenum pname, GLenum query); extern GLint __glGetMapdv_size(GLenum target, GLenum query); extern GLint __glGetMapfv_size(GLenum target, GLenum query); @@ -48,7 +48,7 @@ extern GLint __glGetPixelMapfv_size(GLenum map); extern GLint __glGetPixelMapuiv_size(GLenum map); extern GLint __glGetPixelMapusv_size(GLenum map); extern GLint __glGetTexImage_size(GLenum target, GLint level, GLenum format, - GLenum type, GLint width, GLint height, - GLint depth); + GLenum type, GLint width, GLint height, + GLint depth); -#endif /* _singlesize_h_ */ +#endif /* _singlesize_h_ */ diff --git a/xorg-server/glx/unpack.h b/xorg-server/glx/unpack.h index a5f211555..0a088fc33 100644 --- a/xorg-server/glx/unpack.h +++ b/xorg-server/glx/unpack.h @@ -1,234 +1,227 @@ -#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifndef __GLX_unpack_h__
-#define __GLX_unpack_h__
-
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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 NONINFRINGEMENT. IN NO EVENT SHALL
- * SILICON GRAPHICS, INC. 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.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#define __GLX_PAD(s) (((s)+3) & (GLuint)~3)
-
-/*
-** Fetch the context-id out of a SingleReq request pointed to by pc.
-*/
-#define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag)
-#define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag)
-
-/*
-** Fetch a double from potentially unaligned memory.
-*/
-#ifdef __GLX_ALIGN64
-#define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n)
-#define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8)
-#else
-#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src))
-#endif
-
-extern void __glXMemInit(void);
-
-extern xGLXSingleReply __glXReply;
-
-#define __GLX_BEGIN_REPLY(size) \
- __glXReply.length = __GLX_PAD(size) >> 2; \
- __glXReply.type = X_Reply; \
- __glXReply.sequenceNumber = client->sequence;
-
-#define __GLX_SEND_HEADER() \
- WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply);
-
-#define __GLX_PUT_RETVAL(a) \
- __glXReply.retval = (a);
-
-#define __GLX_PUT_SIZE(a) \
- __glXReply.size = (a);
-
-#define __GLX_PUT_RENDERMODE(m) \
- __glXReply.pad3 = (m)
-
-/*
-** Get a buffer to hold returned data, with the given alignment. If we have
-** to realloc, allocate size+align, in case the pointer has to be bumped for
-** alignment. The answerBuffer should already be aligned.
-**
-** NOTE: the cast (long)res below assumes a long is large enough to hold a
-** pointer.
-*/
-#define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \
- if ((size) > sizeof(answerBuffer)) { \
- int bump; \
- if ((cl)->returnBufSize < (size)+(align)) { \
- (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \
- (size)+(align)); \
- if (!(cl)->returnBuf) { \
- return BadAlloc; \
- } \
- (cl)->returnBufSize = (size)+(align); \
- } \
- res = (char*)cl->returnBuf; \
- bump = (long)(res) % (align); \
- if (bump) res += (align) - (bump); \
- } else { \
- res = (char *)answerBuffer; \
- }
-
-#define __GLX_PUT_BYTE() \
- *(GLbyte *)&__glXReply.pad3 = *(GLbyte *)answer
-
-#define __GLX_PUT_SHORT() \
- *(GLshort *)&__glXReply.pad3 = *(GLshort *)answer
-
-#define __GLX_PUT_INT() \
- *(GLint *)&__glXReply.pad3 = *(GLint *)answer
-
-#define __GLX_PUT_FLOAT() \
- *(GLfloat *)&__glXReply.pad3 = *(GLfloat *)answer
-
-#define __GLX_PUT_DOUBLE() \
- *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer
-
-#define __GLX_SEND_BYTE_ARRAY(len) \
- WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer)
-
-#define __GLX_SEND_SHORT_ARRAY(len) \
- WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer)
-
-#define __GLX_SEND_INT_ARRAY(len) \
- WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer)
-
-#define __GLX_SEND_FLOAT_ARRAY(len) \
- WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer)
-
-#define __GLX_SEND_DOUBLE_ARRAY(len) \
- WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer)
-
-
-#define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
-#define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
-#define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len)
-#define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len)
-
-/*
-** PERFORMANCE NOTE:
-** Machine dependent optimizations abound here; these swapping macros can
-** conceivably be replaced with routines that do the job faster.
-*/
-#define __GLX_DECLARE_SWAP_VARIABLES \
- GLbyte sw
-
-#define __GLX_DECLARE_SWAP_ARRAY_VARIABLES \
- GLbyte *swapPC; \
- GLbyte *swapEnd
-
-
-#define __GLX_SWAP_INT(pc) \
- sw = ((GLbyte *)(pc))[0]; \
- ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \
- ((GLbyte *)(pc))[3] = sw; \
- sw = ((GLbyte *)(pc))[1]; \
- ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \
- ((GLbyte *)(pc))[2] = sw;
-
-#define __GLX_SWAP_SHORT(pc) \
- sw = ((GLbyte *)(pc))[0]; \
- ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[1]; \
- ((GLbyte *)(pc))[1] = sw;
-
-#define __GLX_SWAP_DOUBLE(pc) \
- sw = ((GLbyte *)(pc))[0]; \
- ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[7]; \
- ((GLbyte *)(pc))[7] = sw; \
- sw = ((GLbyte *)(pc))[1]; \
- ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[6]; \
- ((GLbyte *)(pc))[6] = sw; \
- sw = ((GLbyte *)(pc))[2]; \
- ((GLbyte *)(pc))[2] = ((GLbyte *)(pc))[5]; \
- ((GLbyte *)(pc))[5] = sw; \
- sw = ((GLbyte *)(pc))[3]; \
- ((GLbyte *)(pc))[3] = ((GLbyte *)(pc))[4]; \
- ((GLbyte *)(pc))[4] = sw;
-
-#define __GLX_SWAP_FLOAT(pc) \
- sw = ((GLbyte *)(pc))[0]; \
- ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \
- ((GLbyte *)(pc))[3] = sw; \
- sw = ((GLbyte *)(pc))[1]; \
- ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \
- ((GLbyte *)(pc))[2] = sw;
-
-#define __GLX_SWAP_INT_ARRAY(pc, count) \
- swapPC = ((GLbyte *)(pc)); \
- swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\
- while (swapPC < swapEnd) { \
- __GLX_SWAP_INT(swapPC); \
- swapPC += __GLX_SIZE_INT32; \
- }
-
-#define __GLX_SWAP_SHORT_ARRAY(pc, count) \
- swapPC = ((GLbyte *)(pc)); \
- swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\
- while (swapPC < swapEnd) { \
- __GLX_SWAP_SHORT(swapPC); \
- swapPC += __GLX_SIZE_INT16; \
- }
-
-#define __GLX_SWAP_DOUBLE_ARRAY(pc, count) \
- swapPC = ((GLbyte *)(pc)); \
- swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\
- while (swapPC < swapEnd) { \
- __GLX_SWAP_DOUBLE(swapPC); \
- swapPC += __GLX_SIZE_FLOAT64; \
- }
-
-#define __GLX_SWAP_FLOAT_ARRAY(pc, count) \
- swapPC = ((GLbyte *)(pc)); \
- swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\
- while (swapPC < swapEnd) { \
- __GLX_SWAP_FLOAT(swapPC); \
- swapPC += __GLX_SIZE_FLOAT32; \
- }
-
-#define __GLX_SWAP_REPLY_HEADER() \
- __GLX_SWAP_SHORT(&__glXReply.sequenceNumber); \
- __GLX_SWAP_INT(&__glXReply.length);
-
-#define __GLX_SWAP_REPLY_RETVAL() \
- __GLX_SWAP_INT(&__glXReply.retval)
-
-#define __GLX_SWAP_REPLY_SIZE() \
- __GLX_SWAP_INT(&__glXReply.size)
-
-#endif /* !__GLX_unpack_h__ */
-
-
-
-
-
+#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#ifndef __GLX_unpack_h__ +#define __GLX_unpack_h__ + +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#define __GLX_PAD(s) (((s)+3) & (GLuint)~3) + +/* +** Fetch the context-id out of a SingleReq request pointed to by pc. +*/ +#define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag) +#define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag) + +/* +** Fetch a double from potentially unaligned memory. +*/ +#ifdef __GLX_ALIGN64 +#define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n) +#define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8) +#else +#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) +#endif + +extern void __glXMemInit(void); + +extern xGLXSingleReply __glXReply; + +#define __GLX_BEGIN_REPLY(size) \ + __glXReply.length = __GLX_PAD(size) >> 2; \ + __glXReply.type = X_Reply; \ + __glXReply.sequenceNumber = client->sequence; + +#define __GLX_SEND_HEADER() \ + WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply); + +#define __GLX_PUT_RETVAL(a) \ + __glXReply.retval = (a); + +#define __GLX_PUT_SIZE(a) \ + __glXReply.size = (a); + +#define __GLX_PUT_RENDERMODE(m) \ + __glXReply.pad3 = (m) + +/* +** Get a buffer to hold returned data, with the given alignment. If we have +** to realloc, allocate size+align, in case the pointer has to be bumped for +** alignment. The answerBuffer should already be aligned. +** +** NOTE: the cast (long)res below assumes a long is large enough to hold a +** pointer. +*/ +#define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \ + if ((size) > sizeof(answerBuffer)) { \ + int bump; \ + if ((cl)->returnBufSize < (size)+(align)) { \ + (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \ + (size)+(align)); \ + if (!(cl)->returnBuf) { \ + return BadAlloc; \ + } \ + (cl)->returnBufSize = (size)+(align); \ + } \ + res = (char*)cl->returnBuf; \ + bump = (long)(res) % (align); \ + if (bump) res += (align) - (bump); \ + } else { \ + res = (char *)answerBuffer; \ + } + +#define __GLX_PUT_BYTE() \ + *(GLbyte *)&__glXReply.pad3 = *(GLbyte *)answer + +#define __GLX_PUT_SHORT() \ + *(GLshort *)&__glXReply.pad3 = *(GLshort *)answer + +#define __GLX_PUT_INT() \ + *(GLint *)&__glXReply.pad3 = *(GLint *)answer + +#define __GLX_PUT_FLOAT() \ + *(GLfloat *)&__glXReply.pad3 = *(GLfloat *)answer + +#define __GLX_PUT_DOUBLE() \ + *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer + +#define __GLX_SEND_BYTE_ARRAY(len) \ + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer) + +#define __GLX_SEND_SHORT_ARRAY(len) \ + WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer) + +#define __GLX_SEND_INT_ARRAY(len) \ + WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer) + +#define __GLX_SEND_FLOAT_ARRAY(len) \ + WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer) + +#define __GLX_SEND_DOUBLE_ARRAY(len) \ + WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer) + +#define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) +#define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) +#define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len) +#define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len) + +/* +** PERFORMANCE NOTE: +** Machine dependent optimizations abound here; these swapping macros can +** conceivably be replaced with routines that do the job faster. +*/ +#define __GLX_DECLARE_SWAP_VARIABLES \ + GLbyte sw + +#define __GLX_DECLARE_SWAP_ARRAY_VARIABLES \ + GLbyte *swapPC; \ + GLbyte *swapEnd + +#define __GLX_SWAP_INT(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ + ((GLbyte *)(pc))[3] = sw; \ + sw = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ + ((GLbyte *)(pc))[2] = sw; + +#define __GLX_SWAP_SHORT(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = sw; + +#define __GLX_SWAP_DOUBLE(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[7]; \ + ((GLbyte *)(pc))[7] = sw; \ + sw = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[6]; \ + ((GLbyte *)(pc))[6] = sw; \ + sw = ((GLbyte *)(pc))[2]; \ + ((GLbyte *)(pc))[2] = ((GLbyte *)(pc))[5]; \ + ((GLbyte *)(pc))[5] = sw; \ + sw = ((GLbyte *)(pc))[3]; \ + ((GLbyte *)(pc))[3] = ((GLbyte *)(pc))[4]; \ + ((GLbyte *)(pc))[4] = sw; + +#define __GLX_SWAP_FLOAT(pc) \ + sw = ((GLbyte *)(pc))[0]; \ + ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ + ((GLbyte *)(pc))[3] = sw; \ + sw = ((GLbyte *)(pc))[1]; \ + ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ + ((GLbyte *)(pc))[2] = sw; + +#define __GLX_SWAP_INT_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_INT(swapPC); \ + swapPC += __GLX_SIZE_INT32; \ + } + +#define __GLX_SWAP_SHORT_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_SHORT(swapPC); \ + swapPC += __GLX_SIZE_INT16; \ + } + +#define __GLX_SWAP_DOUBLE_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_DOUBLE(swapPC); \ + swapPC += __GLX_SIZE_FLOAT64; \ + } + +#define __GLX_SWAP_FLOAT_ARRAY(pc, count) \ + swapPC = ((GLbyte *)(pc)); \ + swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\ + while (swapPC < swapEnd) { \ + __GLX_SWAP_FLOAT(swapPC); \ + swapPC += __GLX_SIZE_FLOAT32; \ + } + +#define __GLX_SWAP_REPLY_HEADER() \ + __GLX_SWAP_SHORT(&__glXReply.sequenceNumber); \ + __GLX_SWAP_INT(&__glXReply.length); + +#define __GLX_SWAP_REPLY_RETVAL() \ + __GLX_SWAP_INT(&__glXReply.retval) + +#define __GLX_SWAP_REPLY_SIZE() \ + __GLX_SWAP_INT(&__glXReply.size) + +#endif /* !__GLX_unpack_h__ */ |