From 10aabb729d1586db344f9c1abdf1cf45e7ddaa7a Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Fri, 15 Dec 2006 16:36:29 -0500 Subject: Convert callers of LookupDrawable() to dixLookupDrawable(). --- GL/glx/glxcmds.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'GL/glx') diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c index ccdf3fa00..6273edc56 100644 --- a/GL/glx/glxcmds.c +++ b/GL/glx/glxcmds.c @@ -441,6 +441,7 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, __GLcontextModes *modes; __GLXdrawable *pGlxDraw; __GLXpixmap *drawPixmap = NULL; + int rc; /* This is the GLX 1.3 case - the client passes in a GLXWindow and * we just return the __GLXdrawable. The first time a GLXPixmap @@ -466,8 +467,8 @@ static int GetDrawableOrPixmap( __GLXcontext *glxc, GLXDrawable drawId, * GLXWindow with the same XID as an X Window, so we wont get any * resource ID clashes. Effectively, the X Window is now also a * GLXWindow. */ - pDraw = (DrawablePtr) LookupDrawable(drawId, client); - if (pDraw) { + rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixUnknownAccess); + if (rc == Success) { if (pDraw->type == DRAWABLE_WINDOW) { VisualID vid = wVisual((WindowPtr)pDraw); @@ -1199,12 +1200,12 @@ static int ValidateCreateDrawable(ClientPtr client, ScreenPtr pScreen; VisualPtr pVisual; __GLXscreen *pGlxScreen; - int i; + int i, rc; LEGAL_NEW_RESOURCE(glxDrawableId, client); - pDraw = (DrawablePtr) LookupDrawable(drawablId, client); - if (!pDraw || pDraw->type != type) { + rc = dixLookupDrawable(&pDraw, drawablId, client, 0, DixUnknownAccess); + if (rc != Success || pDraw->type != type) { client->errorValue = drawablId; return type == DRAWABLE_WINDOW ? BadWindow : BadPixmap; } @@ -2034,10 +2035,11 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc; XID drawable = req->drawable; int barrier = req->barrier; - DrawablePtr pDraw = (DrawablePtr) LookupDrawable(drawable, client); - int screen; + DrawablePtr pDraw; + int screen, rc; - if (pDraw && (pDraw->type == DRAWABLE_WINDOW)) { + rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixUnknownAccess); + if (rc == Success && (pDraw->type == DRAWABLE_WINDOW)) { screen = pDraw->pScreen->myNum; if (__glXSwapBarrierFuncs && __glXSwapBarrierFuncs[screen].bindSwapBarrierFunc) { -- cgit v1.2.3 From 2fd4626fa6969b84d8e2f9db16d6e2d44c4bc499 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 3 Jan 2007 15:44:55 -0800 Subject: Make GLX byteswap macros more portable - Use autoconf tests instead of platform-specific #ifdef's to decide which macros to use. - Provide fallbacks for platforms like Solaris that don't provide any of the existing known forms. --- GL/glx/indirect_dispatch_swap.c | 26 ++++++++++------ GL/glx/indirect_program.c | 22 +++++++------ GL/glx/indirect_texture_compression.c | 22 +++++++------ GL/glx/indirect_util.c | 26 ++++++++++------ GL/glx/swap_interval.c | 22 +++++++------ configure.ac | 58 +++++++++++++++++++++++++++++++++++ include/dix-config.h.in | 15 +++++++++ 7 files changed, 146 insertions(+), 45 deletions(-) (limited to 'GL/glx') diff --git a/GL/glx/indirect_dispatch_swap.c b/GL/glx/indirect_dispatch_swap.c index 136f0d010..4fee8eed6 100644 --- a/GL/glx/indirect_dispatch_swap.c +++ b/GL/glx/indirect_dispatch_swap.c @@ -25,21 +25,29 @@ * SOFTWARE. */ +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + #include #include #include -#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) +#if defined(HAVE_BYTESWAP_H) #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 #else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#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 #include #include "indirect_size.h" diff --git a/GL/glx/indirect_program.c b/GL/glx/indirect_program.c index 8d5f0e60f..8372191f7 100644 --- a/GL/glx/indirect_program.c +++ b/GL/glx/indirect_program.c @@ -46,18 +46,22 @@ #include "dispatch.h" #include "glapioffsets.h" -#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__) +#if defined(HAVE_BYTESWAP_H) #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 #else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#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 static int DoGetProgramString(struct __GLXclientStateRec *cl, GLbyte *pc, diff --git a/GL/glx/indirect_texture_compression.c b/GL/glx/indirect_texture_compression.c index 35af1d235..801579d18 100644 --- a/GL/glx/indirect_texture_compression.c +++ b/GL/glx/indirect_texture_compression.c @@ -39,18 +39,22 @@ #include "glthread.h" #include "dispatch.h" -#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__) +#if defined(HAVE_BYTESWAP_H) #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 #else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#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 int __glXDisp_GetCompressedTexImageARB(struct __GLXclientStateRec *cl, GLbyte *pc) diff --git a/GL/glx/indirect_util.c b/GL/glx/indirect_util.c index 09b7ab87c..d72e40744 100644 --- a/GL/glx/indirect_util.c +++ b/GL/glx/indirect_util.c @@ -23,23 +23,31 @@ * SOFTWARE. */ +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + #include #include #include #include -#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) +#if defined(HAVE_BYTESWAP_H) #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 #else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#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 #include #include "indirect_size.h" diff --git a/GL/glx/swap_interval.c b/GL/glx/swap_interval.c index c4137c1aa..e5b48a6ef 100644 --- a/GL/glx/swap_interval.c +++ b/GL/glx/swap_interval.c @@ -40,18 +40,22 @@ #include "dispatch.h" #include "glapioffsets.h" -#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__) +#if defined(HAVE_BYTESWAP_H) #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 #else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#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 static int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap); diff --git a/configure.ac b/configure.ac index 491bdd511..278502be9 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,64 @@ fi AC_TYPE_PID_T +# Checks for headers/macros for byte swapping +# Known variants: +# bswap_16, bswap_32, bswap_64 (glibc) +# __swap16, __swap32, __swap64 (OpenBSD) +# bswap16, bswap32, bswap64 (other BSD's) +# and a fallback to local macros if none of the above are found + +# if is found, assume it's the correct version +AC_CHECK_HEADERS([byteswap.h]) + +# if is found, have to check which version +AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="no"]) + +if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then + AC_MSG_CHECKING([for __swap16 variant of byteswapping macros]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([ +#include + ], [ +int a = 1, b; +b = __swap16(a); + ]) +], [SYS_ENDIAN__SWAP='yes'], [SYS_ENDIAN__SWAP='no']) + AC_MSG_RESULT([$SYS_ENDIAN__SWAP]) + + AC_MSG_CHECKING([for bswap_16 variant of byteswapping macros]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([ +#include + ], [ +int a = 1, b; +b = bswap_16(a); + ]) +], [SYS_ENDIAN_BSWAP='yes'], [SYS_ENDIAN_BSWAP='no']) + AC_MSG_RESULT([$SYS_ENDIAN_BSWAP]) + + if test "$SYS_ENDIAN_BSWAP" = "yes" ; then + USE_SYS_ENDIAN_H=yes + BSWAP=bswap_ + else + if test "$SYS_ENDIAN__SWAP" = "yes" ; then + USE_SYS_ENDIAN_H=yes + BSWAP=__swap + else + USE_SYS_ENDIAN_H=no + fi + fi + + if test "$USE_SYS_ENDIAN_H" = "yes" ; then + AC_DEFINE([USE_SYS_ENDIAN_H], 1, + [Define to use byteswap macros from ]) + AC_DEFINE_UNQUOTED([bswap_16], ${BSWAP}16, + [Define to 16-bit byteswap macro]) + AC_DEFINE_UNQUOTED([bswap_32], ${BSWAP}32, + [Define to 32-bit byteswap macro]) + AC_DEFINE_UNQUOTED([bswap_64], ${BSWAP}64, + [Define to 64-bit byteswap macro]) + fi +fi + dnl Checks for library functions. AC_FUNC_VPRINTF AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \ diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 7aabae2ec..6bf27865c 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -93,6 +93,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ASM_MTRR_H +/* Define to 1 if you have the header file. */ +#undef HAVE_BYTESWAP_H + /* Define to 1 if you have the header file. */ #undef HAVE_DBM_H @@ -311,6 +314,9 @@ /* Use rgb.txt directly */ #undef USE_RGB_TXT +/* Define to use byteswap macros from */ +#undef USE_SYS_ENDIAN_H + /* unaligned word accesses behave as expected */ #undef WORKING_UNALIGNED_INT @@ -469,4 +475,13 @@ /* Path to XErrorDB file */ #undef XERRORDB_PATH +/* Define to 16-bit byteswap macro */ +#undef bswap_16 + +/* Define to 32-bit byteswap macro */ +#undef bswap_32 + +/* Define to 64-bit byteswap macro */ +#undef bswap_64 + #endif /* _DIX_CONFIG_H_ */ -- cgit v1.2.3 From 6d603bb47ff9d238637adbf30c6e9697e6e7e6fa Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 4 Jan 2007 14:49:26 -0800 Subject: Add new header file containing byte-order wrappers. Move the byte-order related wrappers out of the individual source files into a dedicated header file. Modify the single hand-coded source file that uses the byte-order wrappers to use the new header file. --- GL/glx/glxbyteorder.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ GL/glx/swap_interval.c | 14 +------------- 2 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 GL/glx/glxbyteorder.h (limited to 'GL/glx') diff --git a/GL/glx/glxbyteorder.h b/GL/glx/glxbyteorder.h new file mode 100644 index 000000000..3c094d702 --- /dev/null +++ b/GL/glx/glxbyteorder.h @@ -0,0 +1,48 @@ +/* + * (C) Copyright IBM Corporation 2006, 2007 + * 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, 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 + * THE COPYRIGHT HOLDERS, THE AUTHORS, 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 glxbyteorder.h + * Platform glue for handling byte-ordering issues in GLX protocol. + * + * \author Ian Romanick + */ +#if !defined(__GLXBYTEORDER_H__) +#define __GLXBYTEORDER_H__ + +#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) +#include +#elif defined(__OpenBSD__) +#include +#define bswap_16 __swap16 +#define bswap_32 __swap32 +#define bswap_64 __swap64 +#else +#include +#define bswap_16 bswap16 +#define bswap_32 bswap32 +#define bswap_64 bswap64 +#endif + +#endif /* !defined(__GLXBYTEORDER_H__) */ diff --git a/GL/glx/swap_interval.c b/GL/glx/swap_interval.c index c4137c1aa..6aa92a35b 100644 --- a/GL/glx/swap_interval.c +++ b/GL/glx/swap_interval.c @@ -40,19 +40,7 @@ #include "dispatch.h" #include "glapioffsets.h" -#if defined(__linux__) || defined (__GLIBC__) || defined (__GNU__) -#include -#elif defined(__OpenBSD__) -#include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 -#else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 -#endif +#include "glxbyteorder.h" static int DoSwapInterval(__GLXclientState *cl, GLbyte *pc, int do_swap); -- cgit v1.2.3 From 45aa26ccb4f61c2919ce2475d0907c6e1b177da2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 4 Jan 2007 14:55:51 -0800 Subject: Regenerate from Mesa scripts. Regenerate source files from Mesa scripts. This causes the generated files to use glxbyteorder.h. --- GL/glx/indirect_dispatch.c | 1 + GL/glx/indirect_dispatch_swap.c | 14 +- GL/glx/indirect_reqsize.c | 700 ++++++++++++++++++++-------------------- GL/glx/indirect_reqsize.h | 18 +- 4 files changed, 358 insertions(+), 375 deletions(-) (limited to 'GL/glx') diff --git a/GL/glx/indirect_dispatch.c b/GL/glx/indirect_dispatch.c index d86dedfd5..00a9f9659 100644 --- a/GL/glx/indirect_dispatch.c +++ b/GL/glx/indirect_dispatch.c @@ -33,6 +33,7 @@ #include "indirect_size_get.h" #include "indirect_dispatch.h" #include "glxserver.h" +#include "glxbyteorder.h" #include "indirect_util.h" #include "singlesize.h" #include "glapitable.h" diff --git a/GL/glx/indirect_dispatch_swap.c b/GL/glx/indirect_dispatch_swap.c index 136f0d010..c0bb71cc4 100644 --- a/GL/glx/indirect_dispatch_swap.c +++ b/GL/glx/indirect_dispatch_swap.c @@ -28,24 +28,12 @@ #include #include #include -#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) -#include -#elif defined(__OpenBSD__) -#include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 -#else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 -#endif #include #include "indirect_size.h" #include "indirect_size_get.h" #include "indirect_dispatch.h" #include "glxserver.h" +#include "glxbyteorder.h" #include "indirect_util.h" #include "singlesize.h" #include "glapitable.h" diff --git a/GL/glx/indirect_reqsize.c b/GL/glx/indirect_reqsize.c index d3e2bc516..954eecd97 100644 --- a/GL/glx/indirect_reqsize.c +++ b/GL/glx/indirect_reqsize.c @@ -28,16 +28,10 @@ #include #include "glxserver.h" +#include "glxbyteorder.h" #include "indirect_size.h" #include "indirect_reqsize.h" -#if defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) -# include -# define SWAP_32(v) do { (v) = bswap_32(v); } while(0) -#else -# define SWAP_32(v) do { char tmp; swapl(&v, tmp); } while(0) -#endif - #define __GLX_PAD(x) (((x) + 3) & ~3) #if defined(__CYGWIN__) || defined(__MINGW32__) @@ -56,15 +50,15 @@ int -__glXCallListsReqSize( const GLbyte * pc, Bool swap ) +__glXCallListsReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 0); - GLenum type = * (GLenum *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 0); + GLenum type = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( n ); - SWAP_32( type ); + n = bswap_32(n); + type = bswap_32(type); } compsize = __glCallLists_size(type); @@ -72,22 +66,22 @@ __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 row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLsizei width = *(GLsizei *)(pc + 20); - GLsizei height = *(GLsizei *)(pc + 24); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLsizei width = *(GLsizei *) (pc + 20); + GLsizei height = *(GLsizei *) (pc + 24); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( width ); - SWAP_32( height ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + width = bswap_32(width); + height = bswap_32(height); } return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, width, height, 1, @@ -96,13 +90,13 @@ __glXBitmapReqSize( const GLbyte * pc, Bool swap ) } int -__glXFogfvReqSize( const GLbyte * pc, Bool swap ) +__glXFogfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 0); + GLenum pname = *(GLenum *) (pc + 0); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glFogfv_size(pname); @@ -110,13 +104,13 @@ __glXFogfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXLightfvReqSize( const GLbyte * pc, Bool swap ) +__glXLightfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glLightfv_size(pname); @@ -124,13 +118,13 @@ __glXLightfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXLightModelfvReqSize( const GLbyte * pc, Bool swap ) +__glXLightModelfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 0); + GLenum pname = *(GLenum *) (pc + 0); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glLightModelfv_size(pname); @@ -138,13 +132,13 @@ __glXLightModelfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXMaterialfvReqSize( const GLbyte * pc, Bool swap ) +__glXMaterialfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glMaterialfv_size(pname); @@ -152,18 +146,18 @@ __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 row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); } return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, 32, 32, 1, @@ -172,13 +166,13 @@ __glXPolygonStippleReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexParameterfvReqSize( const GLbyte * pc, Bool swap ) +__glXTexParameterfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glTexParameterfv_size(pname); @@ -186,26 +180,26 @@ __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 row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 32); - GLenum format = * (GLenum *)(pc + 44); - GLenum type = * (GLenum *)(pc + 48); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 32); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, @@ -214,28 +208,28 @@ __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 row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 32); - GLsizei height = *(GLsizei *)(pc + 36); - GLenum format = * (GLenum *)(pc + 44); - GLenum type = * (GLenum *)(pc + 48); - - if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( format ); - SWAP_32( type ); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 32); + GLsizei height = *(GLsizei *) (pc + 36); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, 1, @@ -244,13 +238,13 @@ __glXTexImage2DReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexEnvfvReqSize( const GLbyte * pc, Bool swap ) +__glXTexEnvfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glTexEnvfv_size(pname); @@ -258,13 +252,13 @@ __glXTexEnvfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexGendvReqSize( const GLbyte * pc, Bool swap ) +__glXTexGendvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glTexGendv_size(pname); @@ -272,13 +266,13 @@ __glXTexGendvReqSize( const GLbyte * pc, Bool swap ) } int -__glXTexGenfvReqSize( const GLbyte * pc, Bool swap ) +__glXTexGenfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glTexGenfv_size(pname); @@ -286,50 +280,50 @@ __glXTexGenfvReqSize( const GLbyte * pc, Bool swap ) } int -__glXPixelMapfvReqSize( const GLbyte * pc, Bool swap ) +__glXPixelMapfvReqSize(const GLbyte *pc, Bool swap) { - GLsizei mapsize = *(GLsizei *)(pc + 4); + GLsizei mapsize = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( mapsize ); + mapsize = bswap_32(mapsize); } return __GLX_PAD((mapsize * 4)); } int -__glXPixelMapusvReqSize( const GLbyte * pc, Bool swap ) +__glXPixelMapusvReqSize(const GLbyte *pc, Bool swap) { - GLsizei mapsize = *(GLsizei *)(pc + 4); + GLsizei mapsize = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( mapsize ); + mapsize = bswap_32(mapsize); } return __GLX_PAD((mapsize * 2)); } int -__glXDrawPixelsReqSize( const GLbyte * pc, Bool swap ) +__glXDrawPixelsReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLsizei width = *(GLsizei *)(pc + 20); - GLsizei height = *(GLsizei *)(pc + 24); - GLenum format = * (GLenum *)(pc + 28); - GLenum type = * (GLenum *)(pc + 32); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLsizei width = *(GLsizei *) (pc + 20); + GLsizei height = *(GLsizei *) (pc + 24); + GLenum format = *(GLenum *) (pc + 28); + GLenum type = *(GLenum *) (pc + 32); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, 0, width, height, 1, @@ -338,38 +332,38 @@ __glXDrawPixelsReqSize( const GLbyte * pc, Bool swap ) } int -__glXPrioritizeTexturesReqSize( const GLbyte * pc, Bool swap ) +__glXPrioritizeTexturesReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 0); + GLsizei n = *(GLsizei *) (pc + 0); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 4) + (n * 4)); } int -__glXTexSubImage1DReqSize( const GLbyte * pc, Bool swap ) +__glXTexSubImage1DReqSize(const GLbyte *pc, Bool swap) { - GLint row_length = * (GLint *)(pc + 4); + GLint row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 36); - GLenum format = * (GLenum *)(pc + 44); - GLenum type = * (GLenum *)(pc + 48); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 36); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, @@ -378,28 +372,28 @@ __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 row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 36); - GLsizei height = *(GLsizei *)(pc + 40); - GLenum format = * (GLenum *)(pc + 44); - GLenum type = * (GLenum *)(pc + 48); - - if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( format ); - SWAP_32( type ); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 36); + GLsizei height = *(GLsizei *) (pc + 40); + GLenum format = *(GLenum *) (pc + 44); + GLenum type = *(GLenum *) (pc + 48); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, 1, @@ -408,26 +402,26 @@ __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 row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 28); - GLenum format = * (GLenum *)(pc + 32); - GLenum type = * (GLenum *)(pc + 36); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 28); + GLenum format = *(GLenum *) (pc + 32); + GLenum type = *(GLenum *) (pc + 36); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, @@ -436,13 +430,13 @@ __glXColorTableReqSize( const GLbyte * pc, Bool swap ) } int -__glXColorTableParameterfvReqSize( const GLbyte * pc, Bool swap ) +__glXColorTableParameterfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glColorTableParameterfv_size(pname); @@ -450,26 +444,26 @@ __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 row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei count = *(GLsizei *)(pc + 28); - GLenum format = * (GLenum *)(pc + 32); - GLenum type = * (GLenum *)(pc + 36); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei count = *(GLsizei *) (pc + 28); + GLenum format = *(GLenum *) (pc + 32); + GLenum type = *(GLenum *) (pc + 36); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( count ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + count = bswap_32(count); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, count, 1, 1, @@ -478,26 +472,26 @@ __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 row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 28); - GLenum format = * (GLenum *)(pc + 36); - GLenum type = * (GLenum *)(pc + 40); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 28); + GLenum format = *(GLenum *) (pc + 36); + GLenum type = *(GLenum *) (pc + 40); if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, 1, 1, @@ -506,28 +500,28 @@ __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 row_length = *(GLint *) (pc + 4); GLint image_height = 0; - GLint skip_images = 0; - GLint skip_rows = * (GLint *)(pc + 8); - GLint alignment = * (GLint *)(pc + 16); - GLenum target = * (GLenum *)(pc + 20); - GLsizei width = *(GLsizei *)(pc + 28); - GLsizei height = *(GLsizei *)(pc + 32); - GLenum format = * (GLenum *)(pc + 36); - GLenum type = * (GLenum *)(pc + 40); - - if (swap) { - SWAP_32( row_length ); - SWAP_32( skip_rows ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( format ); - SWAP_32( type ); + GLint skip_images = 0; + GLint skip_rows = *(GLint *) (pc + 8); + GLint alignment = *(GLint *) (pc + 16); + GLenum target = *(GLenum *) (pc + 20); + GLsizei width = *(GLsizei *) (pc + 28); + GLsizei height = *(GLsizei *) (pc + 32); + GLenum format = *(GLenum *) (pc + 36); + GLenum type = *(GLenum *) (pc + 40); + + if (swap) { + row_length = bswap_32(row_length); + skip_rows = bswap_32(skip_rows); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, 1, @@ -536,13 +530,13 @@ __glXConvolutionFilter2DReqSize( const GLbyte * pc, Bool swap ) } int -__glXConvolutionParameterfvReqSize( const GLbyte * pc, Bool swap ) +__glXConvolutionParameterfvReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 4); + GLenum pname = *(GLenum *) (pc + 4); GLsizei compsize; if (swap) { - SWAP_32( pname ); + pname = bswap_32(pname); } compsize = __glConvolutionParameterfv_size(pname); @@ -550,32 +544,32 @@ __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); - GLint skip_rows = * (GLint *)(pc + 16); - GLint skip_images = * (GLint *)(pc + 20); - GLint alignment = * (GLint *)(pc + 32); - GLenum target = * (GLenum *)(pc + 36); - GLsizei width = *(GLsizei *)(pc + 48); - GLsizei height = *(GLsizei *)(pc + 52); - GLsizei depth = *(GLsizei *)(pc + 56); - GLenum format = * (GLenum *)(pc + 68); - GLenum type = * (GLenum *)(pc + 72); + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = *(GLint *) (pc + 8); + GLint skip_rows = *(GLint *) (pc + 16); + GLint skip_images = *(GLint *) (pc + 20); + GLint alignment = *(GLint *) (pc + 32); + GLenum target = *(GLenum *) (pc + 36); + GLsizei width = *(GLsizei *) (pc + 48); + GLsizei height = *(GLsizei *) (pc + 52); + GLsizei depth = *(GLsizei *) (pc + 56); + GLenum format = *(GLenum *) (pc + 68); + GLenum type = *(GLenum *) (pc + 72); if (swap) { - SWAP_32( row_length ); - SWAP_32( image_height ); - SWAP_32( skip_rows ); - SWAP_32( skip_images ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( depth ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + image_height = bswap_32(image_height); + skip_rows = bswap_32(skip_rows); + skip_images = bswap_32(skip_images); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + depth = bswap_32(depth); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, depth, @@ -584,32 +578,32 @@ __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); - GLint skip_rows = * (GLint *)(pc + 16); - GLint skip_images = * (GLint *)(pc + 20); - GLint alignment = * (GLint *)(pc + 32); - GLenum target = * (GLenum *)(pc + 36); - GLsizei width = *(GLsizei *)(pc + 60); - GLsizei height = *(GLsizei *)(pc + 64); - GLsizei depth = *(GLsizei *)(pc + 68); - GLenum format = * (GLenum *)(pc + 76); - GLenum type = * (GLenum *)(pc + 80); + GLint row_length = *(GLint *) (pc + 4); + GLint image_height = *(GLint *) (pc + 8); + GLint skip_rows = *(GLint *) (pc + 16); + GLint skip_images = *(GLint *) (pc + 20); + GLint alignment = *(GLint *) (pc + 32); + GLenum target = *(GLenum *) (pc + 36); + GLsizei width = *(GLsizei *) (pc + 60); + GLsizei height = *(GLsizei *) (pc + 64); + GLsizei depth = *(GLsizei *) (pc + 68); + GLenum format = *(GLenum *) (pc + 76); + GLenum type = *(GLenum *) (pc + 80); if (swap) { - SWAP_32( row_length ); - SWAP_32( image_height ); - SWAP_32( skip_rows ); - SWAP_32( skip_images ); - SWAP_32( alignment ); - SWAP_32( target ); - SWAP_32( width ); - SWAP_32( height ); - SWAP_32( depth ); - SWAP_32( format ); - SWAP_32( type ); + row_length = bswap_32(row_length); + image_height = bswap_32(image_height); + skip_rows = bswap_32(skip_rows); + skip_images = bswap_32(skip_images); + alignment = bswap_32(alignment); + target = bswap_32(target); + width = bswap_32(width); + height = bswap_32(height); + depth = bswap_32(depth); + format = bswap_32(format); + type = bswap_32(type); } return __glXImageSize(format, type, target, width, height, depth, @@ -618,221 +612,221 @@ __glXTexSubImage3DReqSize( const GLbyte * pc, Bool swap ) } int -__glXDrawBuffersARBReqSize( const GLbyte * pc, Bool swap ) +__glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 0); + GLsizei imageSize = *(GLsizei *) (pc + 20); if (swap) { - SWAP_32( n ); + imageSize = bswap_32(imageSize); } - return __GLX_PAD((n * 4)); + return __GLX_PAD(imageSize); } int -__glXPointParameterfvEXTReqSize( const GLbyte * pc, Bool swap ) +__glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap) { - GLenum pname = * (GLenum *)(pc + 0); - GLsizei compsize; + GLsizei imageSize = *(GLsizei *) (pc + 24); if (swap) { - SWAP_32( pname ); + imageSize = bswap_32(imageSize); } - compsize = __glPointParameterfvEXT_size(pname); - return __GLX_PAD((compsize * 4)); + return __GLX_PAD(imageSize); } int -__glXCompressedTexImage3DARBReqSize( const GLbyte * pc, Bool swap ) +__glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap) { - GLsizei imageSize = *(GLsizei *)(pc + 28); + GLsizei imageSize = *(GLsizei *) (pc + 28); if (swap) { - SWAP_32( imageSize ); + imageSize = bswap_32(imageSize); } return __GLX_PAD(imageSize); } int -__glXCompressedTexImage2DARBReqSize( const GLbyte * pc, Bool swap ) +__glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap) { - GLsizei imageSize = *(GLsizei *)(pc + 24); + GLsizei imageSize = *(GLsizei *) (pc + 36); if (swap) { - SWAP_32( imageSize ); + imageSize = bswap_32(imageSize); } return __GLX_PAD(imageSize); } int -__glXCompressedTexImage1DARBReqSize( const GLbyte * pc, Bool swap ) +__glXProgramStringARBReqSize(const GLbyte *pc, Bool swap) { - GLsizei imageSize = *(GLsizei *)(pc + 20); + GLsizei len = *(GLsizei *) (pc + 8); if (swap) { - SWAP_32( imageSize ); + len = bswap_32(len); } - return __GLX_PAD(imageSize); + return __GLX_PAD(len); } int -__glXCompressedTexSubImage3DARBReqSize( const GLbyte * pc, Bool swap ) +__glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap) { - GLsizei imageSize = *(GLsizei *)(pc + 36); + GLsizei n = *(GLsizei *) (pc + 0); if (swap) { - SWAP_32( imageSize ); + n = bswap_32(n); } - return __GLX_PAD(imageSize); + return __GLX_PAD((n * 4)); } int -__glXLoadProgramNVReqSize( const GLbyte * pc, Bool swap ) +__glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap) { - GLsizei len = *(GLsizei *)(pc + 8); + GLenum pname = *(GLenum *) (pc + 0); + GLsizei compsize; if (swap) { - SWAP_32( len ); + pname = bswap_32(pname); } - return __GLX_PAD(len); + compsize = __glPointParameterfvEXT_size(pname); + return __GLX_PAD((compsize * 4)); } int -__glXProgramParameters4dvNVReqSize( const GLbyte * pc, Bool swap ) +__glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap) { - GLuint num = * (GLuint *)(pc + 8); + GLuint num = *(GLuint *) (pc + 8); if (swap) { - SWAP_32( num ); + num = bswap_32(num); } return __GLX_PAD((num * 32)); } int -__glXProgramParameters4fvNVReqSize( const GLbyte * pc, Bool swap ) +__glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap) { - GLuint num = * (GLuint *)(pc + 8); + GLuint num = *(GLuint *) (pc + 8); if (swap) { - SWAP_32( num ); + num = bswap_32(num); } return __GLX_PAD((num * 16)); } int -__glXVertexAttribs1dvNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs1dvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 8)); } int -__glXVertexAttribs2dvNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs2dvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 16)); } int -__glXVertexAttribs3dvNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs3dvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 24)); } int -__glXVertexAttribs3fvNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs3fvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 12)); } int -__glXVertexAttribs3svNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs3svNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 6)); } int -__glXVertexAttribs4dvNVReqSize( const GLbyte * pc, Bool swap ) +__glXVertexAttribs4dvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei n = *(GLsizei *)(pc + 4); + GLsizei n = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( n ); + n = bswap_32(n); } return __GLX_PAD((n * 32)); } int -__glXProgramNamedParameter4fvNVReqSize( const GLbyte * pc, Bool swap ) +__glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap) { - GLsizei len = *(GLsizei *)(pc + 4); + GLsizei len = *(GLsizei *) (pc + 4); if (swap) { - SWAP_32( len ); + len = bswap_32(len); } return __GLX_PAD(len); } -ALIAS( Fogiv, Fogfv ) -ALIAS( Lightiv, Lightfv ) -ALIAS( LightModeliv, LightModelfv ) -ALIAS( Materialiv, Materialfv ) -ALIAS( TexParameteriv, TexParameterfv ) -ALIAS( TexEnviv, TexEnvfv ) -ALIAS( TexGeniv, TexGenfv ) -ALIAS( PixelMapuiv, PixelMapfv ) -ALIAS( ColorTableParameteriv, ColorTableParameterfv ) -ALIAS( ConvolutionParameteriv, ConvolutionParameterfv ) -ALIAS( CompressedTexSubImage2DARB, CompressedTexImage3DARB ) -ALIAS( CompressedTexSubImage1DARB, CompressedTexImage1DARB ) -ALIAS( RequestResidentProgramsNV, DrawBuffersARB ) -ALIAS( VertexAttribs1fvNV, PixelMapfv ) -ALIAS( VertexAttribs1svNV, PixelMapusv ) -ALIAS( VertexAttribs2fvNV, VertexAttribs1dvNV ) -ALIAS( VertexAttribs2svNV, PixelMapfv ) -ALIAS( VertexAttribs4fvNV, VertexAttribs2dvNV ) -ALIAS( VertexAttribs4svNV, VertexAttribs1dvNV ) -ALIAS( VertexAttribs4ubvNV, PixelMapfv ) -ALIAS( PointParameterivNV, PointParameterfvEXT ) -ALIAS( ProgramStringARB, LoadProgramNV ) -ALIAS( ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB ) -ALIAS( DeleteRenderbuffersEXT, DrawBuffersARB ) -ALIAS( DeleteFramebuffersEXT, DrawBuffersARB ) +ALIAS(Fogiv, Fogfv) + ALIAS(Lightiv, Lightfv) + ALIAS(LightModeliv, LightModelfv) + ALIAS(Materialiv, Materialfv) + ALIAS(TexParameteriv, TexParameterfv) + ALIAS(TexEnviv, TexEnvfv) + ALIAS(TexGeniv, TexGenfv) + ALIAS(PixelMapuiv, PixelMapfv) + ALIAS(ColorTableParameteriv, ColorTableParameterfv) + ALIAS(ConvolutionParameteriv, ConvolutionParameterfv) + ALIAS(CompressedTexSubImage1DARB, CompressedTexImage1DARB) + ALIAS(CompressedTexSubImage2DARB, CompressedTexImage3DARB) + ALIAS(LoadProgramNV, ProgramStringARB) + ALIAS(RequestResidentProgramsNV, DrawBuffersARB) + ALIAS(VertexAttribs1fvNV, PixelMapfv) + ALIAS(VertexAttribs1svNV, PixelMapusv) + ALIAS(VertexAttribs2fvNV, VertexAttribs1dvNV) + ALIAS(VertexAttribs2svNV, PixelMapfv) + ALIAS(VertexAttribs4fvNV, VertexAttribs2dvNV) + ALIAS(VertexAttribs4svNV, VertexAttribs1dvNV) + ALIAS(VertexAttribs4ubvNV, PixelMapfv) + ALIAS(PointParameterivNV, PointParameterfvEXT) + ALIAS(ProgramNamedParameter4dvNV, CompressedTexSubImage3DARB) + ALIAS(DeleteFramebuffersEXT, DrawBuffersARB) + ALIAS(DeleteRenderbuffersEXT, DrawBuffersARB) diff --git a/GL/glx/indirect_reqsize.h b/GL/glx/indirect_reqsize.h index 23bc41c78..26211ee5c 100644 --- a/GL/glx/indirect_reqsize.h +++ b/GL/glx/indirect_reqsize.h @@ -83,14 +83,15 @@ extern PURE HIDDEN int __glXConvolutionParameterivReqSize(const GLbyte *pc, Bool extern PURE HIDDEN int __glXSeparableFilter2DReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXTexImage3DReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXTexSubImage3DReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXCompressedTexImage1DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexImage2DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexImage3DARBReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXCompressedTexSubImage1DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexSubImage2DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXCompressedTexSubImage3DARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXDrawBuffersARBReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXPointParameterfvEXTReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXLoadProgramNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXProgramParameters4dvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXProgramParameters4fvNVReqSize(const GLbyte *pc, Bool swap); @@ -109,11 +110,10 @@ extern PURE HIDDEN int __glXVertexAttribs4fvNVReqSize(const GLbyte *pc, Bool swa extern PURE HIDDEN int __glXVertexAttribs4svNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXVertexAttribs4ubvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXPointParameterivNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramStringARBReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXProgramNamedParameter4dvNVReqSize(const GLbyte *pc, Bool swap); -extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXProgramNamedParameter4fvNVReqSize(const GLbyte *pc, Bool swap); extern PURE HIDDEN int __glXDeleteFramebuffersEXTReqSize(const GLbyte *pc, Bool swap); +extern PURE HIDDEN int __glXDeleteRenderbuffersEXTReqSize(const GLbyte *pc, Bool swap); # undef HIDDEN # undef PURE -- cgit v1.2.3 From b7ca5d14ce7ba410b0dab5c2289f6d7b75e763df Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 4 Jan 2007 15:37:33 -0800 Subject: Incorporate new byte-order related configure changes. --- GL/glx/glxbyteorder.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'GL/glx') diff --git a/GL/glx/glxbyteorder.h b/GL/glx/glxbyteorder.h index 3c094d702..0bcb91fb7 100644 --- a/GL/glx/glxbyteorder.h +++ b/GL/glx/glxbyteorder.h @@ -31,18 +31,25 @@ #if !defined(__GLXBYTEORDER_H__) #define __GLXBYTEORDER_H__ -#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#if HAVE_BYTESWAP_H #include -#elif defined(__OpenBSD__) +#elif defined(USE_SYS_ENDIAN_H) #include -#define bswap_16 __swap16 -#define bswap_32 __swap32 -#define bswap_64 __swap64 -#else -#include -#define bswap_16 bswap16 -#define bswap_32 bswap32 -#define bswap_64 bswap64 +#define bswap_16(value) \ + ((((value) & 0xff) << 8) | ((value) >> 8)) + +#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__) */ -- cgit v1.2.3 From f90c3e226b105bf77beb94723fc08bdff14834be Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 4 Jan 2007 15:38:16 -0800 Subject: Re-regenerate from Mesa scripts. DO NOT HAND EDIT THESE FILES! For cryin' out loud, there's even a comment to that effect in the file's header... --- GL/glx/indirect_dispatch_swap.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'GL/glx') diff --git a/GL/glx/indirect_dispatch_swap.c b/GL/glx/indirect_dispatch_swap.c index db651543c..c0bb71cc4 100644 --- a/GL/glx/indirect_dispatch_swap.c +++ b/GL/glx/indirect_dispatch_swap.c @@ -25,10 +25,6 @@ * SOFTWARE. */ -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - #include #include #include -- cgit v1.2.3 From dfb2c10413e22afd8d486a982870f874326d5ef4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 5 Jan 2007 10:15:09 -0800 Subject: Add missing #else from previous commits. --- GL/glx/glxbyteorder.h | 1 + 1 file changed, 1 insertion(+) (limited to 'GL/glx') diff --git a/GL/glx/glxbyteorder.h b/GL/glx/glxbyteorder.h index 0bcb91fb7..b9d738dba 100644 --- a/GL/glx/glxbyteorder.h +++ b/GL/glx/glxbyteorder.h @@ -39,6 +39,7 @@ #include #elif defined(USE_SYS_ENDIAN_H) #include +#else #define bswap_16(value) \ ((((value) & 0xff) << 8) | ((value) >> 8)) -- cgit v1.2.3