45e9809aff7304721fddb95654901b32195c9c7avboxsync * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission is hereby granted, free of charge, to any person obtaining a
45e9809aff7304721fddb95654901b32195c9c7avboxsync * copy of this software and associated documentation files (the "Software"),
45e9809aff7304721fddb95654901b32195c9c7avboxsync * to deal in the Software without restriction, including without limitation
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the rights to use, copy, modify, merge, publish, distribute, sublicense,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * and/or sell copies of the Software, and to permit persons to whom the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Software is furnished to do so, subject to the following conditions:
45e9809aff7304721fddb95654901b32195c9c7avboxsync * The above copyright notice including the dates of first publication and
45e9809aff7304721fddb95654901b32195c9c7avboxsync * either this permission notice or a reference to
45e9809aff7304721fddb95654901b32195c9c7avboxsync * shall be included in all copies or substantial portions of the Software.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Except as contained in this notice, the name of Silicon Graphics, Inc.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * shall not be used in advertising or otherwise to promote the sale, use or
45e9809aff7304721fddb95654901b32195c9c7avboxsync * other dealings in this Software without prior written authorization from
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Silicon Graphics, Inc.
45e9809aff7304721fddb95654901b32195c9c7avboxsync** Fetch the context-id out of a SingleReq request pointed to by pc.
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag)
45e9809aff7304721fddb95654901b32195c9c7avboxsync** Fetch a double from potentially unaligned memory.
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src))
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void __glXMemInit(void);
45e9809aff7304721fddb95654901b32195c9c7avboxsync WriteToClient( client, sz_xGLXSingleReply, (char *)&__glXReply);
45e9809aff7304721fddb95654901b32195c9c7avboxsync** Get a buffer to hold returned data, with the given alignment. If we have
45e9809aff7304721fddb95654901b32195c9c7avboxsync** to realloc, allocate size+align, in case the pointer has to be bumped for
45e9809aff7304721fddb95654901b32195c9c7avboxsync** alignment. The answerBuffer should already be aligned.
45e9809aff7304721fddb95654901b32195c9c7avboxsync** NOTE: the cast (long)res below assumes a long is large enough to hold a
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync (cl)->returnBuf = (GLbyte*)Xrealloc((cl)->returnBuf, \
45e9809aff7304721fddb95654901b32195c9c7avboxsync *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer
45e9809aff7304721fddb95654901b32195c9c7avboxsync WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), (char *)answer)
45e9809aff7304721fddb95654901b32195c9c7avboxsync WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), (char *)answer)
45e9809aff7304721fddb95654901b32195c9c7avboxsync WriteToClient(client, (len)*__GLX_SIZE_INT32, (char *)answer)
45e9809aff7304721fddb95654901b32195c9c7avboxsync WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, (char *)answer)
45e9809aff7304721fddb95654901b32195c9c7avboxsync WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, (char *)answer)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len)
45e9809aff7304721fddb95654901b32195c9c7avboxsync** PERFORMANCE NOTE:
45e9809aff7304721fddb95654901b32195c9c7avboxsync** Machine dependent optimizations abound here; these swapping macros can
45e9809aff7304721fddb95654901b32195c9c7avboxsync** conceivably be replaced with routines that do the job faster.
45e9809aff7304721fddb95654901b32195c9c7avboxsync swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\
45e9809aff7304721fddb95654901b32195c9c7avboxsync swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\
45e9809aff7304721fddb95654901b32195c9c7avboxsync swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\
45e9809aff7304721fddb95654901b32195c9c7avboxsync swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* !__GLX_unpack_h__ */