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 "unpack.h" 33#include "g_disptab.h" 34 35void __glXDispSwap_PolygonStipple(GLbyte *pc) 36{ 37 __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc; 38 __GLX_DECLARE_SWAP_VARIABLES; 39 40 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 41 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 42 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 43 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 44 45 hdr->swapBytes = !hdr->swapBytes; 46} 47 48void __glXDispSwap_Bitmap(GLbyte *pc) 49{ 50 __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc; 51 __GLX_DECLARE_SWAP_VARIABLES; 52 53 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 54 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 55 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 56 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 57 58 __GLX_SWAP_INT((GLbyte *)&hdr->width); 59 __GLX_SWAP_INT((GLbyte *)&hdr->height); 60 __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig); 61 __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig); 62 __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove); 63 __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove); 64 65 hdr->swapBytes = !hdr->swapBytes; 66 67} 68 69void __glXDispSwap_TexImage1D(GLbyte *pc) 70{ 71 __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; 72 __GLX_DECLARE_SWAP_VARIABLES; 73 74 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 75 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 76 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 77 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 78 79 __GLX_SWAP_INT((GLbyte *)&hdr->target); 80 __GLX_SWAP_INT((GLbyte *)&hdr->level); 81 __GLX_SWAP_INT((GLbyte *)&hdr->components); 82 __GLX_SWAP_INT((GLbyte *)&hdr->width); 83 __GLX_SWAP_INT((GLbyte *)&hdr->height); 84 __GLX_SWAP_INT((GLbyte *)&hdr->border); 85 __GLX_SWAP_INT((GLbyte *)&hdr->format); 86 __GLX_SWAP_INT((GLbyte *)&hdr->type); 87 88 /* 89 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 90 ** the pixel data. 91 */ 92 hdr->swapBytes = !hdr->swapBytes; 93} 94 95void __glXDispSwap_TexImage2D(GLbyte *pc) 96{ 97 __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; 98 __GLX_DECLARE_SWAP_VARIABLES; 99 100 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 101 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 102 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 103 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 104 105 __GLX_SWAP_INT((GLbyte *)&hdr->target); 106 __GLX_SWAP_INT((GLbyte *)&hdr->level); 107 __GLX_SWAP_INT((GLbyte *)&hdr->components); 108 __GLX_SWAP_INT((GLbyte *)&hdr->width); 109 __GLX_SWAP_INT((GLbyte *)&hdr->height); 110 __GLX_SWAP_INT((GLbyte *)&hdr->border); 111 __GLX_SWAP_INT((GLbyte *)&hdr->format); 112 __GLX_SWAP_INT((GLbyte *)&hdr->type); 113 114 /* 115 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 116 ** the pixel data. 117 */ 118 hdr->swapBytes = !hdr->swapBytes; 119} 120 121void __glXDispSwap_TexImage3D(GLbyte *pc) 122{ 123 __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; 124 __GLX_DECLARE_SWAP_VARIABLES; 125 126 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 127 __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); 128 __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); 129 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 130 __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); 131 __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); 132 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 133 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 134 135 __GLX_SWAP_INT((GLbyte *)&hdr->target); 136 __GLX_SWAP_INT((GLbyte *)&hdr->level); 137 __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); 138 __GLX_SWAP_INT((GLbyte *)&hdr->width); 139 __GLX_SWAP_INT((GLbyte *)&hdr->height); 140 __GLX_SWAP_INT((GLbyte *)&hdr->depth); 141 __GLX_SWAP_INT((GLbyte *)&hdr->size4d); 142 __GLX_SWAP_INT((GLbyte *)&hdr->border); 143 __GLX_SWAP_INT((GLbyte *)&hdr->format); 144 __GLX_SWAP_INT((GLbyte *)&hdr->type); 145 146 /* 147 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 148 ** the pixel data. 149 */ 150 hdr->swapBytes = !hdr->swapBytes; 151} 152 153void __glXDispSwap_DrawPixels(GLbyte *pc) 154{ 155 __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; 156 __GLX_DECLARE_SWAP_VARIABLES; 157 158 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 159 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 160 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 161 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 162 163 __GLX_SWAP_INT((GLbyte *)&hdr->width); 164 __GLX_SWAP_INT((GLbyte *)&hdr->height); 165 __GLX_SWAP_INT((GLbyte *)&hdr->format); 166 __GLX_SWAP_INT((GLbyte *)&hdr->type); 167 168 /* 169 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 170 ** the pixel data. 171 */ 172 hdr->swapBytes = !hdr->swapBytes; 173} 174 175void __glXDispSwap_TexSubImage1D(GLbyte *pc) 176{ 177 __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; 178 __GLX_DECLARE_SWAP_VARIABLES; 179 180 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 181 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 182 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 183 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 184 185 __GLX_SWAP_INT((GLbyte *)&hdr->target); 186 __GLX_SWAP_INT((GLbyte *)&hdr->level); 187 __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); 188 __GLX_SWAP_INT((GLbyte *)&hdr->width); 189 __GLX_SWAP_INT((GLbyte *)&hdr->format); 190 __GLX_SWAP_INT((GLbyte *)&hdr->type); 191 192 /* 193 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 194 ** the pixel data. 195 */ 196 hdr->swapBytes = !hdr->swapBytes; 197} 198 199void __glXDispSwap_TexSubImage2D(GLbyte *pc) 200{ 201 __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; 202 __GLX_DECLARE_SWAP_VARIABLES; 203 204 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 205 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 206 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 207 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 208 209 __GLX_SWAP_INT((GLbyte *)&hdr->target); 210 __GLX_SWAP_INT((GLbyte *)&hdr->level); 211 __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); 212 __GLX_SWAP_INT((GLbyte *)&hdr->yoffset); 213 __GLX_SWAP_INT((GLbyte *)&hdr->width); 214 __GLX_SWAP_INT((GLbyte *)&hdr->height); 215 __GLX_SWAP_INT((GLbyte *)&hdr->format); 216 __GLX_SWAP_INT((GLbyte *)&hdr->type); 217 218 /* 219 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 220 ** the pixel data. 221 */ 222 hdr->swapBytes = !hdr->swapBytes; 223} 224 225void __glXDispSwap_TexSubImage3D(GLbyte *pc) 226{ 227 __GLXdispatchTexSubImage3DHeader *hdr = 228 (__GLXdispatchTexSubImage3DHeader *) pc; 229 230 __GLX_DECLARE_SWAP_VARIABLES; 231 232 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 233 __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight); 234 __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth); 235 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 236 __GLX_SWAP_INT((GLbyte *)&hdr->skipImages); 237 __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes); 238 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 239 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 240 241 __GLX_SWAP_INT((GLbyte *)&hdr->target); 242 __GLX_SWAP_INT((GLbyte *)&hdr->level); 243 __GLX_SWAP_INT((GLbyte *)&hdr->xoffset); 244 __GLX_SWAP_INT((GLbyte *)&hdr->yoffset); 245 __GLX_SWAP_INT((GLbyte *)&hdr->zoffset); 246 __GLX_SWAP_INT((GLbyte *)&hdr->width); 247 __GLX_SWAP_INT((GLbyte *)&hdr->height); 248 __GLX_SWAP_INT((GLbyte *)&hdr->depth); 249 __GLX_SWAP_INT((GLbyte *)&hdr->size4d); 250 __GLX_SWAP_INT((GLbyte *)&hdr->format); 251 __GLX_SWAP_INT((GLbyte *)&hdr->type); 252 253 /* 254 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 255 ** the pixel data. 256 */ 257 hdr->swapBytes = !hdr->swapBytes; 258} 259 260void __glXDispSwap_ColorTable(GLbyte *pc) 261{ 262 __GLXdispatchColorTableHeader *hdr = 263 (__GLXdispatchColorTableHeader *) pc; 264 __GLX_DECLARE_SWAP_VARIABLES; 265 266 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 267 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 268 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 269 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 270 271 __GLX_SWAP_INT((GLbyte *)&hdr->target); 272 __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); 273 __GLX_SWAP_INT((GLbyte *)&hdr->width); 274 __GLX_SWAP_INT((GLbyte *)&hdr->format); 275 __GLX_SWAP_INT((GLbyte *)&hdr->type); 276 277 /* 278 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 279 ** the pixel data. 280 */ 281 hdr->swapBytes = !hdr->swapBytes; 282} 283 284void __glXDispSwap_ColorSubTable(GLbyte *pc) 285{ 286 __GLXdispatchColorSubTableHeader *hdr = 287 (__GLXdispatchColorSubTableHeader *) pc; 288 __GLX_DECLARE_SWAP_VARIABLES; 289 290 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 291 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 292 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 293 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 294 295 __GLX_SWAP_INT((GLbyte *)&hdr->target); 296 __GLX_SWAP_INT((GLbyte *)&hdr->start); 297 __GLX_SWAP_INT((GLbyte *)&hdr->count); 298 __GLX_SWAP_INT((GLbyte *)&hdr->format); 299 __GLX_SWAP_INT((GLbyte *)&hdr->type); 300 301 /* 302 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 303 ** the pixel data. 304 */ 305 hdr->swapBytes = !hdr->swapBytes; 306} 307 308void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc) 309{ 310 __GLXdispatchConvolutionFilterHeader *hdr = 311 (__GLXdispatchConvolutionFilterHeader *) pc; 312 __GLX_DECLARE_SWAP_VARIABLES; 313 314 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 315 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 316 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 317 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 318 319 __GLX_SWAP_INT((GLbyte *)&hdr->target); 320 __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); 321 __GLX_SWAP_INT((GLbyte *)&hdr->width); 322 __GLX_SWAP_INT((GLbyte *)&hdr->format); 323 __GLX_SWAP_INT((GLbyte *)&hdr->type); 324 325 /* 326 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 327 ** the pixel data. 328 */ 329 hdr->swapBytes = !hdr->swapBytes; 330} 331 332void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc) 333{ 334 __GLXdispatchConvolutionFilterHeader *hdr = 335 (__GLXdispatchConvolutionFilterHeader *) pc; 336 __GLX_DECLARE_SWAP_VARIABLES; 337 338 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 339 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 340 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 341 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 342 343 __GLX_SWAP_INT((GLbyte *)&hdr->target); 344 __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); 345 __GLX_SWAP_INT((GLbyte *)&hdr->width); 346 __GLX_SWAP_INT((GLbyte *)&hdr->height); 347 __GLX_SWAP_INT((GLbyte *)&hdr->format); 348 __GLX_SWAP_INT((GLbyte *)&hdr->type); 349 350 /* 351 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 352 ** the pixel data. 353 */ 354 hdr->swapBytes = !hdr->swapBytes; 355} 356 357void __glXDispSwap_SeparableFilter2D(GLbyte *pc) 358{ 359 __GLXdispatchConvolutionFilterHeader *hdr = 360 (__GLXdispatchConvolutionFilterHeader *) pc; 361 GLint hdrlen; 362 __GLX_DECLARE_SWAP_VARIABLES; 363 364 hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE); 365 366 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength); 367 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows); 368 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels); 369 __GLX_SWAP_INT((GLbyte *)&hdr->alignment); 370 371 __GLX_SWAP_INT((GLbyte *)&hdr->target); 372 __GLX_SWAP_INT((GLbyte *)&hdr->internalformat); 373 __GLX_SWAP_INT((GLbyte *)&hdr->width); 374 __GLX_SWAP_INT((GLbyte *)&hdr->height); 375 __GLX_SWAP_INT((GLbyte *)&hdr->format); 376 __GLX_SWAP_INT((GLbyte *)&hdr->type); 377 378 /* 379 ** Just invert swapBytes flag; the GL will figure out if it needs to swap 380 ** the pixel data. 381 */ 382 hdr->swapBytes = !hdr->swapBytes; 383} 384