First import
[xorg_rtime.git] / xorg-server-1.4 / hw / dmx / glxProxy / renderpixswap.c
blob881967ccff2ac00a20b37a45c189fe05c9482bfc
1 /*
2 ** License Applicability. Except to the extent portions of this file are
3 ** made subject to an alternative license as permitted in the SGI Free
4 ** Software License B, Version 1.1 (the "License"), the contents of this
5 ** file are subject only to the provisions of the License. You may not use
6 ** this file except in compliance with the License. You may obtain a copy
7 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
8 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
9 **
10 ** http://oss.sgi.com/projects/FreeB
11 **
12 ** Note that, as provided in the License, the Software is distributed on an
13 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
14 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
15 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
16 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
17 **
18 ** Original Code. The Original Code is: OpenGL Sample Implementation,
19 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
20 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
21 ** Copyright in any portions created by third parties is as indicated
22 ** elsewhere herein. All Rights Reserved.
23 **
24 ** Additional Notice Provisions: The application programming interfaces
25 ** established by SGI in conjunction with the Original Code are The
26 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
27 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
28 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
29 ** Window System(R) (Version 1.3), released October 19, 1998. This software
30 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
31 ** published by SGI, but has not been independently verified as being
32 ** compliant with the OpenGL(R) version 1.2.1 Specification.
36 #define NEED_REPLIES
37 #include "glxserver.h"
38 #include "unpack.h"
39 #include "g_disptab.h"
41 void __glXDispSwap_PolygonStipple(GLbyte *pc)
43 __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc;
44 __GLX_DECLARE_SWAP_VARIABLES;
46 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
47 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
48 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
49 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
51 hdr->swapBytes = !hdr->swapBytes;
54 void __glXDispSwap_Bitmap(GLbyte *pc)
56 __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
57 __GLX_DECLARE_SWAP_VARIABLES;
59 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
60 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
61 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
62 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
64 __GLX_SWAP_INT((GLbyte *)&hdr->width);
65 __GLX_SWAP_INT((GLbyte *)&hdr->height);
66 __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig);
67 __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig);
68 __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove);
69 __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove);
71 hdr->swapBytes = !hdr->swapBytes;
75 void __glXDispSwap_TexImage1D(GLbyte *pc)
77 __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
78 __GLX_DECLARE_SWAP_VARIABLES;
80 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
81 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
82 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
83 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
85 __GLX_SWAP_INT((GLbyte *)&hdr->target);
86 __GLX_SWAP_INT((GLbyte *)&hdr->level);
87 __GLX_SWAP_INT((GLbyte *)&hdr->components);
88 __GLX_SWAP_INT((GLbyte *)&hdr->width);
89 __GLX_SWAP_INT((GLbyte *)&hdr->height);
90 __GLX_SWAP_INT((GLbyte *)&hdr->border);
91 __GLX_SWAP_INT((GLbyte *)&hdr->format);
92 __GLX_SWAP_INT((GLbyte *)&hdr->type);
95 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
96 ** the pixel data.
98 hdr->swapBytes = !hdr->swapBytes;
101 void __glXDispSwap_TexImage2D(GLbyte *pc)
103 __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
104 __GLX_DECLARE_SWAP_VARIABLES;
106 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
107 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
108 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
109 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
111 __GLX_SWAP_INT((GLbyte *)&hdr->target);
112 __GLX_SWAP_INT((GLbyte *)&hdr->level);
113 __GLX_SWAP_INT((GLbyte *)&hdr->components);
114 __GLX_SWAP_INT((GLbyte *)&hdr->width);
115 __GLX_SWAP_INT((GLbyte *)&hdr->height);
116 __GLX_SWAP_INT((GLbyte *)&hdr->border);
117 __GLX_SWAP_INT((GLbyte *)&hdr->format);
118 __GLX_SWAP_INT((GLbyte *)&hdr->type);
121 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
122 ** the pixel data.
124 hdr->swapBytes = !hdr->swapBytes;
127 void __glXDispSwap_TexImage3D(GLbyte *pc)
129 __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc;
130 __GLX_DECLARE_SWAP_VARIABLES;
132 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
133 __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
134 __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
135 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
136 __GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
137 __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
138 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
139 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
141 __GLX_SWAP_INT((GLbyte *)&hdr->target);
142 __GLX_SWAP_INT((GLbyte *)&hdr->level);
143 __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
144 __GLX_SWAP_INT((GLbyte *)&hdr->width);
145 __GLX_SWAP_INT((GLbyte *)&hdr->height);
146 __GLX_SWAP_INT((GLbyte *)&hdr->depth);
147 __GLX_SWAP_INT((GLbyte *)&hdr->size4d);
148 __GLX_SWAP_INT((GLbyte *)&hdr->border);
149 __GLX_SWAP_INT((GLbyte *)&hdr->format);
150 __GLX_SWAP_INT((GLbyte *)&hdr->type);
153 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
154 ** the pixel data.
156 hdr->swapBytes = !hdr->swapBytes;
159 void __glXDispSwap_DrawPixels(GLbyte *pc)
161 __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
162 __GLX_DECLARE_SWAP_VARIABLES;
164 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
165 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
166 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
167 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
169 __GLX_SWAP_INT((GLbyte *)&hdr->width);
170 __GLX_SWAP_INT((GLbyte *)&hdr->height);
171 __GLX_SWAP_INT((GLbyte *)&hdr->format);
172 __GLX_SWAP_INT((GLbyte *)&hdr->type);
175 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
176 ** the pixel data.
178 hdr->swapBytes = !hdr->swapBytes;
181 void __glXDispSwap_TexSubImage1D(GLbyte *pc)
183 __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
184 __GLX_DECLARE_SWAP_VARIABLES;
186 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
187 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
188 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
189 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
191 __GLX_SWAP_INT((GLbyte *)&hdr->target);
192 __GLX_SWAP_INT((GLbyte *)&hdr->level);
193 __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
194 __GLX_SWAP_INT((GLbyte *)&hdr->width);
195 __GLX_SWAP_INT((GLbyte *)&hdr->format);
196 __GLX_SWAP_INT((GLbyte *)&hdr->type);
199 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
200 ** the pixel data.
202 hdr->swapBytes = !hdr->swapBytes;
205 void __glXDispSwap_TexSubImage2D(GLbyte *pc)
207 __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
208 __GLX_DECLARE_SWAP_VARIABLES;
210 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
211 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
212 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
213 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
215 __GLX_SWAP_INT((GLbyte *)&hdr->target);
216 __GLX_SWAP_INT((GLbyte *)&hdr->level);
217 __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
218 __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
219 __GLX_SWAP_INT((GLbyte *)&hdr->width);
220 __GLX_SWAP_INT((GLbyte *)&hdr->height);
221 __GLX_SWAP_INT((GLbyte *)&hdr->format);
222 __GLX_SWAP_INT((GLbyte *)&hdr->type);
225 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
226 ** the pixel data.
228 hdr->swapBytes = !hdr->swapBytes;
231 void __glXDispSwap_TexSubImage3D(GLbyte *pc)
233 __GLXdispatchTexSubImage3DHeader *hdr =
234 (__GLXdispatchTexSubImage3DHeader *) pc;
236 __GLX_DECLARE_SWAP_VARIABLES;
238 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
239 __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
240 __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
241 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
242 __GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
243 __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
244 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
245 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
247 __GLX_SWAP_INT((GLbyte *)&hdr->target);
248 __GLX_SWAP_INT((GLbyte *)&hdr->level);
249 __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
250 __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
251 __GLX_SWAP_INT((GLbyte *)&hdr->zoffset);
252 __GLX_SWAP_INT((GLbyte *)&hdr->width);
253 __GLX_SWAP_INT((GLbyte *)&hdr->height);
254 __GLX_SWAP_INT((GLbyte *)&hdr->depth);
255 __GLX_SWAP_INT((GLbyte *)&hdr->size4d);
256 __GLX_SWAP_INT((GLbyte *)&hdr->format);
257 __GLX_SWAP_INT((GLbyte *)&hdr->type);
260 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
261 ** the pixel data.
263 hdr->swapBytes = !hdr->swapBytes;
266 void __glXDispSwap_ColorTable(GLbyte *pc)
268 __GLXdispatchColorTableHeader *hdr =
269 (__GLXdispatchColorTableHeader *) pc;
270 __GLX_DECLARE_SWAP_VARIABLES;
272 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
273 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
274 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
275 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
277 __GLX_SWAP_INT((GLbyte *)&hdr->target);
278 __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
279 __GLX_SWAP_INT((GLbyte *)&hdr->width);
280 __GLX_SWAP_INT((GLbyte *)&hdr->format);
281 __GLX_SWAP_INT((GLbyte *)&hdr->type);
284 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
285 ** the pixel data.
287 hdr->swapBytes = !hdr->swapBytes;
290 void __glXDispSwap_ColorSubTable(GLbyte *pc)
292 __GLXdispatchColorSubTableHeader *hdr =
293 (__GLXdispatchColorSubTableHeader *) pc;
294 __GLX_DECLARE_SWAP_VARIABLES;
296 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
297 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
298 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
299 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
301 __GLX_SWAP_INT((GLbyte *)&hdr->target);
302 __GLX_SWAP_INT((GLbyte *)&hdr->start);
303 __GLX_SWAP_INT((GLbyte *)&hdr->count);
304 __GLX_SWAP_INT((GLbyte *)&hdr->format);
305 __GLX_SWAP_INT((GLbyte *)&hdr->type);
308 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
309 ** the pixel data.
311 hdr->swapBytes = !hdr->swapBytes;
314 void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc)
316 __GLXdispatchConvolutionFilterHeader *hdr =
317 (__GLXdispatchConvolutionFilterHeader *) pc;
318 __GLX_DECLARE_SWAP_VARIABLES;
320 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
321 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
322 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
323 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
325 __GLX_SWAP_INT((GLbyte *)&hdr->target);
326 __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
327 __GLX_SWAP_INT((GLbyte *)&hdr->width);
328 __GLX_SWAP_INT((GLbyte *)&hdr->format);
329 __GLX_SWAP_INT((GLbyte *)&hdr->type);
332 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
333 ** the pixel data.
335 hdr->swapBytes = !hdr->swapBytes;
338 void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc)
340 __GLXdispatchConvolutionFilterHeader *hdr =
341 (__GLXdispatchConvolutionFilterHeader *) pc;
342 __GLX_DECLARE_SWAP_VARIABLES;
344 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
345 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
346 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
347 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
349 __GLX_SWAP_INT((GLbyte *)&hdr->target);
350 __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
351 __GLX_SWAP_INT((GLbyte *)&hdr->width);
352 __GLX_SWAP_INT((GLbyte *)&hdr->height);
353 __GLX_SWAP_INT((GLbyte *)&hdr->format);
354 __GLX_SWAP_INT((GLbyte *)&hdr->type);
357 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
358 ** the pixel data.
360 hdr->swapBytes = !hdr->swapBytes;
363 void __glXDispSwap_SeparableFilter2D(GLbyte *pc)
365 __GLXdispatchConvolutionFilterHeader *hdr =
366 (__GLXdispatchConvolutionFilterHeader *) pc;
367 GLint hdrlen, image1len;
368 __GLX_DECLARE_SWAP_VARIABLES;
370 hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
372 __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
373 __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
374 __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
375 __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
377 __GLX_SWAP_INT((GLbyte *)&hdr->target);
378 __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
379 __GLX_SWAP_INT((GLbyte *)&hdr->width);
380 __GLX_SWAP_INT((GLbyte *)&hdr->height);
381 __GLX_SWAP_INT((GLbyte *)&hdr->format);
382 __GLX_SWAP_INT((GLbyte *)&hdr->type);
385 ** Just invert swapBytes flag; the GL will figure out if it needs to swap
386 ** the pixel data.
388 hdr->swapBytes = !hdr->swapBytes;