1706f2543Smrg/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */
2706f2543Smrg/*
3706f2543Smrg * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
4706f2543Smrg * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
5706f2543Smrg *
6706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining a
7706f2543Smrg * copy of this software and associated documentation files (the "Software"),
8706f2543Smrg * to deal in the Software without restriction, including without limitation
9706f2543Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10706f2543Smrg * and/or sell copies of the Software, and to permit persons to whom the
11706f2543Smrg * Software is furnished to do so, subject to the following conditions:
12706f2543Smrg *
13706f2543Smrg * The above copyright notice including the dates of first publication and
14706f2543Smrg * either this permission notice or a reference to
15706f2543Smrg * http://oss.sgi.com/projects/FreeB/
16706f2543Smrg * shall be included in all copies or substantial portions of the Software.
17706f2543Smrg *
18706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19706f2543Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20706f2543Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21706f2543Smrg * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22706f2543Smrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
23706f2543Smrg * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24706f2543Smrg * SOFTWARE.
25706f2543Smrg *
26706f2543Smrg * Except as contained in this notice, the name of Silicon Graphics, Inc.
27706f2543Smrg * shall not be used in advertising or otherwise to promote the sale, use or
28706f2543Smrg * other dealings in this Software without prior written authorization from
29706f2543Smrg * Silicon Graphics, Inc.
30706f2543Smrg */
31706f2543Smrg
32706f2543Smrg#ifdef HAVE_DMX_CONFIG_H
33706f2543Smrg#include <dmx-config.h>
34706f2543Smrg#endif
35706f2543Smrg
36706f2543Smrg#include "dmx.h"
37706f2543Smrg#include "dmxwindow.h"
38706f2543Smrg#include "dmxpixmap.h"
39706f2543Smrg#include "dmxfont.h"
40706f2543Smrg
41706f2543Smrg#include "glxserver.h"
42706f2543Smrg#include "glxext.h"
43706f2543Smrg#include "g_disptab.h"
44706f2543Smrg/* #include "g_disptab_EXT.h" */
45706f2543Smrg#include "unpack.h"
46706f2543Smrg#include "glxutil.h"
47706f2543Smrg
48706f2543Smrg#include "GL/glxproto.h"
49706f2543Smrg
50706f2543Smrg#ifdef PANORAMIX
51706f2543Smrg#include "panoramiXsrv.h"
52706f2543Smrg#endif
53706f2543Smrg
54706f2543Smrg/*
55706f2543Smrg * GetReqVendorPrivate - this is the equivalent of GetReq macro
56706f2543Smrg *    from Xlibint.h but it does not set the reqType field (the opcode).
57706f2543Smrg *    this is because the GL single opcodes has different naming convension
58706f2543Smrg *    the other X opcodes (ie. X_GLsop_GetFloatv).
59706f2543Smrg */
60706f2543Smrg#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
61706f2543Smrg#define GetReqVendorPrivate(name, req) \
62706f2543Smrg        WORD64ALIGN\
63706f2543Smrg	if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
64706f2543Smrg		_XFlush(dpy);\
65706f2543Smrg	req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
66706f2543Smrg	req->length = (SIZEOF(x##name##Req))>>2;\
67706f2543Smrg	dpy->bufptr += SIZEOF(x##name##Req);\
68706f2543Smrg	dpy->request++
69706f2543Smrg
70706f2543Smrg#else  /* non-ANSI C uses empty comment instead of "##" for token concatenation */
71706f2543Smrg#define GetReqVendorPrivate(name, req) \
72706f2543Smrg        WORD64ALIGN\
73706f2543Smrg	if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
74706f2543Smrg		_XFlush(dpy);\
75706f2543Smrg	req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
76706f2543Smrg	req->length = (SIZEOF(x/**/name/**/Req))>>2;\
77706f2543Smrg	dpy->bufptr += SIZEOF(x/**/name/**/Req);\
78706f2543Smrg	dpy->request++
79706f2543Smrg#endif
80706f2543Smrg
81706f2543Smrgextern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
82706f2543Smrgextern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
83706f2543Smrg
84706f2543Smrgstatic int swap_vec_element_size = 0;
85706f2543Smrg
86706f2543Smrgstatic void SendSwappedReply( ClientPtr client,
87706f2543Smrg                              xGLXVendorPrivReply *reply,
88706f2543Smrg			      char *buf,
89706f2543Smrg			      int   buf_size )
90706f2543Smrg{
91706f2543Smrg   __GLX_DECLARE_SWAP_VARIABLES;
92706f2543Smrg   __GLX_SWAP_SHORT(&reply->sequenceNumber);
93706f2543Smrg   __GLX_SWAP_INT(&reply->length);
94706f2543Smrg   __GLX_SWAP_INT(&reply->retval);
95706f2543Smrg   __GLX_SWAP_INT(&reply->size);
96706f2543Smrg
97706f2543Smrg   if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
98706f2543Smrg      /*
99706f2543Smrg       * the reply has single component - need to swap pad3
100706f2543Smrg       */
101706f2543Smrg      if (swap_vec_element_size == 2) {
102706f2543Smrg	 __GLX_SWAP_SHORT(&reply->pad3);
103706f2543Smrg      }
104706f2543Smrg      else if (swap_vec_element_size == 4) {
105706f2543Smrg	 __GLX_SWAP_INT(&reply->pad3);
106706f2543Smrg	 __GLX_SWAP_INT(&reply->pad4);
107706f2543Smrg      }
108706f2543Smrg      else if (swap_vec_element_size == 8) {
109706f2543Smrg	 __GLX_SWAP_DOUBLE(&reply->pad3);
110706f2543Smrg      }
111706f2543Smrg   }
112706f2543Smrg   else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
113706f2543Smrg      /*
114706f2543Smrg       * the reply has vector of elements which needs to be swapped
115706f2543Smrg       */
116706f2543Smrg      int vsize = buf_size / swap_vec_element_size;
117706f2543Smrg      char *p = buf;
118706f2543Smrg      int i;
119706f2543Smrg
120706f2543Smrg      for (i=0; i<vsize; i++) {
121706f2543Smrg	 if (swap_vec_element_size == 2) {
122706f2543Smrg	    __GLX_SWAP_SHORT(p);
123706f2543Smrg	 }
124706f2543Smrg	 else if (swap_vec_element_size == 4) {
125706f2543Smrg	    __GLX_SWAP_INT(p);
126706f2543Smrg	 }
127706f2543Smrg	 else if (swap_vec_element_size == 8) {
128706f2543Smrg	    __GLX_SWAP_DOUBLE(p);
129706f2543Smrg	 }
130706f2543Smrg
131706f2543Smrg	 p += swap_vec_element_size;
132706f2543Smrg      }
133706f2543Smrg
134706f2543Smrg      __GLX_SWAP_INT(&reply->pad3);
135706f2543Smrg      __GLX_SWAP_INT(&reply->pad4);
136706f2543Smrg      __GLX_SWAP_INT(&reply->pad5);
137706f2543Smrg      __GLX_SWAP_INT(&reply->pad6);
138706f2543Smrg
139706f2543Smrg   }
140706f2543Smrg
141706f2543Smrg    WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)reply);
142706f2543Smrg    if (buf_size > 0)
143706f2543Smrg       WriteToClient(client, buf_size, (char *)buf);
144706f2543Smrg
145706f2543Smrg}
146706f2543Smrg
147706f2543Smrgint __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
148706f2543Smrg{
149706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
150706f2543Smrg   xGLXVendorPrivateReq *be_req;
151706f2543Smrg    __GLXcontext *glxc;
152706f2543Smrg   int from_screen = 0;
153706f2543Smrg   int to_screen = 0;
154706f2543Smrg   int buf_size;
155706f2543Smrg   int s;
156706f2543Smrg
157706f2543Smrg    glxc = __glXLookupContextByTag(cl, req->contextTag);
158706f2543Smrg    if (!glxc) {
159706f2543Smrg	return 0;
160706f2543Smrg    }
161706f2543Smrg    from_screen = to_screen = glxc->pScreen->myNum;
162706f2543Smrg
163706f2543Smrg#ifdef PANORAMIX
164706f2543Smrg    if (!noPanoramiXExtension) {
165706f2543Smrg       from_screen = 0;
166706f2543Smrg       to_screen = screenInfo.numScreens - 1;
167706f2543Smrg    }
168706f2543Smrg#endif
169706f2543Smrg
170706f2543Smrg    pc += sz_xGLXVendorPrivateReq;
171706f2543Smrg    buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
172706f2543Smrg
173706f2543Smrg    /*
174706f2543Smrg     * just forward the request to back-end server(s)
175706f2543Smrg     */
176706f2543Smrg    for (s=from_screen; s<=to_screen; s++) {
177706f2543Smrg       DMXScreenInfo *dmxScreen = &dmxScreens[s];
178706f2543Smrg       Display *dpy = GetBackEndDisplay(cl,s);
179706f2543Smrg
180706f2543Smrg       LockDisplay(dpy);
181706f2543Smrg       GetReqVendorPrivate(GLXVendorPrivate,be_req);
182706f2543Smrg       be_req->reqType = dmxScreen->glxMajorOpcode;
183706f2543Smrg       be_req->glxCode = req->glxCode;
184706f2543Smrg       be_req->length = req->length;
185706f2543Smrg       be_req->vendorCode = req->vendorCode;
186706f2543Smrg       be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
187706f2543Smrg       if (buf_size > 0)
188706f2543Smrg	  _XSend(dpy, (const char *)pc, buf_size);
189706f2543Smrg       UnlockDisplay(dpy);
190706f2543Smrg       SyncHandle();
191706f2543Smrg    }
192706f2543Smrg
193706f2543Smrg    return Success;
194706f2543Smrg}
195706f2543Smrg
196706f2543Smrgint __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
197706f2543Smrg{
198706f2543Smrg   ClientPtr client = cl->client;
199706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
200706f2543Smrg   xGLXVendorPrivateReq *be_req;
201706f2543Smrg   xGLXVendorPrivReply reply;
202706f2543Smrg   xGLXVendorPrivReply be_reply;
203706f2543Smrg    __GLXcontext *glxc;
204706f2543Smrg   int buf_size;
205706f2543Smrg   char *be_buf = NULL;
206706f2543Smrg   int   be_buf_size;
207706f2543Smrg   DMXScreenInfo *dmxScreen;
208706f2543Smrg   Display *dpy;
209706f2543Smrg
210706f2543Smrg    glxc = __glXLookupContextByTag(cl, req->contextTag);
211706f2543Smrg    if (!glxc) {
212706f2543Smrg	return __glXBadContext;
213706f2543Smrg    }
214706f2543Smrg
215706f2543Smrg    pc += sz_xGLXVendorPrivateReq;
216706f2543Smrg    buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
217706f2543Smrg
218706f2543Smrg    dmxScreen = &dmxScreens[glxc->pScreen->myNum];
219706f2543Smrg    dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum);
220706f2543Smrg
221706f2543Smrg    /*
222706f2543Smrg     * send the request to the first back-end server
223706f2543Smrg     */
224706f2543Smrg    LockDisplay(dpy);
225706f2543Smrg    GetReqVendorPrivate(GLXVendorPrivate,be_req);
226706f2543Smrg    be_req->reqType = dmxScreen->glxMajorOpcode;
227706f2543Smrg    be_req->glxCode = req->glxCode;
228706f2543Smrg    be_req->length = req->length;
229706f2543Smrg    be_req->vendorCode = req->vendorCode;
230706f2543Smrg    be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag, glxc->pScreen->myNum);
231706f2543Smrg    if (buf_size > 0)
232706f2543Smrg       _XSend(dpy, (const char *)pc, buf_size);
233706f2543Smrg
234706f2543Smrg    /*
235706f2543Smrg     * get the reply from the back-end server
236706f2543Smrg     */
237706f2543Smrg    _XReply(dpy, (xReply*) &be_reply, 0, False);
238706f2543Smrg    be_buf_size = be_reply.length << 2;
239706f2543Smrg    if (be_buf_size > 0) {
240706f2543Smrg       be_buf = (char *)malloc( be_buf_size );
241706f2543Smrg       if (be_buf) {
242706f2543Smrg	  _XRead(dpy, be_buf, be_buf_size);
243706f2543Smrg       }
244706f2543Smrg       else {
245706f2543Smrg	  /* Throw data on the floor */
246706f2543Smrg	  _XEatData(dpy, be_buf_size);
247706f2543Smrg	  return BadAlloc;
248706f2543Smrg       }
249706f2543Smrg    }
250706f2543Smrg
251706f2543Smrg    UnlockDisplay(dpy);
252706f2543Smrg    SyncHandle();
253706f2543Smrg
254706f2543Smrg    /*
255706f2543Smrg     * send the reply to the client
256706f2543Smrg     */
257706f2543Smrg    memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
258706f2543Smrg    reply.type = X_Reply;
259706f2543Smrg    reply.sequenceNumber = client->sequence;
260706f2543Smrg
261706f2543Smrg    if (client->swapped) {
262706f2543Smrg       SendSwappedReply( client, &reply, be_buf, be_buf_size );
263706f2543Smrg    }
264706f2543Smrg    else {
265706f2543Smrg       WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
266706f2543Smrg       if (be_buf_size > 0)
267706f2543Smrg	  WriteToClient(client, be_buf_size, (char *)be_buf);
268706f2543Smrg    }
269706f2543Smrg
270706f2543Smrg    if (be_buf_size > 0) free(be_buf);
271706f2543Smrg
272706f2543Smrg    return Success;
273706f2543Smrg}
274706f2543Smrg
275706f2543Smrgint __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
276706f2543Smrg{
277706f2543Smrg   ClientPtr client = cl->client;
278706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
279706f2543Smrg   xGLXVendorPrivateReq *be_req;
280706f2543Smrg   xGLXVendorPrivReply reply;
281706f2543Smrg   xGLXVendorPrivReply be_reply;
282706f2543Smrg    __GLXcontext *glxc;
283706f2543Smrg   int buf_size;
284706f2543Smrg   char *be_buf = NULL;
285706f2543Smrg   int   be_buf_size = 0;
286706f2543Smrg   int from_screen = 0;
287706f2543Smrg   int to_screen = 0;
288706f2543Smrg   int s;
289706f2543Smrg
290706f2543Smrg   DMXScreenInfo *dmxScreen;
291706f2543Smrg   Display *dpy;
292706f2543Smrg
293706f2543Smrg    glxc = __glXLookupContextByTag(cl, req->contextTag);
294706f2543Smrg    if (!glxc) {
295706f2543Smrg	return 0;
296706f2543Smrg    }
297706f2543Smrg    from_screen = to_screen = glxc->pScreen->myNum;
298706f2543Smrg
299706f2543Smrg#ifdef PANORAMIX
300706f2543Smrg    if (!noPanoramiXExtension) {
301706f2543Smrg       from_screen = 0;
302706f2543Smrg       to_screen = screenInfo.numScreens - 1;
303706f2543Smrg    }
304706f2543Smrg#endif
305706f2543Smrg
306706f2543Smrg    pc += sz_xGLXVendorPrivateReq;
307706f2543Smrg    buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq;
308706f2543Smrg
309706f2543Smrg    /*
310706f2543Smrg     * send the request to the first back-end server(s)
311706f2543Smrg     */
312706f2543Smrg    for (s=to_screen; s>=from_screen; s--) {
313706f2543Smrg       dmxScreen = &dmxScreens[s];
314706f2543Smrg       dpy = GetBackEndDisplay(cl,s);
315706f2543Smrg
316706f2543Smrg       LockDisplay(dpy);
317706f2543Smrg       GetReqVendorPrivate(GLXVendorPrivate,be_req);
318706f2543Smrg       be_req->reqType = dmxScreen->glxMajorOpcode;
319706f2543Smrg       be_req->glxCode = req->glxCode;
320706f2543Smrg       be_req->length = req->length;
321706f2543Smrg       be_req->vendorCode = req->vendorCode;
322706f2543Smrg       be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
323706f2543Smrg       if (buf_size > 0)
324706f2543Smrg	  _XSend(dpy, (const char *)pc, buf_size);
325706f2543Smrg
326706f2543Smrg       /*
327706f2543Smrg	* get the reply from the back-end server
328706f2543Smrg	*/
329706f2543Smrg       _XReply(dpy, (xReply*) &be_reply, 0, False);
330706f2543Smrg       be_buf_size = be_reply.length << 2;
331706f2543Smrg       if (be_buf_size > 0) {
332706f2543Smrg	  be_buf = (char *)malloc( be_buf_size );
333706f2543Smrg	  if (be_buf) {
334706f2543Smrg	     _XRead(dpy, be_buf, be_buf_size);
335706f2543Smrg	  }
336706f2543Smrg	  else {
337706f2543Smrg	     /* Throw data on the floor */
338706f2543Smrg	     _XEatData(dpy, be_buf_size);
339706f2543Smrg	     return BadAlloc;
340706f2543Smrg	  }
341706f2543Smrg       }
342706f2543Smrg
343706f2543Smrg       UnlockDisplay(dpy);
344706f2543Smrg       SyncHandle();
345706f2543Smrg
346706f2543Smrg       if (s > from_screen && be_buf_size > 0) {
347706f2543Smrg	  free(be_buf);
348706f2543Smrg       }
349706f2543Smrg    }
350706f2543Smrg
351706f2543Smrg    /*
352706f2543Smrg     * send the reply to the client
353706f2543Smrg     */
354706f2543Smrg    memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
355706f2543Smrg    reply.type = X_Reply;
356706f2543Smrg    reply.sequenceNumber = client->sequence;
357706f2543Smrg
358706f2543Smrg    if (client->swapped) {
359706f2543Smrg       SendSwappedReply( client, &reply, be_buf, be_buf_size );
360706f2543Smrg    }
361706f2543Smrg    else {
362706f2543Smrg       WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
363706f2543Smrg       if (be_buf_size > 0)
364706f2543Smrg	  WriteToClient(client, be_buf_size, (char *)be_buf);
365706f2543Smrg    }
366706f2543Smrg
367706f2543Smrg    if (be_buf_size > 0) free(be_buf);
368706f2543Smrg
369706f2543Smrg    return Success;
370706f2543Smrg}
371706f2543Smrg
372706f2543Smrgint __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
373706f2543Smrg{
374706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
375706f2543Smrg   __GLX_DECLARE_SWAP_VARIABLES;
376706f2543Smrg
377706f2543Smrg   __GLX_SWAP_SHORT(&req->length);
378706f2543Smrg   __GLX_SWAP_INT(&req->vendorCode);
379706f2543Smrg   __GLX_SWAP_INT(&req->contextTag);
380706f2543Smrg
381706f2543Smrg   swap_vec_element_size = 0;
382706f2543Smrg
383706f2543Smrg   return( __glXVForwardSingleReq( cl, pc ) );
384706f2543Smrg}
385706f2543Smrg
386706f2543Smrgint __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
387706f2543Smrg{
388706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
389706f2543Smrg   __GLX_DECLARE_SWAP_VARIABLES;
390706f2543Smrg   __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
391706f2543Smrg
392706f2543Smrg   __GLX_SWAP_SHORT(&req->length);
393706f2543Smrg   __GLX_SWAP_INT(&req->vendorCode);
394706f2543Smrg   __GLX_SWAP_INT(&req->contextTag);
395706f2543Smrg
396706f2543Smrg   swap_vec_element_size = 0;
397706f2543Smrg
398706f2543Smrg   /*
399706f2543Smrg    * swap extra data in request - assuming all data
400706f2543Smrg    * (if available) are arrays of 4 bytes components !
401706f2543Smrg    */
402706f2543Smrg   if (req->length > sz_xGLXVendorPrivateReq/4) {
403706f2543Smrg      int *data = (int *)(req+1);
404706f2543Smrg      int count = req->length - sz_xGLXVendorPrivateReq/4;
405706f2543Smrg      __GLX_SWAP_INT_ARRAY(data, count );
406706f2543Smrg   }
407706f2543Smrg
408706f2543Smrg   return( __glXVForwardPipe0WithReply( cl, pc ) );
409706f2543Smrg}
410706f2543Smrg
411706f2543Smrgint __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
412706f2543Smrg{
413706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
414706f2543Smrg   __GLX_DECLARE_SWAP_VARIABLES;
415706f2543Smrg   __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
416706f2543Smrg
417706f2543Smrg   __GLX_SWAP_SHORT(&req->length);
418706f2543Smrg   __GLX_SWAP_INT(&req->vendorCode);
419706f2543Smrg   __GLX_SWAP_INT(&req->contextTag);
420706f2543Smrg
421706f2543Smrg   swap_vec_element_size = 2;
422706f2543Smrg
423706f2543Smrg   /*
424706f2543Smrg    * swap extra data in request - assuming all data
425706f2543Smrg    * (if available) are arrays of 4 bytes components !
426706f2543Smrg    */
427706f2543Smrg   if (req->length > sz_xGLXVendorPrivateReq/4) {
428706f2543Smrg      int *data = (int *)(req+1);
429706f2543Smrg      int count = req->length - sz_xGLXVendorPrivateReq/4;
430706f2543Smrg      __GLX_SWAP_INT_ARRAY(data, count );
431706f2543Smrg   }
432706f2543Smrg
433706f2543Smrg   return( __glXVForwardPipe0WithReply( cl, pc ) );
434706f2543Smrg}
435706f2543Smrg
436706f2543Smrgint __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
437706f2543Smrg{
438706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
439706f2543Smrg   __GLX_DECLARE_SWAP_VARIABLES;
440706f2543Smrg   __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
441706f2543Smrg
442706f2543Smrg   __GLX_SWAP_SHORT(&req->length);
443706f2543Smrg   __GLX_SWAP_INT(&req->vendorCode);
444706f2543Smrg   __GLX_SWAP_INT(&req->contextTag);
445706f2543Smrg
446706f2543Smrg   swap_vec_element_size = 4;
447706f2543Smrg
448706f2543Smrg   /*
449706f2543Smrg    * swap extra data in request - assuming all data
450706f2543Smrg    * (if available) are arrays of 4 bytes components !
451706f2543Smrg    */
452706f2543Smrg   if (req->length > sz_xGLXVendorPrivateReq/4) {
453706f2543Smrg      int *data = (int *)(req+1);
454706f2543Smrg      int count = req->length - sz_xGLXVendorPrivateReq/4;
455706f2543Smrg      __GLX_SWAP_INT_ARRAY(data, count );
456706f2543Smrg   }
457706f2543Smrg
458706f2543Smrg   return( __glXVForwardPipe0WithReply( cl, pc ) );
459706f2543Smrg}
460706f2543Smrg
461706f2543Smrgint __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
462706f2543Smrg{
463706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
464706f2543Smrg   __GLX_DECLARE_SWAP_VARIABLES;
465706f2543Smrg   __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
466706f2543Smrg
467706f2543Smrg   __GLX_SWAP_SHORT(&req->length);
468706f2543Smrg   __GLX_SWAP_INT(&req->vendorCode);
469706f2543Smrg   __GLX_SWAP_INT(&req->contextTag);
470706f2543Smrg
471706f2543Smrg   swap_vec_element_size = 8;
472706f2543Smrg
473706f2543Smrg   /*
474706f2543Smrg    * swap extra data in request - assuming all data
475706f2543Smrg    * (if available) are arrays of 4 bytes components !
476706f2543Smrg    */
477706f2543Smrg   if (req->length > sz_xGLXVendorPrivateReq/4) {
478706f2543Smrg      int *data = (int *)(req+1);
479706f2543Smrg      int count = req->length - sz_xGLXVendorPrivateReq/4;
480706f2543Smrg      __GLX_SWAP_INT_ARRAY(data, count );
481706f2543Smrg   }
482706f2543Smrg
483706f2543Smrg   return( __glXVForwardPipe0WithReply( cl, pc ) );
484706f2543Smrg}
485706f2543Smrg
486706f2543Smrgint __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
487706f2543Smrg{
488706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
489706f2543Smrg   __GLX_DECLARE_SWAP_VARIABLES;
490706f2543Smrg   __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
491706f2543Smrg
492706f2543Smrg   __GLX_SWAP_SHORT(&req->length);
493706f2543Smrg   __GLX_SWAP_INT(&req->vendorCode);
494706f2543Smrg   __GLX_SWAP_INT(&req->contextTag);
495706f2543Smrg
496706f2543Smrg   swap_vec_element_size = 0;
497706f2543Smrg
498706f2543Smrg   /*
499706f2543Smrg    * swap extra data in request - assuming all data
500706f2543Smrg    * (if available) are arrays of 4 bytes components !
501706f2543Smrg    */
502706f2543Smrg   if (req->length > sz_xGLXVendorPrivateReq/4) {
503706f2543Smrg      int *data = (int *)(req+1);
504706f2543Smrg      int count = req->length - sz_xGLXVendorPrivateReq/4;
505706f2543Smrg      __GLX_SWAP_INT_ARRAY(data, count );
506706f2543Smrg   }
507706f2543Smrg
508706f2543Smrg   return( __glXVForwardAllWithReply( cl, pc ) );
509706f2543Smrg}
510706f2543Smrg
511706f2543Smrgint __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
512706f2543Smrg{
513706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
514706f2543Smrg   __GLX_DECLARE_SWAP_VARIABLES;
515706f2543Smrg   __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
516706f2543Smrg
517706f2543Smrg   __GLX_SWAP_SHORT(&req->length);
518706f2543Smrg   __GLX_SWAP_INT(&req->vendorCode);
519706f2543Smrg   __GLX_SWAP_INT(&req->contextTag);
520706f2543Smrg
521706f2543Smrg   swap_vec_element_size = 2;
522706f2543Smrg
523706f2543Smrg   /*
524706f2543Smrg    * swap extra data in request - assuming all data
525706f2543Smrg    * (if available) are arrays of 4 bytes components !
526706f2543Smrg    */
527706f2543Smrg   if (req->length > sz_xGLXVendorPrivateReq/4) {
528706f2543Smrg      int *data = (int *)(req+1);
529706f2543Smrg      int count = req->length - sz_xGLXVendorPrivateReq/4;
530706f2543Smrg      __GLX_SWAP_INT_ARRAY(data, count );
531706f2543Smrg   }
532706f2543Smrg
533706f2543Smrg   return( __glXVForwardAllWithReply( cl, pc ) );
534706f2543Smrg}
535706f2543Smrg
536706f2543Smrgint __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
537706f2543Smrg{
538706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
539706f2543Smrg   __GLX_DECLARE_SWAP_VARIABLES;
540706f2543Smrg   __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
541706f2543Smrg
542706f2543Smrg   __GLX_SWAP_SHORT(&req->length);
543706f2543Smrg   __GLX_SWAP_INT(&req->vendorCode);
544706f2543Smrg   __GLX_SWAP_INT(&req->contextTag);
545706f2543Smrg
546706f2543Smrg   swap_vec_element_size = 4;
547706f2543Smrg
548706f2543Smrg   /*
549706f2543Smrg    * swap extra data in request - assuming all data
550706f2543Smrg    * (if available) are arrays of 4 bytes components !
551706f2543Smrg    */
552706f2543Smrg   if (req->length > sz_xGLXVendorPrivateReq/4) {
553706f2543Smrg      int *data = (int *)(req+1);
554706f2543Smrg      int count = req->length - sz_xGLXVendorPrivateReq/4;
555706f2543Smrg      __GLX_SWAP_INT_ARRAY(data, count );
556706f2543Smrg   }
557706f2543Smrg
558706f2543Smrg   return( __glXVForwardAllWithReply( cl, pc ) );
559706f2543Smrg}
560706f2543Smrg
561706f2543Smrgint __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
562706f2543Smrg{
563706f2543Smrg   xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
564706f2543Smrg   __GLX_DECLARE_SWAP_VARIABLES;
565706f2543Smrg   __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
566706f2543Smrg
567706f2543Smrg   __GLX_SWAP_SHORT(&req->length);
568706f2543Smrg   __GLX_SWAP_INT(&req->vendorCode);
569706f2543Smrg   __GLX_SWAP_INT(&req->contextTag);
570706f2543Smrg
571706f2543Smrg   swap_vec_element_size = 8;
572706f2543Smrg
573706f2543Smrg   /*
574706f2543Smrg    * swap extra data in request - assuming all data
575706f2543Smrg    * (if available) are arrays of 4 bytes components !
576706f2543Smrg    */
577706f2543Smrg   if (req->length > sz_xGLXVendorPrivateReq/4) {
578706f2543Smrg      int *data = (int *)(req+1);
579706f2543Smrg      int count = req->length - sz_xGLXVendorPrivateReq/4;
580706f2543Smrg      __GLX_SWAP_INT_ARRAY(data, count );
581706f2543Smrg   }
582706f2543Smrg
583706f2543Smrg   return( __glXVForwardAllWithReply( cl, pc ) );
584706f2543Smrg}
585706f2543Smrg
586