1 /*
2 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice including the dates of first publication and
13 * either this permission notice or a reference to
14 * http://oss.sgi.com/projects/FreeB/
15 * shall be included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 *
25 * Except as contained in this notice, the name of Silicon Graphics, Inc.
26 * shall not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization from
28 * Silicon Graphics, Inc.
29 */
30
31 #include "glxserver.h"
32 #include "glxutil.h"
33 #include <g_disptab.h>
34 #include <pixmapstr.h>
35 #include <windowstr.h>
36 #include "unpack.h"
37 #include "glxcmds.h"
38 #include "glxext.h"
39 #include "glxvendor.h"
40
41 int __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc);
42
43 /************************************************************************/
44
45 /*
46 ** Byteswapping versions of GLX commands. In most cases they just swap
47 ** the incoming arguments and then call the unswapped routine. For commands
48 ** that have replies, a separate swapping routine for the reply is provided;
49 ** it is called at the end of the unswapped routine.
50 */
51
52 int
__glXSwapCreateContext(__GLXclientState * cl,GLbyte * pc)53 __glXSwapCreateContext(__GLXclientState * cl, GLbyte * pc)
54 {
55 xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
56
57 __GLX_DECLARE_SWAP_VARIABLES;
58
59 __GLX_SWAP_SHORT(&req->length);
60 __GLX_SWAP_INT(&req->context);
61 __GLX_SWAP_INT(&req->visual);
62 __GLX_SWAP_INT(&req->screen);
63 __GLX_SWAP_INT(&req->shareList);
64
65 return __glXCreateContext(cl, pc);
66 }
67
68 int
__glXSwapCreateNewContext(__GLXclientState * cl,GLbyte * pc)69 __glXSwapCreateNewContext(__GLXclientState * cl, GLbyte * pc)
70 {
71 xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
72
73 __GLX_DECLARE_SWAP_VARIABLES;
74
75 __GLX_SWAP_SHORT(&req->length);
76 __GLX_SWAP_INT(&req->context);
77 __GLX_SWAP_INT(&req->fbconfig);
78 __GLX_SWAP_INT(&req->screen);
79 __GLX_SWAP_INT(&req->shareList);
80
81 return __glXCreateNewContext(cl, pc);
82 }
83
84 int
__glXSwapCreateContextWithConfigSGIX(__GLXclientState * cl,GLbyte * pc)85 __glXSwapCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
86 {
87 xGLXCreateContextWithConfigSGIXReq *req =
88 (xGLXCreateContextWithConfigSGIXReq *) pc;
89 __GLX_DECLARE_SWAP_VARIABLES;
90
91 __GLX_SWAP_SHORT(&req->length);
92 __GLX_SWAP_INT(&req->context);
93 __GLX_SWAP_INT(&req->fbconfig);
94 __GLX_SWAP_INT(&req->screen);
95 __GLX_SWAP_INT(&req->shareList);
96
97 return __glXCreateContextWithConfigSGIX(cl, pc);
98 }
99
100 int
__glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState * cl,GLbyte * pc)101 __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc)
102 {
103 xGLXQueryMaxSwapBarriersSGIXReq *req =
104 (xGLXQueryMaxSwapBarriersSGIXReq *) pc;
105 __GLX_DECLARE_SWAP_VARIABLES;
106
107 __GLX_SWAP_SHORT(&req->length);
108 __GLX_SWAP_INT(&req->screen);
109
110 return __glXQueryMaxSwapBarriersSGIX(cl, pc);
111 }
112
113 int
__glXSwapBindSwapBarrierSGIX(__GLXclientState * cl,GLbyte * pc)114 __glXSwapBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc)
115 {
116 xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc;
117
118 __GLX_DECLARE_SWAP_VARIABLES;
119
120 __GLX_SWAP_SHORT(&req->length);
121 __GLX_SWAP_INT(&req->drawable);
122 __GLX_SWAP_INT(&req->barrier);
123
124 return __glXBindSwapBarrierSGIX(cl, pc);
125 }
126
127 int
__glXSwapJoinSwapGroupSGIX(__GLXclientState * cl,GLbyte * pc)128 __glXSwapJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc)
129 {
130 xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *) pc;
131
132 __GLX_DECLARE_SWAP_VARIABLES;
133
134 __GLX_SWAP_SHORT(&req->length);
135 __GLX_SWAP_INT(&req->drawable);
136 __GLX_SWAP_INT(&req->member);
137
138 return __glXJoinSwapGroupSGIX(cl, pc);
139 }
140
141 int
__glXSwapDestroyContext(__GLXclientState * cl,GLbyte * pc)142 __glXSwapDestroyContext(__GLXclientState * cl, GLbyte * pc)
143 {
144 xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
145
146 __GLX_DECLARE_SWAP_VARIABLES;
147
148 __GLX_SWAP_SHORT(&req->length);
149 __GLX_SWAP_INT(&req->context);
150
151 return __glXDestroyContext(cl, pc);
152 }
153
154 int
__glXSwapMakeCurrent(__GLXclientState * cl,GLbyte * pc)155 __glXSwapMakeCurrent(__GLXclientState * cl, GLbyte * pc)
156 {
157 xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
158
159 __GLX_DECLARE_SWAP_VARIABLES;
160
161 __GLX_SWAP_SHORT(&req->length);
162 __GLX_SWAP_INT(&req->drawable);
163 __GLX_SWAP_INT(&req->context);
164 __GLX_SWAP_INT(&req->oldContextTag);
165
166 return __glXMakeCurrent(cl, pc);
167 }
168
169 int
__glXSwapMakeContextCurrent(__GLXclientState * cl,GLbyte * pc)170 __glXSwapMakeContextCurrent(__GLXclientState * cl, GLbyte * pc)
171 {
172 xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
173
174 __GLX_DECLARE_SWAP_VARIABLES;
175
176 __GLX_SWAP_SHORT(&req->length);
177 __GLX_SWAP_INT(&req->drawable);
178 __GLX_SWAP_INT(&req->readdrawable);
179 __GLX_SWAP_INT(&req->context);
180 __GLX_SWAP_INT(&req->oldContextTag);
181
182 return __glXMakeContextCurrent(cl, pc);
183 }
184
185 int
__glXSwapMakeCurrentReadSGI(__GLXclientState * cl,GLbyte * pc)186 __glXSwapMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc)
187 {
188 xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
189
190 __GLX_DECLARE_SWAP_VARIABLES;
191
192 __GLX_SWAP_SHORT(&req->length);
193 __GLX_SWAP_INT(&req->drawable);
194 __GLX_SWAP_INT(&req->readable);
195 __GLX_SWAP_INT(&req->context);
196 __GLX_SWAP_INT(&req->oldContextTag);
197
198 return __glXMakeCurrentReadSGI(cl, pc);
199 }
200
201 int
__glXSwapIsDirect(__GLXclientState * cl,GLbyte * pc)202 __glXSwapIsDirect(__GLXclientState * cl, GLbyte * pc)
203 {
204 xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
205
206 __GLX_DECLARE_SWAP_VARIABLES;
207
208 __GLX_SWAP_SHORT(&req->length);
209 __GLX_SWAP_INT(&req->context);
210
211 return __glXIsDirect(cl, pc);
212 }
213
214 int
__glXSwapQueryVersion(__GLXclientState * cl,GLbyte * pc)215 __glXSwapQueryVersion(__GLXclientState * cl, GLbyte * pc)
216 {
217 xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
218
219 __GLX_DECLARE_SWAP_VARIABLES;
220
221 __GLX_SWAP_SHORT(&req->length);
222 __GLX_SWAP_INT(&req->majorVersion);
223 __GLX_SWAP_INT(&req->minorVersion);
224
225 return __glXQueryVersion(cl, pc);
226 }
227
228 int
__glXSwapWaitGL(__GLXclientState * cl,GLbyte * pc)229 __glXSwapWaitGL(__GLXclientState * cl, GLbyte * pc)
230 {
231 xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
232
233 __GLX_DECLARE_SWAP_VARIABLES;
234
235 __GLX_SWAP_SHORT(&req->length);
236 __GLX_SWAP_INT(&req->contextTag);
237
238 return __glXWaitGL(cl, pc);
239 }
240
241 int
__glXSwapWaitX(__GLXclientState * cl,GLbyte * pc)242 __glXSwapWaitX(__GLXclientState * cl, GLbyte * pc)
243 {
244 xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
245
246 __GLX_DECLARE_SWAP_VARIABLES;
247
248 __GLX_SWAP_SHORT(&req->length);
249 __GLX_SWAP_INT(&req->contextTag);
250
251 return __glXWaitX(cl, pc);
252 }
253
254 int
__glXSwapCopyContext(__GLXclientState * cl,GLbyte * pc)255 __glXSwapCopyContext(__GLXclientState * cl, GLbyte * pc)
256 {
257 xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
258
259 __GLX_DECLARE_SWAP_VARIABLES;
260
261 __GLX_SWAP_SHORT(&req->length);
262 __GLX_SWAP_INT(&req->source);
263 __GLX_SWAP_INT(&req->dest);
264 __GLX_SWAP_INT(&req->mask);
265
266 return __glXCopyContext(cl, pc);
267 }
268
269 int
__glXSwapGetVisualConfigs(__GLXclientState * cl,GLbyte * pc)270 __glXSwapGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
271 {
272 ClientPtr client = cl->client;
273 xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
274 xGLXGetVisualConfigsReply reply;
275 __GLXscreenInfo *pGlxScreen;
276 __GLXvisualConfig *pGlxVisual;
277 CARD32 buf[__GLX_TOTAL_CONFIG];
278 unsigned int screen;
279 int i, p;
280
281 __GLX_DECLARE_SWAP_VARIABLES;
282 __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
283
284 __GLX_SWAP_INT(&req->screen);
285 screen = req->screen;
286 if (screen >= screenInfo.numScreens) {
287 /* The client library must send a valid screen number. */
288 client->errorValue = screen;
289 return BadValue;
290 }
291 pGlxScreen = &__glXActiveScreens[screen];
292
293 reply = (xGLXGetVisualConfigsReply) {
294 .type = X_Reply,
295 .sequenceNumber = client->sequence,
296 .length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
297 __GLX_TOTAL_CONFIG) >> 2,
298 .numVisuals = pGlxScreen->numGLXVisuals,
299 .numProps = __GLX_TOTAL_CONFIG
300 };
301
302 __GLX_SWAP_SHORT(&reply.sequenceNumber);
303 __GLX_SWAP_INT(&reply.length);
304 __GLX_SWAP_INT(&reply.numVisuals);
305 __GLX_SWAP_INT(&reply.numProps);
306 WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply);
307
308 for (i = 0; i < pGlxScreen->numVisuals; i++) {
309 pGlxVisual = &pGlxScreen->pGlxVisual[i];
310 if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
311 /* not a usable visual */
312 continue;
313 }
314 p = 0;
315 buf[p++] = pGlxVisual->vid;
316 buf[p++] = pGlxVisual->class;
317 buf[p++] = pGlxVisual->rgba;
318
319 buf[p++] = pGlxVisual->redSize;
320 buf[p++] = pGlxVisual->greenSize;
321 buf[p++] = pGlxVisual->blueSize;
322 buf[p++] = pGlxVisual->alphaSize;
323 buf[p++] = pGlxVisual->accumRedSize;
324 buf[p++] = pGlxVisual->accumGreenSize;
325 buf[p++] = pGlxVisual->accumBlueSize;
326 buf[p++] = pGlxVisual->accumAlphaSize;
327
328 buf[p++] = pGlxVisual->doubleBuffer;
329 buf[p++] = pGlxVisual->stereo;
330
331 buf[p++] = pGlxVisual->bufferSize;
332 buf[p++] = pGlxVisual->depthSize;
333 buf[p++] = pGlxVisual->stencilSize;
334 buf[p++] = pGlxVisual->auxBuffers;
335 buf[p++] = pGlxVisual->level;
336 /*
337 ** Add token/value pairs for extensions.
338 */
339 buf[p++] = GLX_VISUAL_CAVEAT_EXT;
340 buf[p++] = pGlxVisual->visualRating;
341 buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
342 buf[p++] = pGlxVisual->transparentPixel;
343 buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
344 buf[p++] = pGlxVisual->transparentRed;
345 buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
346 buf[p++] = pGlxVisual->transparentGreen;
347 buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
348 buf[p++] = pGlxVisual->transparentBlue;
349 buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
350 buf[p++] = pGlxVisual->transparentAlpha;
351 buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
352 buf[p++] = pGlxVisual->transparentIndex;
353
354 __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
355 WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, buf);
356 }
357 return Success;
358 }
359
360 int
__glXSwapCreateGLXPixmap(__GLXclientState * cl,GLbyte * pc)361 __glXSwapCreateGLXPixmap(__GLXclientState * cl, GLbyte * pc)
362 {
363 xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
364
365 __GLX_DECLARE_SWAP_VARIABLES;
366
367 __GLX_SWAP_SHORT(&req->length);
368 __GLX_SWAP_INT(&req->screen);
369 __GLX_SWAP_INT(&req->visual);
370 __GLX_SWAP_INT(&req->pixmap);
371 __GLX_SWAP_INT(&req->glxpixmap);
372
373 return __glXCreateGLXPixmap(cl, pc);
374 }
375
376 int
__glXSwapCreatePixmap(__GLXclientState * cl,GLbyte * pc)377 __glXSwapCreatePixmap(__GLXclientState * cl, GLbyte * pc)
378 {
379 xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
380
381 __GLX_DECLARE_SWAP_VARIABLES;
382
383 __GLX_SWAP_SHORT(&req->length);
384 __GLX_SWAP_INT(&req->screen);
385 __GLX_SWAP_INT(&req->fbconfig);
386 __GLX_SWAP_INT(&req->pixmap);
387 __GLX_SWAP_INT(&req->glxpixmap);
388 __GLX_SWAP_INT(&req->numAttribs);
389
390 return __glXCreatePixmap(cl, pc);
391 }
392
393 int
__glXSwapDestroyGLXPixmap(__GLXclientState * cl,GLbyte * pc)394 __glXSwapDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc)
395 {
396 xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
397
398 __GLX_DECLARE_SWAP_VARIABLES;
399
400 __GLX_SWAP_SHORT(&req->length);
401 __GLX_SWAP_INT(&req->glxpixmap);
402
403 return __glXDestroyGLXPixmap(cl, pc);
404 }
405
406 int
__glXSwapSwapBuffers(__GLXclientState * cl,GLbyte * pc)407 __glXSwapSwapBuffers(__GLXclientState * cl, GLbyte * pc)
408 {
409 xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
410
411 __GLX_DECLARE_SWAP_VARIABLES;
412
413 __GLX_SWAP_SHORT(&req->length);
414 __GLX_SWAP_INT(&req->contextTag);
415 __GLX_SWAP_INT(&req->drawable);
416
417 return __glXSwapBuffers(cl, pc);
418 }
419
420 int
__glXSwapUseXFont(__GLXclientState * cl,GLbyte * pc)421 __glXSwapUseXFont(__GLXclientState * cl, GLbyte * pc)
422 {
423 xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc;
424
425 __GLX_DECLARE_SWAP_VARIABLES;
426
427 __GLX_SWAP_SHORT(&req->length);
428 __GLX_SWAP_INT(&req->contextTag);
429 __GLX_SWAP_INT(&req->font);
430 __GLX_SWAP_INT(&req->first);
431 __GLX_SWAP_INT(&req->count);
432 __GLX_SWAP_INT(&req->listBase);
433
434 return __glXUseXFont(cl, pc);
435 }
436
437 int
__glXSwapQueryExtensionsString(__GLXclientState * cl,GLbyte * pc)438 __glXSwapQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
439 {
440 xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
441
442 __GLX_DECLARE_SWAP_VARIABLES;
443
444 __GLX_SWAP_SHORT(&req->length);
445 __GLX_SWAP_INT(&req->screen);
446
447 return __glXQueryExtensionsString(cl, pc);
448 }
449
450 int
__glXSwapQueryServerString(__GLXclientState * cl,GLbyte * pc)451 __glXSwapQueryServerString(__GLXclientState * cl, GLbyte * pc)
452 {
453 xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
454
455 __GLX_DECLARE_SWAP_VARIABLES;
456
457 __GLX_SWAP_SHORT(&req->length);
458 __GLX_SWAP_INT(&req->screen);
459 __GLX_SWAP_INT(&req->name);
460
461 return __glXQueryServerString(cl, pc);
462 }
463
464 int
__glXSwapClientInfo(__GLXclientState * cl,GLbyte * pc)465 __glXSwapClientInfo(__GLXclientState * cl, GLbyte * pc)
466 {
467 xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
468
469 __GLX_DECLARE_SWAP_VARIABLES;
470
471 __GLX_SWAP_SHORT(&req->length);
472 __GLX_SWAP_INT(&req->major);
473 __GLX_SWAP_INT(&req->minor);
474 __GLX_SWAP_INT(&req->numbytes);
475
476 return __glXClientInfo(cl, pc);
477 }
478
479 int
__glXSwapQueryContextInfoEXT(__GLXclientState * cl,char * pc)480 __glXSwapQueryContextInfoEXT(__GLXclientState * cl, char *pc)
481 {
482 xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
483
484 __GLX_DECLARE_SWAP_VARIABLES;
485
486 __GLX_SWAP_SHORT(&req->length);
487 __GLX_SWAP_INT(&req->context);
488
489 return __glXQueryContextInfoEXT(cl, (GLbyte *) pc);
490 }
491
492 /************************************************************************/
493
494 /*
495 ** Swap replies.
496 */
497
498 void
__glXSwapMakeCurrentReply(ClientPtr client,xGLXMakeCurrentReadSGIReply * reply)499 __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply * reply)
500 {
501 __GLX_DECLARE_SWAP_VARIABLES;
502 __GLX_SWAP_SHORT(&reply->sequenceNumber);
503 __GLX_SWAP_INT(&reply->length);
504 __GLX_SWAP_INT(&reply->contextTag);
505 __GLX_SWAP_INT(&reply->writeVid);
506 __GLX_SWAP_INT(&reply->writeType);
507 __GLX_SWAP_INT(&reply->readVid);
508 __GLX_SWAP_INT(&reply->readType);
509 WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, reply);
510 }
511
512 void
__glXSwapIsDirectReply(ClientPtr client,xGLXIsDirectReply * reply)513 __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply)
514 {
515 __GLX_DECLARE_SWAP_VARIABLES;
516 __GLX_SWAP_SHORT(&reply->sequenceNumber);
517 __GLX_SWAP_INT(&reply->length);
518 WriteToClient(client, sz_xGLXIsDirectReply, reply);
519 }
520
521 void
__glXSwapQueryVersionReply(ClientPtr client,xGLXQueryVersionReply * reply)522 __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply)
523 {
524 __GLX_DECLARE_SWAP_VARIABLES;
525 __GLX_SWAP_SHORT(&reply->sequenceNumber);
526 __GLX_SWAP_INT(&reply->length);
527 __GLX_SWAP_INT(&reply->majorVersion);
528 __GLX_SWAP_INT(&reply->minorVersion);
529 WriteToClient(client, sz_xGLXQueryVersionReply, reply);
530 }
531
532 void
glxSwapQueryExtensionsStringReply(ClientPtr client,xGLXQueryExtensionsStringReply * reply,char * buf)533 glxSwapQueryExtensionsStringReply(ClientPtr client,
534 xGLXQueryExtensionsStringReply * reply,
535 char *buf)
536 {
537 int length = reply->length;
538
539 __GLX_DECLARE_SWAP_VARIABLES;
540 __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
541 __GLX_SWAP_SHORT(&reply->sequenceNumber);
542 __GLX_SWAP_INT(&reply->length);
543 __GLX_SWAP_INT(&reply->n);
544 WriteToClient(client, sz_xGLXQueryExtensionsStringReply, reply);
545 __GLX_SWAP_INT_ARRAY((int *) buf, length);
546 WriteToClient(client, length << 2, buf);
547 }
548
549 void
glxSwapQueryServerStringReply(ClientPtr client,xGLXQueryServerStringReply * reply,char * buf)550 glxSwapQueryServerStringReply(ClientPtr client,
551 xGLXQueryServerStringReply * reply, char *buf)
552 {
553 int length = reply->length;
554
555 __GLX_DECLARE_SWAP_VARIABLES;
556 __GLX_SWAP_SHORT(&reply->sequenceNumber);
557 __GLX_SWAP_INT(&reply->length);
558 __GLX_SWAP_INT(&reply->n);
559 WriteToClient(client, sz_xGLXQueryServerStringReply, reply);
560 /** no swap is needed for an array of chars **/
561 /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
562 WriteToClient(client, length << 2, buf);
563 }
564
565 void
__glXSwapQueryContextInfoEXTReply(ClientPtr client,xGLXQueryContextInfoEXTReply * reply,int * buf)566 __glXSwapQueryContextInfoEXTReply(ClientPtr client,
567 xGLXQueryContextInfoEXTReply * reply,
568 int *buf)
569 {
570 int length = reply->length;
571
572 __GLX_DECLARE_SWAP_VARIABLES;
573 __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
574 __GLX_SWAP_SHORT(&reply->sequenceNumber);
575 __GLX_SWAP_INT(&reply->length);
576 __GLX_SWAP_INT(&reply->n);
577 WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, reply);
578 __GLX_SWAP_INT_ARRAY((int *) buf, length);
579 WriteToClient(client, length << 2, buf);
580 }
581
582 void
__glXSwapQueryContextReply(ClientPtr client,xGLXQueryContextReply * reply,int * buf)583 __glXSwapQueryContextReply(ClientPtr client,
584 xGLXQueryContextReply * reply, int *buf)
585 {
586 int length = reply->length;
587
588 __GLX_DECLARE_SWAP_VARIABLES;
589 __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
590 __GLX_SWAP_SHORT(&reply->sequenceNumber);
591 __GLX_SWAP_INT(&reply->length);
592 __GLX_SWAP_INT(&reply->n);
593 WriteToClient(client, sz_xGLXQueryContextReply, reply);
594 __GLX_SWAP_INT_ARRAY((int *) buf, length);
595 WriteToClient(client, length << 2, buf);
596 }
597
598 void
__glXSwapGetDrawableAttributesReply(ClientPtr client,xGLXGetDrawableAttributesReply * reply,int * buf)599 __glXSwapGetDrawableAttributesReply(ClientPtr client,
600 xGLXGetDrawableAttributesReply * reply,
601 int *buf)
602 {
603 __GLX_DECLARE_SWAP_VARIABLES;
604 __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
605 __GLX_SWAP_SHORT(&reply->sequenceNumber);
606 __GLX_SWAP_INT(&reply->length);
607 __GLX_SWAP_INT(&reply->numAttribs);
608 __GLX_SWAP_INT_ARRAY(buf, reply->length);
609 WriteToClient(client, sz_xGLXGetDrawableAttributesReply, reply);
610 WriteToClient(client, reply->length << 2, buf);
611 }
612
613 void
__glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,xGLXQueryMaxSwapBarriersSGIXReply * reply)614 __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
615 xGLXQueryMaxSwapBarriersSGIXReply *
616 reply)
617 {
618 __GLX_DECLARE_SWAP_VARIABLES;
619 __GLX_SWAP_SHORT(&reply->sequenceNumber);
620 __GLX_SWAP_INT(&reply->length);
621 __GLX_SWAP_INT(&reply->max);
622 WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, reply);
623 }
624
625 /************************************************************************/
626
627 /*
628 ** Render and Renderlarge are not in the GLX API. They are used by the GLX
629 ** client library to send batches of GL rendering commands.
630 */
631
632 int
__glXSwapRender(__GLXclientState * cl,GLbyte * pc)633 __glXSwapRender(__GLXclientState * cl, GLbyte * pc)
634 {
635 xGLXRenderReq *req;
636 int left;
637 __GLXrenderHeader *hdr;
638 ClientPtr client = cl->client;
639
640 __GLX_DECLARE_SWAP_VARIABLES;
641 __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
642
643 /*
644 ** NOTE: much of this code also appears in the nonswapping version of this
645 ** routine, __glXRender(). Any changes made here should also be
646 ** duplicated there.
647 */
648
649 req = (xGLXRenderReq *) pc;
650 __GLX_SWAP_SHORT(&req->length);
651 __GLX_SWAP_INT(&req->contextTag);
652
653 pc += sz_xGLXRenderReq;
654 left = (req->length << 2) - sz_xGLXRenderReq;
655 while (left > 0) {
656 void (*proc) (GLbyte *);
657 CARD16 opcode;
658
659 /*
660 ** Verify that the header length and the overall length agree.
661 ** Also, each command must be word aligned.
662 */
663 hdr = (__GLXrenderHeader *) pc;
664 __GLX_SWAP_SHORT(&hdr->length);
665 __GLX_SWAP_SHORT(&hdr->opcode);
666
667 /*
668 * call the command procedure to swap any arguments
669 */
670 opcode = hdr->opcode;
671 if ((opcode >= __GLX_MIN_RENDER_OPCODE) &&
672 (opcode <= __GLX_MAX_RENDER_OPCODE)) {
673 proc = __glXSwapRenderTable[opcode];
674 #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
675 }
676 else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
677 (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) {
678 int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
679 __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index];
680
681 if (info->swapfunc) {
682 proc = info->swapfunc;
683 }
684 else {
685 proc = NULL;
686 if (info->elem_size == 4 && info->nelems > 0) {
687 __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_HDR_SIZE),
688 info->nelems);
689 }
690 else if (info->elem_size == 2 && info->nelems > 0) {
691 __GLX_SWAP_SHORT_ARRAY((short *) (pc +
692 __GLX_RENDER_HDR_SIZE),
693 info->nelems);
694 }
695 else if (info->elem_size == 8 && info->nelems > 0) {
696 __GLX_SWAP_DOUBLE_ARRAY((double *) (pc +
697 __GLX_RENDER_HDR_SIZE),
698 info->nelems);
699 }
700 }
701 #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
702 }
703 else {
704 client->errorValue = 0;
705 return __glXBadRenderRequest;
706 }
707
708 if (proc != NULL)
709 (*proc) (pc + __GLX_RENDER_HDR_SIZE);
710
711 /*
712 * proceed to the next command
713 */
714 pc += hdr->length;
715 left -= hdr->length;
716 }
717
718 return __glXRender(cl, (GLbyte *) req);
719 }
720
721 /*
722 ** Execute a large rendering request (one that spans multiple X requests).
723 */
724 int
__glXSwapRenderLarge(__GLXclientState * cl,GLbyte * pc)725 __glXSwapRenderLarge(__GLXclientState * cl, GLbyte * pc)
726 {
727 ClientPtr client = cl->client;
728 xGLXRenderLargeReq *req;
729 __GLXrenderLargeHeader *hdr;
730
731 __GLX_DECLARE_SWAP_VARIABLES;
732 __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
733
734 req = (xGLXRenderLargeReq *) pc;
735 __GLX_SWAP_SHORT(&req->length);
736 __GLX_SWAP_INT(&req->contextTag);
737 __GLX_SWAP_INT(&req->dataBytes);
738 __GLX_SWAP_SHORT(&req->requestNumber);
739 __GLX_SWAP_SHORT(&req->requestTotal);
740
741 pc += sz_xGLXRenderLargeReq;
742
743 if (req->requestNumber == 1) {
744 void (*proc) (GLbyte *) = NULL;
745 __GLXRenderSwapInfo *info = NULL;
746 CARD16 opcode;
747
748 hdr = (__GLXrenderLargeHeader *) pc;
749 __GLX_SWAP_INT(&hdr->length);
750 __GLX_SWAP_INT(&hdr->opcode);
751
752 /*
753 * call the command procedure to swap any arguments
754 * Note that we are assuming that all arguments that needs to be
755 * swaped are on the first req only !
756 */
757 opcode = hdr->opcode;
758 if ((opcode >= __GLX_MIN_RENDER_OPCODE) &&
759 (opcode <= __GLX_MAX_RENDER_OPCODE)) {
760 proc = __glXSwapRenderTable[opcode];
761 #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
762 }
763 else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
764 (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) {
765 int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
766
767 info = &__glXSwapRenderTable_EXT[index];
768 if (info->swapfunc) {
769 proc = info->swapfunc;
770 }
771 #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
772 }
773 else {
774 client->errorValue = 0;
775 cl->largeCmdRequestsTotal = 0;
776 return __glXBadLargeRequest;
777 }
778
779 /*
780 ** Make enough space in the buffer, then copy the entire request.
781 */
782 if (cl->largeCmdBufSize < hdr->length) {
783 if (!cl->largeCmdBuf) {
784 cl->largeCmdBuf = (GLbyte *) malloc(hdr->length);
785 }
786 else {
787 cl->largeCmdBuf =
788 (GLbyte *) realloc(cl->largeCmdBuf, hdr->length);
789 }
790 if (!cl->largeCmdBuf) {
791 cl->largeCmdRequestsTotal = 0;
792 return BadAlloc;
793 }
794 cl->largeCmdBufSize = hdr->length;
795 }
796 memcpy(cl->largeCmdBuf, pc, req->dataBytes);
797
798 cl->largeCmdBytesSoFar = req->dataBytes;
799 cl->largeCmdBytesTotal = hdr->length;
800 cl->largeCmdRequestsSoFar = 1;
801 cl->largeCmdRequestsTotal = req->requestTotal;
802 cl->largeCmdRequestsSwapProc = proc;
803 cl->largeCmdMaxReqDataSize = req->dataBytes;
804 cl->largeCmdRequestsSwap_info = info;
805
806 return Success;
807
808 }
809 else if (req->requestNumber < cl->largeCmdRequestsTotal) {
810 /*
811 * This is not the first nor last request - just copy the data
812 */
813 if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
814 cl->largeCmdRequestsTotal = 0;
815 return __glXBadLargeRequest;
816 }
817
818 memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes);
819
820 cl->largeCmdBytesSoFar += req->dataBytes;
821
822 if (req->dataBytes > cl->largeCmdMaxReqDataSize)
823 cl->largeCmdMaxReqDataSize = req->dataBytes;
824
825 return Success;
826 }
827 else if (req->requestNumber == cl->largeCmdRequestsTotal) {
828 /*
829 * this is the last request
830 * copy the remainder bytes, call the procedure to swap any
831 * needed data, and then call to transfer the command to all
832 * back-end servers
833 */
834 if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
835 cl->largeCmdRequestsTotal = 0;
836 return __glXBadLargeRequest;
837 }
838
839 memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes);
840
841 cl->largeCmdBytesSoFar += req->dataBytes;
842
843 if (req->dataBytes > cl->largeCmdMaxReqDataSize)
844 cl->largeCmdMaxReqDataSize = req->dataBytes;
845
846 if (cl->largeCmdRequestsSwapProc != NULL) {
847 (*cl->largeCmdRequestsSwapProc) (cl->largeCmdBuf +
848 __GLX_RENDER_LARGE_HDR_SIZE);
849 }
850 else if (cl->largeCmdRequestsSwap_info &&
851 cl->largeCmdRequestsSwap_info->nelems > 0) {
852 if (cl->largeCmdRequestsSwap_info->elem_size == 4) {
853 __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_LARGE_HDR_SIZE),
854 cl->largeCmdRequestsSwap_info->nelems);
855 }
856 else if (cl->largeCmdRequestsSwap_info->elem_size == 2) {
857 __GLX_SWAP_SHORT_ARRAY((short *) (pc +
858 __GLX_RENDER_LARGE_HDR_SIZE),
859 cl->largeCmdRequestsSwap_info->nelems);
860 }
861 else if (cl->largeCmdRequestsSwap_info->elem_size == 8) {
862 __GLX_SWAP_DOUBLE_ARRAY((double *) (pc +
863 __GLX_RENDER_LARGE_HDR_SIZE),
864 cl->largeCmdRequestsSwap_info->nelems);
865 }
866 }
867
868 cl->largeCmdRequestsTotal = 0;
869 return (__glXSendLargeCommand(cl, req->contextTag));
870
871 }
872 else {
873 cl->largeCmdRequestsTotal = 0;
874 return __glXBadLargeRequest;
875 }
876
877 }
878
879 /************************************************************************/
880
881 /*
882 ** No support is provided for the vendor-private requests other than
883 ** allocating these entry points in the dispatch table.
884 */
885
886 int
__glXSwapVendorPrivate(__GLXclientState * cl,GLbyte * pc)887 __glXSwapVendorPrivate(__GLXclientState * cl, GLbyte * pc)
888 {
889 xGLXVendorPrivateReq *req;
890 CARD32 vendorCode;
891
892 __GLX_DECLARE_SWAP_VARIABLES;
893
894 req = (xGLXVendorPrivateReq *) pc;
895 vendorCode = req->vendorCode;
896 __GLX_SWAP_INT(&vendorCode);
897
898 switch (vendorCode) {
899
900 case X_GLvop_DeleteTexturesEXT:
901 return __glXVForwardSingleReqSwap(cl, pc);
902 break;
903
904 case X_GLXvop_SwapIntervalSGI:
905 if (glxIsExtensionSupported("SGI_swap_control")) {
906 return __glXVForwardSingleReqSwap(cl, pc);
907 }
908 else {
909 return Success;
910 }
911 break;
912
913 #if 0 /* glx 1.3 */
914 case X_GLXvop_CreateGLXVideoSourceSGIX:
915 break;
916 case X_GLXvop_DestroyGLXVideoSourceSGIX:
917 break;
918 case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
919 break;
920 case X_GLXvop_DestroyGLXPbufferSGIX:
921 break;
922 case X_GLXvop_ChangeDrawableAttributesSGIX:
923 break;
924 #endif
925
926 case X_GLXvop_JoinSwapGroupSGIX:
927 return __glXSwapJoinSwapGroupSGIX(cl, pc);
928 break;
929
930 case X_GLXvop_BindSwapBarrierSGIX:
931 return __glXSwapBindSwapBarrierSGIX(cl, pc);
932 break;
933
934 case X_GLXvop_CreateContextWithConfigSGIX:
935 return __glXSwapCreateContextWithConfigSGIX(cl, pc);
936 break;
937
938 default:
939 /*
940 ** unsupported private request
941 */
942 cl->client->errorValue = req->vendorCode;
943 return __glXUnsupportedPrivateRequest;
944 }
945
946 }
947
948 int
__glXSwapVendorPrivateWithReply(__GLXclientState * cl,GLbyte * pc)949 __glXSwapVendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc)
950 {
951 xGLXVendorPrivateWithReplyReq *req;
952 CARD32 vendorCode;
953
954 __GLX_DECLARE_SWAP_VARIABLES;
955
956 req = (xGLXVendorPrivateWithReplyReq *) pc;
957 vendorCode = req->vendorCode;
958 __GLX_SWAP_INT(&vendorCode);
959
960 switch (vendorCode) {
961
962 case X_GLvop_GetConvolutionFilterEXT:
963 case X_GLvop_GetSeparableFilterEXT:
964 case X_GLvop_GetHistogramEXT:
965 case X_GLvop_GetMinmaxEXT:
966 return (__glXNoSuchSingleOpcode(cl, pc));
967 break;
968
969 case X_GLvop_GetConvolutionParameterfvEXT:
970 case X_GLvop_GetConvolutionParameterivEXT:
971 case X_GLvop_GetHistogramParameterivEXT:
972 case X_GLvop_GetMinmaxParameterfvEXT:
973 case X_GLvop_GetMinmaxParameterivEXT:
974 case X_GLvop_GenTexturesEXT:
975 return (__glXVForwardAllWithReplySwapiv(cl, pc));
976 break;
977
978 case X_GLvop_AreTexturesResidentEXT:
979 case X_GLvop_IsTextureEXT:
980 return (__glXVForwardPipe0WithReplySwap(cl, pc));
981 break;
982
983 #if 0 /* glx1.3 */
984 case X_GLvop_GetDetailTexFuncSGIS:
985 case X_GLvop_GetSharpenTexFuncSGIS:
986 case X_GLvop_GetColorTableSGI:
987 case X_GLvop_GetColorTableParameterfvSGI:
988 case X_GLvop_GetColorTableParameterivSGI:
989 case X_GLvop_GetTexFilterFuncSGIS:
990 case X_GLvop_GetInstrumentsSGIX:
991 case X_GLvop_InstrumentsBufferSGIX:
992 case X_GLvop_PollInstrumentsSGIX:
993 case X_GLvop_FlushRasterSGIX:
994 case X_GLXvop_CreateGLXPbufferSGIX:
995 case X_GLXvop_GetDrawableAttributesSGIX:
996 case X_GLXvop_QueryHyperpipeNetworkSGIX:
997 case X_GLXvop_QueryHyperpipeConfigSGIX:
998 case X_GLXvop_HyperpipeConfigSGIX:
999 case X_GLXvop_DestroyHyperpipeConfigSGIX:
1000 #endif
1001 case X_GLXvop_QueryMaxSwapBarriersSGIX:
1002 return (__glXSwapQueryMaxSwapBarriersSGIX(cl, pc));
1003 break;
1004
1005 case X_GLXvop_GetFBConfigsSGIX:
1006 return (__glXSwapGetFBConfigsSGIX(cl, pc));
1007 break;
1008
1009 case X_GLXvop_MakeCurrentReadSGI:
1010 return (__glXSwapMakeCurrentReadSGI(cl, pc));
1011 break;
1012
1013 case X_GLXvop_QueryContextInfoEXT:
1014 return (__glXSwapQueryContextInfoEXT(cl, (char *) pc));
1015 break;
1016
1017 default:
1018 /*
1019 ** unsupported private request
1020 */
1021 cl->client->errorValue = req->vendorCode;
1022 return __glXUnsupportedPrivateRequest;
1023 }
1024
1025 }
1026
1027 int
__glXSwapGetFBConfigs(__GLXclientState * cl,GLbyte * pc)1028 __glXSwapGetFBConfigs(__GLXclientState * cl, GLbyte * pc)
1029 {
1030 xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
1031
1032 __GLX_DECLARE_SWAP_VARIABLES;
1033
1034 __GLX_SWAP_SHORT(&req->length);
1035 __GLX_SWAP_INT(&req->screen);
1036
1037 return __glXGetFBConfigs(cl, pc);
1038 }
1039
1040 int
__glXSwapGetFBConfigsSGIX(__GLXclientState * cl,GLbyte * pc)1041 __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
1042 {
1043 xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
1044 xGLXGetFBConfigsReq new_req;
1045
1046 new_req.reqType = req->reqType;
1047 new_req.glxCode = req->glxCode;
1048 new_req.length = req->length;
1049 new_req.screen = req->screen;
1050
1051 return (__glXSwapGetFBConfigs(cl, (GLbyte *) &new_req));
1052 }
1053
1054 int
__glXSwapCreateWindow(__GLXclientState * cl,GLbyte * pc)1055 __glXSwapCreateWindow(__GLXclientState * cl, GLbyte * pc)
1056 {
1057 xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
1058
1059 __GLX_DECLARE_SWAP_VARIABLES;
1060
1061 __GLX_SWAP_SHORT(&req->length);
1062 __GLX_SWAP_INT(&req->screen);
1063 __GLX_SWAP_INT(&req->fbconfig);
1064 __GLX_SWAP_INT(&req->window);
1065 __GLX_SWAP_INT(&req->glxwindow);
1066 __GLX_SWAP_INT(&req->numAttribs);
1067
1068 return (__glXCreateWindow(cl, (GLbyte *) pc));
1069 }
1070
1071 int
__glXSwapDestroyWindow(__GLXclientState * cl,GLbyte * pc)1072 __glXSwapDestroyWindow(__GLXclientState * cl, GLbyte * pc)
1073 {
1074 xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
1075
1076 __GLX_DECLARE_SWAP_VARIABLES;
1077
1078 __GLX_SWAP_SHORT(&req->length);
1079 __GLX_SWAP_INT(&req->glxwindow);
1080
1081 return (__glXDestroyWindow(cl, (GLbyte *) pc));
1082 }
1083
1084 int
__glXSwapQueryContext(__GLXclientState * cl,GLbyte * pc)1085 __glXSwapQueryContext(__GLXclientState * cl, GLbyte * pc)
1086 {
1087 xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
1088
1089 __GLX_DECLARE_SWAP_VARIABLES;
1090
1091 __GLX_SWAP_SHORT(&req->length);
1092 __GLX_SWAP_INT(&req->context);
1093
1094 return (__glXQueryContext(cl, (GLbyte *) pc));
1095
1096 }
1097
1098 int
__glXSwapCreatePbuffer(__GLXclientState * cl,GLbyte * pc)1099 __glXSwapCreatePbuffer(__GLXclientState * cl, GLbyte * pc)
1100 {
1101 xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
1102 int nattr = req->numAttribs;
1103
1104 __GLX_DECLARE_SWAP_VARIABLES;
1105 __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
1106
1107 __GLX_SWAP_SHORT(&req->length);
1108 __GLX_SWAP_INT(&req->screen);
1109 __GLX_SWAP_INT(&req->fbconfig);
1110 __GLX_SWAP_INT(&req->pbuffer);
1111 __GLX_SWAP_INT(&req->numAttribs);
1112 __GLX_SWAP_INT_ARRAY((int *) (req + 1), nattr * 2);
1113
1114 return (__glXCreatePbuffer(cl, pc));
1115 }
1116
1117 int
__glXSwapDestroyPbuffer(__GLXclientState * cl,GLbyte * pc)1118 __glXSwapDestroyPbuffer(__GLXclientState * cl, GLbyte * pc)
1119 {
1120 xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
1121
1122 __GLX_DECLARE_SWAP_VARIABLES;
1123
1124 __GLX_SWAP_SHORT(&req->length);
1125 __GLX_SWAP_INT(&req->pbuffer);
1126
1127 return (__glXDestroyPbuffer(cl, (GLbyte *) pc));
1128 }
1129
1130 int
__glXSwapGetDrawableAttributes(__GLXclientState * cl,GLbyte * pc)1131 __glXSwapGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
1132 {
1133 xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc;
1134
1135 __GLX_DECLARE_SWAP_VARIABLES;
1136
1137 __GLX_SWAP_SHORT(&req->length);
1138 __GLX_SWAP_INT(&req->drawable);
1139
1140 return (__glXGetDrawableAttributes(cl, pc));
1141 }
1142
1143 int
__glXSwapChangeDrawableAttributes(__GLXclientState * cl,GLbyte * pc)1144 __glXSwapChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
1145 {
1146 xGLXChangeDrawableAttributesReq *req =
1147 (xGLXChangeDrawableAttributesReq *) pc;
1148 __GLX_DECLARE_SWAP_VARIABLES;
1149 __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
1150
1151 __GLX_SWAP_SHORT(&req->length);
1152 __GLX_SWAP_INT(&req->drawable);
1153 __GLX_SWAP_INT(&req->numAttribs);
1154 __GLX_SWAP_INT_ARRAY((int *) (req + 1), req->numAttribs * 2);
1155
1156 return (__glXChangeDrawableAttributes(cl, pc));
1157 }
1158