1
/* $XFree86: xc/programs/Xserver/GL/glx/renderpixswap.c,v 1.5 2001/03/21 16:29:37 dawes Exp $ */
3
** License Applicability. Except to the extent portions of this file are
4
** made subject to an alternative license as permitted in the SGI Free
5
** Software License B, Version 1.1 (the "License"), the contents of this
6
** file are subject only to the provisions of the License. You may not use
7
** this file except in compliance with the License. You may obtain a copy
8
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
9
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
11
** http://oss.sgi.com/projects/FreeB
13
** Note that, as provided in the License, the Software is distributed on an
14
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
15
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
16
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
17
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
19
** Original Code. The Original Code is: OpenGL Sample Implementation,
20
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
21
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
22
** Copyright in any portions created by third parties is as indicated
23
** elsewhere herein. All Rights Reserved.
25
** Additional Notice Provisions: The application programming interfaces
26
** established by SGI in conjunction with the Original Code are The
27
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
28
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
29
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
30
** Window System(R) (Version 1.3), released October 19, 1998. This software
31
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
32
** published by SGI, but has not been independently verified as being
33
** compliant with the OpenGL(R) version 1.2.1 Specification.
38
#include "glxserver.h"
40
#include "g_disptab.h"
42
void __glXDispSwap_PolygonStipple(GLbyte *pc)
44
__GLXpixelHeader *hdr = (__GLXpixelHeader *) pc;
45
__GLX_DECLARE_SWAP_VARIABLES;
47
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
48
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
49
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
50
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
52
hdr->swapBytes = !hdr->swapBytes;
55
void __glXDispSwap_Bitmap(GLbyte *pc)
57
__GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
58
__GLX_DECLARE_SWAP_VARIABLES;
60
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
61
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
62
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
63
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
65
__GLX_SWAP_INT((GLbyte *)&hdr->width);
66
__GLX_SWAP_INT((GLbyte *)&hdr->height);
67
__GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig);
68
__GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig);
69
__GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove);
70
__GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove);
72
hdr->swapBytes = !hdr->swapBytes;
76
void __glXDispSwap_TexImage1D(GLbyte *pc)
78
__GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
79
__GLX_DECLARE_SWAP_VARIABLES;
81
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
82
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
83
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
84
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
86
__GLX_SWAP_INT((GLbyte *)&hdr->target);
87
__GLX_SWAP_INT((GLbyte *)&hdr->level);
88
__GLX_SWAP_INT((GLbyte *)&hdr->components);
89
__GLX_SWAP_INT((GLbyte *)&hdr->width);
90
__GLX_SWAP_INT((GLbyte *)&hdr->height);
91
__GLX_SWAP_INT((GLbyte *)&hdr->border);
92
__GLX_SWAP_INT((GLbyte *)&hdr->format);
93
__GLX_SWAP_INT((GLbyte *)&hdr->type);
96
** Just invert swapBytes flag; the GL will figure out if it needs to swap
99
hdr->swapBytes = !hdr->swapBytes;
102
void __glXDispSwap_TexImage2D(GLbyte *pc)
104
__GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
105
__GLX_DECLARE_SWAP_VARIABLES;
107
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
108
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
109
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
110
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
112
__GLX_SWAP_INT((GLbyte *)&hdr->target);
113
__GLX_SWAP_INT((GLbyte *)&hdr->level);
114
__GLX_SWAP_INT((GLbyte *)&hdr->components);
115
__GLX_SWAP_INT((GLbyte *)&hdr->width);
116
__GLX_SWAP_INT((GLbyte *)&hdr->height);
117
__GLX_SWAP_INT((GLbyte *)&hdr->border);
118
__GLX_SWAP_INT((GLbyte *)&hdr->format);
119
__GLX_SWAP_INT((GLbyte *)&hdr->type);
122
** Just invert swapBytes flag; the GL will figure out if it needs to swap
125
hdr->swapBytes = !hdr->swapBytes;
128
void __glXDispSwap_TexImage3D(GLbyte *pc)
130
__GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc;
131
__GLX_DECLARE_SWAP_VARIABLES;
133
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
134
__GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
135
__GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
136
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
137
__GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
138
__GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
139
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
140
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
142
__GLX_SWAP_INT((GLbyte *)&hdr->target);
143
__GLX_SWAP_INT((GLbyte *)&hdr->level);
144
__GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
145
__GLX_SWAP_INT((GLbyte *)&hdr->width);
146
__GLX_SWAP_INT((GLbyte *)&hdr->height);
147
__GLX_SWAP_INT((GLbyte *)&hdr->depth);
148
__GLX_SWAP_INT((GLbyte *)&hdr->size4d);
149
__GLX_SWAP_INT((GLbyte *)&hdr->border);
150
__GLX_SWAP_INT((GLbyte *)&hdr->format);
151
__GLX_SWAP_INT((GLbyte *)&hdr->type);
154
** Just invert swapBytes flag; the GL will figure out if it needs to swap
157
hdr->swapBytes = !hdr->swapBytes;
160
void __glXDispSwap_DrawPixels(GLbyte *pc)
162
__GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
163
__GLX_DECLARE_SWAP_VARIABLES;
165
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
166
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
167
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
168
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
170
__GLX_SWAP_INT((GLbyte *)&hdr->width);
171
__GLX_SWAP_INT((GLbyte *)&hdr->height);
172
__GLX_SWAP_INT((GLbyte *)&hdr->format);
173
__GLX_SWAP_INT((GLbyte *)&hdr->type);
176
** Just invert swapBytes flag; the GL will figure out if it needs to swap
179
hdr->swapBytes = !hdr->swapBytes;
182
void __glXDispSwap_TexSubImage1D(GLbyte *pc)
184
__GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
185
__GLX_DECLARE_SWAP_VARIABLES;
187
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
188
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
189
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
190
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
192
__GLX_SWAP_INT((GLbyte *)&hdr->target);
193
__GLX_SWAP_INT((GLbyte *)&hdr->level);
194
__GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
195
__GLX_SWAP_INT((GLbyte *)&hdr->width);
196
__GLX_SWAP_INT((GLbyte *)&hdr->format);
197
__GLX_SWAP_INT((GLbyte *)&hdr->type);
200
** Just invert swapBytes flag; the GL will figure out if it needs to swap
203
hdr->swapBytes = !hdr->swapBytes;
206
void __glXDispSwap_TexSubImage2D(GLbyte *pc)
208
__GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
209
__GLX_DECLARE_SWAP_VARIABLES;
211
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
212
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
213
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
214
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
216
__GLX_SWAP_INT((GLbyte *)&hdr->target);
217
__GLX_SWAP_INT((GLbyte *)&hdr->level);
218
__GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
219
__GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
220
__GLX_SWAP_INT((GLbyte *)&hdr->width);
221
__GLX_SWAP_INT((GLbyte *)&hdr->height);
222
__GLX_SWAP_INT((GLbyte *)&hdr->format);
223
__GLX_SWAP_INT((GLbyte *)&hdr->type);
226
** Just invert swapBytes flag; the GL will figure out if it needs to swap
229
hdr->swapBytes = !hdr->swapBytes;
232
void __glXDispSwap_TexSubImage3D(GLbyte *pc)
234
__GLXdispatchTexSubImage3DHeader *hdr =
235
(__GLXdispatchTexSubImage3DHeader *) pc;
237
__GLX_DECLARE_SWAP_VARIABLES;
239
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
240
__GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
241
__GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
242
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
243
__GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
244
__GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
245
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
246
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
248
__GLX_SWAP_INT((GLbyte *)&hdr->target);
249
__GLX_SWAP_INT((GLbyte *)&hdr->level);
250
__GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
251
__GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
252
__GLX_SWAP_INT((GLbyte *)&hdr->zoffset);
253
__GLX_SWAP_INT((GLbyte *)&hdr->width);
254
__GLX_SWAP_INT((GLbyte *)&hdr->height);
255
__GLX_SWAP_INT((GLbyte *)&hdr->depth);
256
__GLX_SWAP_INT((GLbyte *)&hdr->size4d);
257
__GLX_SWAP_INT((GLbyte *)&hdr->format);
258
__GLX_SWAP_INT((GLbyte *)&hdr->type);
261
** Just invert swapBytes flag; the GL will figure out if it needs to swap
264
hdr->swapBytes = !hdr->swapBytes;
267
void __glXDispSwap_ColorTable(GLbyte *pc)
269
__GLXdispatchColorTableHeader *hdr =
270
(__GLXdispatchColorTableHeader *) pc;
271
__GLX_DECLARE_SWAP_VARIABLES;
273
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
274
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
275
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
276
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
278
__GLX_SWAP_INT((GLbyte *)&hdr->target);
279
__GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
280
__GLX_SWAP_INT((GLbyte *)&hdr->width);
281
__GLX_SWAP_INT((GLbyte *)&hdr->format);
282
__GLX_SWAP_INT((GLbyte *)&hdr->type);
285
** Just invert swapBytes flag; the GL will figure out if it needs to swap
288
hdr->swapBytes = !hdr->swapBytes;
291
void __glXDispSwap_ColorSubTable(GLbyte *pc)
293
__GLXdispatchColorSubTableHeader *hdr =
294
(__GLXdispatchColorSubTableHeader *) pc;
295
__GLX_DECLARE_SWAP_VARIABLES;
297
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
298
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
299
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
300
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
302
__GLX_SWAP_INT((GLbyte *)&hdr->target);
303
__GLX_SWAP_INT((GLbyte *)&hdr->start);
304
__GLX_SWAP_INT((GLbyte *)&hdr->count);
305
__GLX_SWAP_INT((GLbyte *)&hdr->format);
306
__GLX_SWAP_INT((GLbyte *)&hdr->type);
309
** Just invert swapBytes flag; the GL will figure out if it needs to swap
312
hdr->swapBytes = !hdr->swapBytes;
315
void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc)
317
__GLXdispatchConvolutionFilterHeader *hdr =
318
(__GLXdispatchConvolutionFilterHeader *) pc;
319
__GLX_DECLARE_SWAP_VARIABLES;
321
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
322
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
323
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
324
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
326
__GLX_SWAP_INT((GLbyte *)&hdr->target);
327
__GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
328
__GLX_SWAP_INT((GLbyte *)&hdr->width);
329
__GLX_SWAP_INT((GLbyte *)&hdr->format);
330
__GLX_SWAP_INT((GLbyte *)&hdr->type);
333
** Just invert swapBytes flag; the GL will figure out if it needs to swap
336
hdr->swapBytes = !hdr->swapBytes;
339
void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc)
341
__GLXdispatchConvolutionFilterHeader *hdr =
342
(__GLXdispatchConvolutionFilterHeader *) pc;
343
__GLX_DECLARE_SWAP_VARIABLES;
345
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
346
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
347
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
348
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
350
__GLX_SWAP_INT((GLbyte *)&hdr->target);
351
__GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
352
__GLX_SWAP_INT((GLbyte *)&hdr->width);
353
__GLX_SWAP_INT((GLbyte *)&hdr->height);
354
__GLX_SWAP_INT((GLbyte *)&hdr->format);
355
__GLX_SWAP_INT((GLbyte *)&hdr->type);
358
** Just invert swapBytes flag; the GL will figure out if it needs to swap
361
hdr->swapBytes = !hdr->swapBytes;
364
void __glXDispSwap_SeparableFilter2D(GLbyte *pc)
366
__GLXdispatchConvolutionFilterHeader *hdr =
367
(__GLXdispatchConvolutionFilterHeader *) pc;
368
GLint hdrlen, image1len;
369
__GLX_DECLARE_SWAP_VARIABLES;
371
hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
373
__GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
374
__GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
375
__GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
376
__GLX_SWAP_INT((GLbyte *)&hdr->alignment);
378
__GLX_SWAP_INT((GLbyte *)&hdr->target);
379
__GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
380
__GLX_SWAP_INT((GLbyte *)&hdr->width);
381
__GLX_SWAP_INT((GLbyte *)&hdr->height);
382
__GLX_SWAP_INT((GLbyte *)&hdr->format);
383
__GLX_SWAP_INT((GLbyte *)&hdr->type);
386
** Just invert swapBytes flag; the GL will figure out if it needs to swap
389
hdr->swapBytes = !hdr->swapBytes;