| 1 | /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ |
| 2 | /* |
| 3 | * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) |
| 4 | * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice including the dates of first publication and |
| 14 | * either this permission notice or a reference to |
| 15 | * http://oss.sgi.com/projects/FreeB/ |
| 16 | * shall be included in all copies or substantial portions of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 19 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 21 | * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF |
| 23 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 24 | * SOFTWARE. |
| 25 | * |
| 26 | * Except as contained in this notice, the name of Silicon Graphics, Inc. |
| 27 | * shall not be used in advertising or otherwise to promote the sale, use or |
| 28 | * other dealings in this Software without prior written authorization from |
| 29 | * Silicon Graphics, Inc. |
| 30 | */ |
| 31 | |
| 32 | #ifdef HAVE_DMX_CONFIG_H |
| 33 | #include <dmx-config.h> |
| 34 | #endif |
| 35 | |
| 36 | #include "dmx.h" |
| 37 | #include "dmxwindow.h" |
| 38 | #include "dmxpixmap.h" |
| 39 | #include "dmxfont.h" |
| 40 | |
| 41 | #include "glxserver.h" |
| 42 | #include "glxext.h" |
| 43 | #include "g_disptab.h" |
| 44 | /* #include "g_disptab_EXT.h" */ |
| 45 | #include "unpack.h" |
| 46 | #include "glxutil.h" |
| 47 | |
| 48 | #include "GL/glxproto.h" |
| 49 | |
| 50 | #ifdef PANORAMIX |
| 51 | #include "panoramiXsrv.h" |
| 52 | #endif |
| 53 | |
| 54 | /* |
| 55 | * GetReqVendorPrivate - this is the equivalent of GetReq macro |
| 56 | * from Xlibint.h but it does not set the reqType field (the opcode). |
| 57 | * this is because the GL single opcodes has different naming convension |
| 58 | * the other X opcodes (ie. X_GLsop_GetFloatv). |
| 59 | */ |
| 60 | #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) |
| 61 | #define GetReqVendorPrivate(name, req) \ |
| 62 | WORD64ALIGN\ |
| 63 | if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ |
| 64 | _XFlush(dpy);\ |
| 65 | req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ |
| 66 | req->length = (SIZEOF(x##name##Req))>>2;\ |
| 67 | dpy->bufptr += SIZEOF(x##name##Req);\ |
| 68 | dpy->request++ |
| 69 | |
| 70 | #else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ |
| 71 | #define GetReqVendorPrivate(name, req) \ |
| 72 | WORD64ALIGN\ |
| 73 | if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ |
| 74 | _XFlush(dpy);\ |
| 75 | req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ |
| 76 | req->length = (SIZEOF(x/**/name/**/Req))>>2;\ |
| 77 | dpy->bufptr += SIZEOF(x/**/name/**/Req);\ |
| 78 | dpy->request++ |
| 79 | #endif |
| 80 | |
| 81 | extern Display *GetBackEndDisplay(__GLXclientState * cl, int s); |
| 82 | extern int GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag, |
| 83 | int s); |
| 84 | |
| 85 | static int swap_vec_element_size = 0; |
| 86 | |
| 87 | static void |
| 88 | SendSwappedReply(ClientPtr client, |
| 89 | xGLXVendorPrivReply * reply, char *buf, int buf_size) |
| 90 | { |
| 91 | __GLX_DECLARE_SWAP_VARIABLES; |
| 92 | __GLX_SWAP_SHORT(&reply->sequenceNumber); |
| 93 | __GLX_SWAP_INT(&reply->length); |
| 94 | __GLX_SWAP_INT(&reply->retval); |
| 95 | __GLX_SWAP_INT(&reply->size); |
| 96 | |
| 97 | if ((buf_size == 0) && (swap_vec_element_size > 0)) { |
| 98 | /* |
| 99 | * the reply has single component - need to swap pad3 |
| 100 | */ |
| 101 | if (swap_vec_element_size == 2) { |
| 102 | __GLX_SWAP_SHORT(&reply->pad3); |
| 103 | } |
| 104 | else if (swap_vec_element_size == 4) { |
| 105 | __GLX_SWAP_INT(&reply->pad3); |
| 106 | __GLX_SWAP_INT(&reply->pad4); |
| 107 | } |
| 108 | else if (swap_vec_element_size == 8) { |
| 109 | __GLX_SWAP_DOUBLE(&reply->pad3); |
| 110 | } |
| 111 | } |
| 112 | else if ((buf_size > 0) && (swap_vec_element_size > 0)) { |
| 113 | /* |
| 114 | * the reply has vector of elements which needs to be swapped |
| 115 | */ |
| 116 | int vsize = buf_size / swap_vec_element_size; |
| 117 | char *p = buf; |
| 118 | int i; |
| 119 | |
| 120 | for (i = 0; i < vsize; i++) { |
| 121 | if (swap_vec_element_size == 2) { |
| 122 | __GLX_SWAP_SHORT(p); |
| 123 | } |
| 124 | else if (swap_vec_element_size == 4) { |
| 125 | __GLX_SWAP_INT(p); |
| 126 | } |
| 127 | else if (swap_vec_element_size == 8) { |
| 128 | __GLX_SWAP_DOUBLE(p); |
| 129 | } |
| 130 | |
| 131 | p += swap_vec_element_size; |
| 132 | } |
| 133 | |
| 134 | __GLX_SWAP_INT(&reply->pad3); |
| 135 | __GLX_SWAP_INT(&reply->pad4); |
| 136 | __GLX_SWAP_INT(&reply->pad5); |
| 137 | __GLX_SWAP_INT(&reply->pad6); |
| 138 | |
| 139 | } |
| 140 | |
| 141 | WriteToClient(client, sizeof(xGLXVendorPrivReply), reply); |
| 142 | if (buf_size > 0) |
| 143 | WriteToClient(client, buf_size, buf); |
| 144 | |
| 145 | } |
| 146 | |
| 147 | int |
| 148 | __glXVForwardSingleReq(__GLXclientState * cl, GLbyte * pc) |
| 149 | { |
| 150 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 151 | xGLXVendorPrivateReq *be_req; |
| 152 | __GLXcontext *glxc; |
| 153 | int from_screen = 0; |
| 154 | int to_screen = 0; |
| 155 | int buf_size; |
| 156 | int s; |
| 157 | |
| 158 | glxc = __glXLookupContextByTag(cl, req->contextTag); |
| 159 | if (!glxc) { |
| 160 | return 0; |
| 161 | } |
| 162 | from_screen = to_screen = glxc->pScreen->myNum; |
| 163 | |
| 164 | #ifdef PANORAMIX |
| 165 | if (!noPanoramiXExtension) { |
| 166 | from_screen = 0; |
| 167 | to_screen = screenInfo.numScreens - 1; |
| 168 | } |
| 169 | #endif |
| 170 | |
| 171 | pc += sz_xGLXVendorPrivateReq; |
| 172 | buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq; |
| 173 | |
| 174 | /* |
| 175 | * just forward the request to back-end server(s) |
| 176 | */ |
| 177 | for (s = from_screen; s <= to_screen; s++) { |
| 178 | DMXScreenInfo *dmxScreen = &dmxScreens[s]; |
| 179 | Display *dpy = GetBackEndDisplay(cl, s); |
| 180 | |
| 181 | LockDisplay(dpy); |
| 182 | GetReqVendorPrivate(GLXVendorPrivate, be_req); |
| 183 | be_req->reqType = dmxScreen->glxMajorOpcode; |
| 184 | be_req->glxCode = req->glxCode; |
| 185 | be_req->length = req->length; |
| 186 | be_req->vendorCode = req->vendorCode; |
| 187 | be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s); |
| 188 | if (buf_size > 0) |
| 189 | _XSend(dpy, (const char *) pc, buf_size); |
| 190 | UnlockDisplay(dpy); |
| 191 | SyncHandle(); |
| 192 | } |
| 193 | |
| 194 | return Success; |
| 195 | } |
| 196 | |
| 197 | int |
| 198 | __glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc) |
| 199 | { |
| 200 | ClientPtr client = cl->client; |
| 201 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 202 | xGLXVendorPrivateReq *be_req; |
| 203 | xGLXVendorPrivReply reply; |
| 204 | xGLXVendorPrivReply be_reply; |
| 205 | __GLXcontext *glxc; |
| 206 | int buf_size; |
| 207 | char *be_buf = NULL; |
| 208 | int be_buf_size; |
| 209 | DMXScreenInfo *dmxScreen; |
| 210 | Display *dpy; |
| 211 | |
| 212 | glxc = __glXLookupContextByTag(cl, req->contextTag); |
| 213 | if (!glxc) { |
| 214 | return __glXBadContext; |
| 215 | } |
| 216 | |
| 217 | pc += sz_xGLXVendorPrivateReq; |
| 218 | buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq; |
| 219 | |
| 220 | dmxScreen = &dmxScreens[glxc->pScreen->myNum]; |
| 221 | dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum); |
| 222 | |
| 223 | /* |
| 224 | * send the request to the first back-end server |
| 225 | */ |
| 226 | LockDisplay(dpy); |
| 227 | GetReqVendorPrivate(GLXVendorPrivate, be_req); |
| 228 | be_req->reqType = dmxScreen->glxMajorOpcode; |
| 229 | be_req->glxCode = req->glxCode; |
| 230 | be_req->length = req->length; |
| 231 | be_req->vendorCode = req->vendorCode; |
| 232 | be_req->contextTag = |
| 233 | GetCurrentBackEndTag(cl, req->contextTag, glxc->pScreen->myNum); |
| 234 | if (buf_size > 0) |
| 235 | _XSend(dpy, (const char *) pc, buf_size); |
| 236 | |
| 237 | /* |
| 238 | * get the reply from the back-end server |
| 239 | */ |
| 240 | _XReply(dpy, (xReply *) &be_reply, 0, False); |
| 241 | be_buf_size = be_reply.length << 2; |
| 242 | if (be_buf_size > 0) { |
| 243 | be_buf = (char *) malloc(be_buf_size); |
| 244 | if (be_buf) { |
| 245 | _XRead(dpy, be_buf, be_buf_size); |
| 246 | } |
| 247 | else { |
| 248 | /* Throw data on the floor */ |
| 249 | _XEatDataWords(dpy, be_reply.length); |
| 250 | return BadAlloc; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | UnlockDisplay(dpy); |
| 255 | SyncHandle(); |
| 256 | |
| 257 | /* |
| 258 | * send the reply to the client |
| 259 | */ |
| 260 | memcpy(&reply, &be_reply, sz_xGLXVendorPrivReply); |
| 261 | reply.type = X_Reply; |
| 262 | reply.sequenceNumber = client->sequence; |
| 263 | |
| 264 | if (client->swapped) { |
| 265 | SendSwappedReply(client, &reply, be_buf, be_buf_size); |
| 266 | } |
| 267 | else { |
| 268 | WriteToClient(client, sizeof(xGLXVendorPrivReply), &reply); |
| 269 | if (be_buf_size > 0) |
| 270 | WriteToClient(client, be_buf_size, be_buf); |
| 271 | } |
| 272 | |
| 273 | if (be_buf_size > 0) |
| 274 | free(be_buf); |
| 275 | |
| 276 | return Success; |
| 277 | } |
| 278 | |
| 279 | int |
| 280 | __glXVForwardAllWithReply(__GLXclientState * cl, GLbyte * pc) |
| 281 | { |
| 282 | ClientPtr client = cl->client; |
| 283 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 284 | xGLXVendorPrivateReq *be_req; |
| 285 | xGLXVendorPrivReply reply; |
| 286 | xGLXVendorPrivReply be_reply; |
| 287 | __GLXcontext *glxc; |
| 288 | int buf_size; |
| 289 | char *be_buf = NULL; |
| 290 | int be_buf_size = 0; |
| 291 | int from_screen = 0; |
| 292 | int to_screen = 0; |
| 293 | int s; |
| 294 | |
| 295 | DMXScreenInfo *dmxScreen; |
| 296 | Display *dpy; |
| 297 | |
| 298 | glxc = __glXLookupContextByTag(cl, req->contextTag); |
| 299 | if (!glxc) { |
| 300 | return 0; |
| 301 | } |
| 302 | from_screen = to_screen = glxc->pScreen->myNum; |
| 303 | |
| 304 | #ifdef PANORAMIX |
| 305 | if (!noPanoramiXExtension) { |
| 306 | from_screen = 0; |
| 307 | to_screen = screenInfo.numScreens - 1; |
| 308 | } |
| 309 | #endif |
| 310 | |
| 311 | pc += sz_xGLXVendorPrivateReq; |
| 312 | buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq; |
| 313 | |
| 314 | /* |
| 315 | * send the request to the first back-end server(s) |
| 316 | */ |
| 317 | for (s = to_screen; s >= from_screen; s--) { |
| 318 | dmxScreen = &dmxScreens[s]; |
| 319 | dpy = GetBackEndDisplay(cl, s); |
| 320 | |
| 321 | LockDisplay(dpy); |
| 322 | GetReqVendorPrivate(GLXVendorPrivate, be_req); |
| 323 | be_req->reqType = dmxScreen->glxMajorOpcode; |
| 324 | be_req->glxCode = req->glxCode; |
| 325 | be_req->length = req->length; |
| 326 | be_req->vendorCode = req->vendorCode; |
| 327 | be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s); |
| 328 | if (buf_size > 0) |
| 329 | _XSend(dpy, (const char *) pc, buf_size); |
| 330 | |
| 331 | /* |
| 332 | * get the reply from the back-end server |
| 333 | */ |
| 334 | _XReply(dpy, (xReply *) &be_reply, 0, False); |
| 335 | if (s == from_screen) { |
| 336 | /* Save data from last reply to send on to client */ |
| 337 | be_buf_size = be_reply.length << 2; |
| 338 | if (be_buf_size > 0) { |
| 339 | be_buf = malloc(be_buf_size); |
| 340 | if (be_buf) { |
| 341 | _XRead(dpy, be_buf, be_buf_size); |
| 342 | } |
| 343 | else { |
| 344 | /* Throw data on the floor */ |
| 345 | _XEatDataWords(dpy, be_reply.length); |
| 346 | return BadAlloc; |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | else { |
| 351 | /* Just discard data from all replies before the last one */ |
| 352 | if (be_reply.length > 0) |
| 353 | _XEatDataWords(dpy, be_reply.length); |
| 354 | } |
| 355 | |
| 356 | UnlockDisplay(dpy); |
| 357 | SyncHandle(); |
| 358 | } |
| 359 | |
| 360 | /* |
| 361 | * send the reply to the client |
| 362 | */ |
| 363 | memcpy(&reply, &be_reply, sz_xGLXVendorPrivReply); |
| 364 | reply.type = X_Reply; |
| 365 | reply.sequenceNumber = client->sequence; |
| 366 | |
| 367 | if (client->swapped) { |
| 368 | SendSwappedReply(client, &reply, be_buf, be_buf_size); |
| 369 | } |
| 370 | else { |
| 371 | WriteToClient(client, sizeof(xGLXVendorPrivReply), &reply); |
| 372 | if (be_buf_size > 0) |
| 373 | WriteToClient(client, be_buf_size, be_buf); |
| 374 | } |
| 375 | |
| 376 | if (be_buf_size > 0) |
| 377 | free(be_buf); |
| 378 | |
| 379 | return Success; |
| 380 | } |
| 381 | |
| 382 | int |
| 383 | __glXVForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc) |
| 384 | { |
| 385 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 386 | |
| 387 | __GLX_DECLARE_SWAP_VARIABLES; |
| 388 | |
| 389 | __GLX_SWAP_SHORT(&req->length); |
| 390 | __GLX_SWAP_INT(&req->vendorCode); |
| 391 | __GLX_SWAP_INT(&req->contextTag); |
| 392 | |
| 393 | swap_vec_element_size = 0; |
| 394 | |
| 395 | return (__glXVForwardSingleReq(cl, pc)); |
| 396 | } |
| 397 | |
| 398 | int |
| 399 | __glXVForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc) |
| 400 | { |
| 401 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 402 | |
| 403 | __GLX_DECLARE_SWAP_VARIABLES; |
| 404 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 405 | |
| 406 | __GLX_SWAP_SHORT(&req->length); |
| 407 | __GLX_SWAP_INT(&req->vendorCode); |
| 408 | __GLX_SWAP_INT(&req->contextTag); |
| 409 | |
| 410 | swap_vec_element_size = 0; |
| 411 | |
| 412 | /* |
| 413 | * swap extra data in request - assuming all data |
| 414 | * (if available) are arrays of 4 bytes components ! |
| 415 | */ |
| 416 | if (req->length > sz_xGLXVendorPrivateReq / 4) { |
| 417 | int *data = (int *) (req + 1); |
| 418 | int count = req->length - sz_xGLXVendorPrivateReq / 4; |
| 419 | |
| 420 | __GLX_SWAP_INT_ARRAY(data, count); |
| 421 | } |
| 422 | |
| 423 | return (__glXVForwardPipe0WithReply(cl, pc)); |
| 424 | } |
| 425 | |
| 426 | int |
| 427 | __glXVForwardPipe0WithReplySwapsv(__GLXclientState * cl, GLbyte * pc) |
| 428 | { |
| 429 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 430 | |
| 431 | __GLX_DECLARE_SWAP_VARIABLES; |
| 432 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 433 | |
| 434 | __GLX_SWAP_SHORT(&req->length); |
| 435 | __GLX_SWAP_INT(&req->vendorCode); |
| 436 | __GLX_SWAP_INT(&req->contextTag); |
| 437 | |
| 438 | swap_vec_element_size = 2; |
| 439 | |
| 440 | /* |
| 441 | * swap extra data in request - assuming all data |
| 442 | * (if available) are arrays of 4 bytes components ! |
| 443 | */ |
| 444 | if (req->length > sz_xGLXVendorPrivateReq / 4) { |
| 445 | int *data = (int *) (req + 1); |
| 446 | int count = req->length - sz_xGLXVendorPrivateReq / 4; |
| 447 | |
| 448 | __GLX_SWAP_INT_ARRAY(data, count); |
| 449 | } |
| 450 | |
| 451 | return (__glXVForwardPipe0WithReply(cl, pc)); |
| 452 | } |
| 453 | |
| 454 | int |
| 455 | __glXVForwardPipe0WithReplySwapiv(__GLXclientState * cl, GLbyte * pc) |
| 456 | { |
| 457 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 458 | |
| 459 | __GLX_DECLARE_SWAP_VARIABLES; |
| 460 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 461 | |
| 462 | __GLX_SWAP_SHORT(&req->length); |
| 463 | __GLX_SWAP_INT(&req->vendorCode); |
| 464 | __GLX_SWAP_INT(&req->contextTag); |
| 465 | |
| 466 | swap_vec_element_size = 4; |
| 467 | |
| 468 | /* |
| 469 | * swap extra data in request - assuming all data |
| 470 | * (if available) are arrays of 4 bytes components ! |
| 471 | */ |
| 472 | if (req->length > sz_xGLXVendorPrivateReq / 4) { |
| 473 | int *data = (int *) (req + 1); |
| 474 | int count = req->length - sz_xGLXVendorPrivateReq / 4; |
| 475 | |
| 476 | __GLX_SWAP_INT_ARRAY(data, count); |
| 477 | } |
| 478 | |
| 479 | return (__glXVForwardPipe0WithReply(cl, pc)); |
| 480 | } |
| 481 | |
| 482 | int |
| 483 | __glXVForwardPipe0WithReplySwapdv(__GLXclientState * cl, GLbyte * pc) |
| 484 | { |
| 485 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 486 | |
| 487 | __GLX_DECLARE_SWAP_VARIABLES; |
| 488 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 489 | |
| 490 | __GLX_SWAP_SHORT(&req->length); |
| 491 | __GLX_SWAP_INT(&req->vendorCode); |
| 492 | __GLX_SWAP_INT(&req->contextTag); |
| 493 | |
| 494 | swap_vec_element_size = 8; |
| 495 | |
| 496 | /* |
| 497 | * swap extra data in request - assuming all data |
| 498 | * (if available) are arrays of 4 bytes components ! |
| 499 | */ |
| 500 | if (req->length > sz_xGLXVendorPrivateReq / 4) { |
| 501 | int *data = (int *) (req + 1); |
| 502 | int count = req->length - sz_xGLXVendorPrivateReq / 4; |
| 503 | |
| 504 | __GLX_SWAP_INT_ARRAY(data, count); |
| 505 | } |
| 506 | |
| 507 | return (__glXVForwardPipe0WithReply(cl, pc)); |
| 508 | } |
| 509 | |
| 510 | int |
| 511 | __glXVForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc) |
| 512 | { |
| 513 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 514 | |
| 515 | __GLX_DECLARE_SWAP_VARIABLES; |
| 516 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 517 | |
| 518 | __GLX_SWAP_SHORT(&req->length); |
| 519 | __GLX_SWAP_INT(&req->vendorCode); |
| 520 | __GLX_SWAP_INT(&req->contextTag); |
| 521 | |
| 522 | swap_vec_element_size = 0; |
| 523 | |
| 524 | /* |
| 525 | * swap extra data in request - assuming all data |
| 526 | * (if available) are arrays of 4 bytes components ! |
| 527 | */ |
| 528 | if (req->length > sz_xGLXVendorPrivateReq / 4) { |
| 529 | int *data = (int *) (req + 1); |
| 530 | int count = req->length - sz_xGLXVendorPrivateReq / 4; |
| 531 | |
| 532 | __GLX_SWAP_INT_ARRAY(data, count); |
| 533 | } |
| 534 | |
| 535 | return (__glXVForwardAllWithReply(cl, pc)); |
| 536 | } |
| 537 | |
| 538 | int |
| 539 | __glXVForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc) |
| 540 | { |
| 541 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 542 | |
| 543 | __GLX_DECLARE_SWAP_VARIABLES; |
| 544 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 545 | |
| 546 | __GLX_SWAP_SHORT(&req->length); |
| 547 | __GLX_SWAP_INT(&req->vendorCode); |
| 548 | __GLX_SWAP_INT(&req->contextTag); |
| 549 | |
| 550 | swap_vec_element_size = 2; |
| 551 | |
| 552 | /* |
| 553 | * swap extra data in request - assuming all data |
| 554 | * (if available) are arrays of 4 bytes components ! |
| 555 | */ |
| 556 | if (req->length > sz_xGLXVendorPrivateReq / 4) { |
| 557 | int *data = (int *) (req + 1); |
| 558 | int count = req->length - sz_xGLXVendorPrivateReq / 4; |
| 559 | |
| 560 | __GLX_SWAP_INT_ARRAY(data, count); |
| 561 | } |
| 562 | |
| 563 | return (__glXVForwardAllWithReply(cl, pc)); |
| 564 | } |
| 565 | |
| 566 | int |
| 567 | __glXVForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc) |
| 568 | { |
| 569 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 570 | |
| 571 | __GLX_DECLARE_SWAP_VARIABLES; |
| 572 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 573 | |
| 574 | __GLX_SWAP_SHORT(&req->length); |
| 575 | __GLX_SWAP_INT(&req->vendorCode); |
| 576 | __GLX_SWAP_INT(&req->contextTag); |
| 577 | |
| 578 | swap_vec_element_size = 4; |
| 579 | |
| 580 | /* |
| 581 | * swap extra data in request - assuming all data |
| 582 | * (if available) are arrays of 4 bytes components ! |
| 583 | */ |
| 584 | if (req->length > sz_xGLXVendorPrivateReq / 4) { |
| 585 | int *data = (int *) (req + 1); |
| 586 | int count = req->length - sz_xGLXVendorPrivateReq / 4; |
| 587 | |
| 588 | __GLX_SWAP_INT_ARRAY(data, count); |
| 589 | } |
| 590 | |
| 591 | return (__glXVForwardAllWithReply(cl, pc)); |
| 592 | } |
| 593 | |
| 594 | int |
| 595 | __glXVForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc) |
| 596 | { |
| 597 | xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; |
| 598 | |
| 599 | __GLX_DECLARE_SWAP_VARIABLES; |
| 600 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 601 | |
| 602 | __GLX_SWAP_SHORT(&req->length); |
| 603 | __GLX_SWAP_INT(&req->vendorCode); |
| 604 | __GLX_SWAP_INT(&req->contextTag); |
| 605 | |
| 606 | swap_vec_element_size = 8; |
| 607 | |
| 608 | /* |
| 609 | * swap extra data in request - assuming all data |
| 610 | * (if available) are arrays of 4 bytes components ! |
| 611 | */ |
| 612 | if (req->length > sz_xGLXVendorPrivateReq / 4) { |
| 613 | int *data = (int *) (req + 1); |
| 614 | int count = req->length - sz_xGLXVendorPrivateReq / 4; |
| 615 | |
| 616 | __GLX_SWAP_INT_ARRAY(data, count); |
| 617 | } |
| 618 | |
| 619 | return (__glXVForwardAllWithReply(cl, pc)); |
| 620 | } |