Make the transition to script-genereated GLX code easier.
[mesa.git] / src / glx / x11 / g_render.c
1 /* $XFree86: xc/lib/GL/glx/g_render.c,v 1.8 2004/01/28 18:11:38 alanh Exp $ */
2 /*
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:
10 **
11 ** http://oss.sgi.com/projects/FreeB
12 **
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.
18 **
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.
24 **
25 ** Additional Notice Provisions: This software was created using the
26 ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
27 ** not been independently verified as being compliant with the OpenGL(R)
28 ** version 1.2.1 Specification.
29 */
30
31 #include "packrender.h"
32 #include "size.h"
33 #include "indirect.h"
34
35 #define GLdouble_SIZE 8
36 #define GLclampd_SIZE 8
37 #define GLfloat_SIZE 4
38 #define GLclampf_SIZE 4
39 #define GLint_SIZE 4
40 #define GLuint_SIZE 4
41 #define GLenum_SIZE 4
42 #define GLbitfield_SIZE 4
43 #define GLshort_SIZE 2
44 #define GLushort_SIZE 2
45 #define GLbyte_SIZE 1
46 #define GLubyte_SIZE 1
47 #define GLboolean_SIZE 1
48
49 #define __GLX_PUT_GLdouble(offset,value) __GLX_PUT_DOUBLE(offset,value)
50 #define __GLX_PUT_GLclampd(offset,value) __GLX_PUT_DOUBLE(offset,value)
51 #define __GLX_PUT_GLfloat(offset,value) __GLX_PUT_FLOAT(offset,value)
52 #define __GLX_PUT_GLclampf(offset,value) __GLX_PUT_FLOAT(offset,value)
53 #define __GLX_PUT_GLint(offset,value) __GLX_PUT_LONG(offset,value)
54 #define __GLX_PUT_GLuint(offset,value) __GLX_PUT_LONG(offset,value)
55 #define __GLX_PUT_GLenum(offset,value) __GLX_PUT_LONG(offset,value)
56 #define __GLX_PUT_GLbitfield(offset,value) __GLX_PUT_LONG(offset,value)
57 #define __GLX_PUT_GLshort(offset,value) __GLX_PUT_SHORT(offset,value)
58 #define __GLX_PUT_GLushort(offset,value) __GLX_PUT_SHORT(offset,value)
59 #define __GLX_PUT_GLbyte(offset,value) __GLX_PUT_CHAR(offset,value)
60 #define __GLX_PUT_GLubyte(offset,value) __GLX_PUT_CHAR(offset,value)
61 #define __GLX_PUT_GLboolean(offset,value) __GLX_PUT_CHAR(offset,value)
62
63 #define __GLX_PUT_GLdouble_ARRAY(offset,ptr,count) __GLX_PUT_DOUBLE_ARRAY(offset,ptr,count)
64 #define __GLX_PUT_GLclampd_ARRAY(offset,ptr,count) __GLX_PUT_DOUBLE_ARRAY(offset,ptr,count)
65 #define __GLX_PUT_GLfloat_ARRAY(offset,ptr,count) __GLX_PUT_FLOAT_ARRAY(offset,ptr,count)
66 #define __GLX_PUT_GLclampf_ARRAY(offset,ptr,count) __GLX_PUT_FLOAT_ARRAY(offset,ptr,count)
67 #define __GLX_PUT_GLint_ARRAY(offset,ptr,count) __GLX_PUT_LONG_ARRAY(offset,ptr,count)
68 #define __GLX_PUT_GLuint_ARRAY(offset,ptr,count) __GLX_PUT_LONG_ARRAY(offset,ptr,count)
69 #define __GLX_PUT_GLenum_ARRAY(offset,ptr,count) __GLX_PUT_LONG_ARRAY(offset,ptr,count)
70 #define __GLX_PUT_GLshort_ARRAY(offset,ptr,count) __GLX_PUT_SHORT_ARRAY(offset,ptr,count)
71 #define __GLX_PUT_GLushort_ARRAY(offset,ptr,count) __GLX_PUT_SHORT_ARRAY(offset,ptr,count)
72 #define __GLX_PUT_GLbyte_ARRAY(offset,ptr,count) __GLX_PUT_CHAR_ARRAY(offset,ptr,count)
73 #define __GLX_PUT_GLubyte_ARRAY(offset,ptr,count) __GLX_PUT_CHAR_ARRAY(offset,ptr,count)
74 #define __GLX_PUT_GLboolean_ARRAY(offset,ptr,count) __GLX_PUT_CHAR_ARRAY(offset,ptr,count)
75
76 #define RENDER_SIZE(t,c) (__GLX_PAD(4 + (t ## _SIZE * c)))
77
78 /* GLX protocol templates are named in the following manner. All templates
79 * begin with the string 'glxproto_'. Following is an optional list of
80 * scalar parameters. The scalars are listed as type and number. The most
81 * common being \c enum1 (one scalar enum) and \c enum2 (two scalar enums).
82 *
83 * The final part of the name describes the number of named-type parameters
84 * and how they are passed.
85 * - One or more digits followed by the letter s means
86 * that the specified number of parameters are passed as scalars. The macro
87 * \c glxproto_3s generates a function that takes 3 scalars, such as
88 * \c glVertex3f.
89 * - A capital C follwed by a lower-case v means that a constant
90 * sized vector is passed. Macros of this type take an extra parameter,
91 * which is the size of the vector. The invocation
92 * 'glxproto_Cv(Vertex3fv, X_GLrop_Vertexfv, GLfloat, 3)' would generate the
93 * correct protocol for the \c glVertex3fv function.
94 * - A capital V followed by a lower-case v means that a variable sized
95 * vector is passed. The function generated by these macros will call
96 * a co-function to determine the size of the vector. The name of the
97 * co-function is generated by prepending \c __gl and appending \c _size
98 * to the base name of the function. The invocation
99 * 'glxproto_enum1_Vv(Fogiv, X_GLrop_Fogiv, GLint)' would generate the
100 * correct protocol for the \c glFogiv function.
101 * - One or more digits without a following letter means that a function
102 * taking the specified number of scalar parameters and a function with a
103 * vector parameter of the specified size should be generated. The letter
104 * v is automatically appended to the name of the vector-based function in
105 * this case. The invocation
106 * 'glxproto_3(Vertex3f, X_GLrop_Vertex3fv, GLfloat)' would generate the
107 * correct protocol for both \c glVertex3f and \c glVertex3fv.
108 *
109 * glxproto_void is a special case for functions that take no parameters
110 * (i.e., glEnd).
111 *
112 * An addition form is 'glxvendr_'. This is identical to the other forms
113 * with the exception of taking an additional parameter (to the macro) which
114 * is a vendor string to append to the function name. The invocation
115 * 'glxproto_3(Foo3f, X_GLrop_Foo3fv, GLfloat)' would generate the functions
116 * 'glFoo3fv' and 'glFoo3f', and the invocation
117 * 'glxvendr_3(Foo3f, X_GLrop_Foo3fv, GLfloat, EXT)' would generate the
118 * functions 'glFoo3fvEXT' and 'glFoo3fEXT'.
119 */
120
121 #define glxproto_void(name, rop) \
122 void __indirect_gl ## name (void) \
123 { \
124 __GLX_DECLARE_VARIABLES(); \
125 __GLX_LOAD_VARIABLES(); \
126 __GLX_BEGIN(rop, 4); \
127 __GLX_END(4); \
128 }
129
130 #define glxproto_Cv(name, rop, type, count) \
131 void __indirect_gl ## name (const type * v) \
132 { \
133 __GLX_DECLARE_VARIABLES(); \
134 __GLX_LOAD_VARIABLES(); \
135 cmdlen = RENDER_SIZE(type, count); \
136 __GLX_BEGIN(rop, cmdlen); \
137 if (count <= 4) { \
138 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v[0]); \
139 if (count > 1) { __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v[1]); } \
140 if (count > 2) { __GLX_PUT_ ## type (4 + (2 * type ## _SIZE), v[2]); } \
141 if (count > 3) { __GLX_PUT_ ## type (4 + (3 * type ## _SIZE), v[3]); } \
142 } else { \
143 __GLX_PUT_ ## type ## _ARRAY(4, v, count); \
144 } \
145 __GLX_END(cmdlen); \
146 }
147
148 #define glxproto_Cv_transpose(name, rop, type, w) \
149 void __indirect_gl ## name (const type * v) \
150 { \
151 __GLX_DECLARE_VARIABLES(); \
152 type t[ w * w ]; unsigned i, j; \
153 for (i = 0; i < w; i++) { \
154 for (j = 0; j < w; j++) { \
155 t[i*w+j] = v[j*w+i]; \
156 } \
157 } \
158 __GLX_LOAD_VARIABLES(); \
159 cmdlen = RENDER_SIZE(type, (w * w)); \
160 __GLX_BEGIN(rop, cmdlen); \
161 __GLX_PUT_ ## type ## _ARRAY(4, t, (w * w)); \
162 __GLX_END(cmdlen); \
163 }
164
165 #define glxproto_1s(name, rop, type) \
166 void __indirect_gl ## name (type v1) \
167 { \
168 __GLX_DECLARE_VARIABLES(); \
169 __GLX_LOAD_VARIABLES(); \
170 cmdlen = RENDER_SIZE(type, 1); \
171 __GLX_BEGIN(rop, cmdlen); \
172 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v1); \
173 __GLX_END(cmdlen); \
174 }
175
176 #define glxproto_2s(name, rop, type) \
177 void __indirect_gl ## name (type v1, type v2) \
178 { \
179 __GLX_DECLARE_VARIABLES(); \
180 __GLX_LOAD_VARIABLES(); \
181 cmdlen = RENDER_SIZE(type, 2); \
182 __GLX_BEGIN(rop, cmdlen); \
183 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v1); \
184 __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v2); \
185 __GLX_END(cmdlen); \
186 }
187
188 #define glxproto_3s(name, rop, type) \
189 void __indirect_gl ## name (type v1, type v2, type v3) \
190 { \
191 __GLX_DECLARE_VARIABLES(); \
192 __GLX_LOAD_VARIABLES(); \
193 cmdlen = RENDER_SIZE(type, 3); \
194 __GLX_BEGIN(rop, cmdlen); \
195 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v1); \
196 __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v2); \
197 __GLX_PUT_ ## type (4 + (2 * type ## _SIZE), v3); \
198 __GLX_END(cmdlen); \
199 }
200
201 #define glxproto_4s(name, rop, type) \
202 void __indirect_gl ## name (type v1, type v2, type v3, type v4) \
203 { \
204 __GLX_DECLARE_VARIABLES(); \
205 __GLX_LOAD_VARIABLES(); \
206 cmdlen = RENDER_SIZE(type, 4); \
207 __GLX_BEGIN(rop, cmdlen); \
208 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v1); \
209 __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v2); \
210 __GLX_PUT_ ## type (4 + (2 * type ## _SIZE), v3); \
211 __GLX_PUT_ ## type (4 + (3 * type ## _SIZE), v4); \
212 __GLX_END(cmdlen); \
213 }
214
215 #define glxproto_6s(name, rop, type) \
216 void __indirect_gl ## name (type v1, type v2, type v3, type v4, type v5, type v6) \
217 { \
218 __GLX_DECLARE_VARIABLES(); \
219 __GLX_LOAD_VARIABLES(); \
220 cmdlen = RENDER_SIZE(type, 6); \
221 __GLX_BEGIN(rop, cmdlen); \
222 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v1); \
223 __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v2); \
224 __GLX_PUT_ ## type (4 + (2 * type ## _SIZE), v3); \
225 __GLX_PUT_ ## type (4 + (3 * type ## _SIZE), v4); \
226 __GLX_PUT_ ## type (4 + (4 * type ## _SIZE), v5); \
227 __GLX_PUT_ ## type (4 + (5 * type ## _SIZE), v6); \
228 __GLX_END(cmdlen); \
229 }
230
231 #define glxproto_enum1_1s(name, rop, type) \
232 void __indirect_gl ## name (GLenum e, type v1) \
233 { \
234 __GLX_DECLARE_VARIABLES(); \
235 __GLX_LOAD_VARIABLES(); \
236 cmdlen = 4 + RENDER_SIZE(type, 1); \
237 __GLX_BEGIN(rop, cmdlen); \
238 if (type ## _SIZE == 8) { \
239 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v1); \
240 __GLX_PUT_LONG (4 + (1 * type ## _SIZE), e); \
241 } else { \
242 __GLX_PUT_LONG(4, e); \
243 __GLX_PUT_ ## type (8 + (0 * type ## _SIZE), v1); \
244 } \
245 __GLX_END(cmdlen); \
246 }
247
248 #define glxproto_enum1_1v(name, rop, type) \
249 void __indirect_gl ## name (GLenum e, const type * v) \
250 { \
251 __GLX_DECLARE_VARIABLES(); \
252 __GLX_LOAD_VARIABLES(); \
253 cmdlen = 4 + RENDER_SIZE(type, 1); \
254 __GLX_BEGIN(rop, cmdlen); \
255 if (type ## _SIZE == 8) { \
256 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v[0]); \
257 __GLX_PUT_LONG (4 + (1 * type ## _SIZE), e); \
258 } else { \
259 __GLX_PUT_LONG(4, e); \
260 __GLX_PUT_ ## type (8 + (0 * type ## _SIZE), v[0]); \
261 } \
262 __GLX_END(cmdlen); \
263 }
264
265 #define glxproto_enum1_2s(name, rop, type) \
266 void __indirect_gl ## name (GLenum e, type v1, type v2) \
267 { \
268 __GLX_DECLARE_VARIABLES(); \
269 __GLX_LOAD_VARIABLES(); \
270 cmdlen = 4 + RENDER_SIZE(type, 2); \
271 __GLX_BEGIN(rop, cmdlen); \
272 if (type ## _SIZE == 8) { \
273 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v1); \
274 __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v2); \
275 __GLX_PUT_LONG (4 + (2 * type ## _SIZE), e); \
276 } else { \
277 __GLX_PUT_LONG(4, e); \
278 __GLX_PUT_ ## type (8 + (0 * type ## _SIZE), v1); \
279 __GLX_PUT_ ## type (8 + (1 * type ## _SIZE), v2); \
280 } \
281 __GLX_END(cmdlen); \
282 }
283
284 #define glxproto_enum1_2v(name, rop, type) \
285 void __indirect_gl ## name (GLenum e, const type * v) \
286 { \
287 __GLX_DECLARE_VARIABLES(); \
288 __GLX_LOAD_VARIABLES(); \
289 cmdlen = 4 + RENDER_SIZE(type, 2); \
290 __GLX_BEGIN(rop, cmdlen); \
291 if (type ## _SIZE == 8) { \
292 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v[0]); \
293 __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v[1]); \
294 __GLX_PUT_LONG (4 + (2 * type ## _SIZE), e); \
295 } else { \
296 __GLX_PUT_LONG(4, e); \
297 __GLX_PUT_ ## type (8 + (0 * type ## _SIZE), v[0]); \
298 __GLX_PUT_ ## type (8 + (1 * type ## _SIZE), v[1]); \
299 } \
300 __GLX_END(cmdlen); \
301 }
302
303 #define glxproto_enum1_3s(name, rop, type) \
304 void __indirect_gl ## name (GLenum e, type v1, type v2, type v3) \
305 { \
306 __GLX_DECLARE_VARIABLES(); \
307 __GLX_LOAD_VARIABLES(); \
308 cmdlen = 4 + RENDER_SIZE(type, 3); \
309 __GLX_BEGIN(rop, cmdlen); \
310 if (type ## _SIZE == 8) { \
311 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v1); \
312 __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v2); \
313 __GLX_PUT_ ## type (4 + (2 * type ## _SIZE), v3); \
314 __GLX_PUT_LONG (4 + (3 * type ## _SIZE), e); \
315 } else { \
316 __GLX_PUT_LONG(4, e); \
317 __GLX_PUT_ ## type (8 + (0 * type ## _SIZE), v1); \
318 __GLX_PUT_ ## type (8 + (1 * type ## _SIZE), v2); \
319 __GLX_PUT_ ## type (8 + (2 * type ## _SIZE), v3); \
320 } \
321 __GLX_END(cmdlen); \
322 }
323
324 #define glxproto_enum1_3v(name, rop, type) \
325 void __indirect_gl ## name (GLenum e, const type * v) \
326 { \
327 __GLX_DECLARE_VARIABLES(); \
328 __GLX_LOAD_VARIABLES(); \
329 cmdlen = 4 + RENDER_SIZE(type, 3); \
330 __GLX_BEGIN(rop, cmdlen); \
331 if (type ## _SIZE == 8) { \
332 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v[0]); \
333 __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v[1]); \
334 __GLX_PUT_ ## type (4 + (2 * type ## _SIZE), v[2]); \
335 __GLX_PUT_LONG (4 + (3 * type ## _SIZE), e); \
336 } else { \
337 __GLX_PUT_LONG(4, e); \
338 __GLX_PUT_ ## type (8 + (0 * type ## _SIZE), v[0]); \
339 __GLX_PUT_ ## type (8 + (1 * type ## _SIZE), v[1]); \
340 __GLX_PUT_ ## type (8 + (2 * type ## _SIZE), v[2]); \
341 } \
342 __GLX_END(cmdlen); \
343 }
344
345 #define glxproto_enum1_4s(name, rop, type) \
346 void __indirect_gl ## name (GLenum e, type v1, type v2, type v3, type v4) \
347 { \
348 __GLX_DECLARE_VARIABLES(); \
349 __GLX_LOAD_VARIABLES(); \
350 cmdlen = 4 + RENDER_SIZE(type, 4); \
351 __GLX_BEGIN(rop, cmdlen); \
352 if (type ## _SIZE == 8) { \
353 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v1); \
354 __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v2); \
355 __GLX_PUT_ ## type (4 + (2 * type ## _SIZE), v3); \
356 __GLX_PUT_ ## type (4 + (3 * type ## _SIZE), v4); \
357 __GLX_PUT_LONG (4 + (4 * type ## _SIZE), e); \
358 } else { \
359 __GLX_PUT_LONG(4, e); \
360 __GLX_PUT_ ## type (8 + (0 * type ## _SIZE), v1); \
361 __GLX_PUT_ ## type (8 + (1 * type ## _SIZE), v2); \
362 __GLX_PUT_ ## type (8 + (2 * type ## _SIZE), v3); \
363 __GLX_PUT_ ## type (8 + (3 * type ## _SIZE), v4); \
364 } \
365 __GLX_END(cmdlen); \
366 }
367
368 #define glxproto_enum1_4v(name, rop, type) \
369 void __indirect_gl ## name (GLenum e, const type * v) \
370 { \
371 __GLX_DECLARE_VARIABLES(); \
372 __GLX_LOAD_VARIABLES(); \
373 cmdlen = 4 + RENDER_SIZE(type, 4); \
374 __GLX_BEGIN(rop, cmdlen); \
375 if (type ## _SIZE == 8) { \
376 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v[0]); \
377 __GLX_PUT_ ## type (4 + (1 * type ## _SIZE), v[1]); \
378 __GLX_PUT_ ## type (4 + (2 * type ## _SIZE), v[2]); \
379 __GLX_PUT_ ## type (4 + (3 * type ## _SIZE), v[3]); \
380 __GLX_PUT_LONG (4 + (4 * type ## _SIZE), e); \
381 } else { \
382 __GLX_PUT_LONG(4, e); \
383 __GLX_PUT_ ## type (8 + (0 * type ## _SIZE), v[0]); \
384 __GLX_PUT_ ## type (8 + (1 * type ## _SIZE), v[1]); \
385 __GLX_PUT_ ## type (8 + (2 * type ## _SIZE), v[2]); \
386 __GLX_PUT_ ## type (8 + (3 * type ## _SIZE), v[3]); \
387 } \
388 __GLX_END(cmdlen); \
389 }
390
391 #define glxproto_enum1_Vv(name, rop, type) \
392 void __indirect_gl ## name (GLenum pname, const type * v) \
393 { \
394 __GLX_DECLARE_VARIABLES(); \
395 __GLX_LOAD_VARIABLES(); \
396 compsize = __gl ## name ## _size(pname); \
397 cmdlen = 4 + RENDER_SIZE(type, compsize); \
398 __GLX_BEGIN(rop, cmdlen); \
399 __GLX_PUT_LONG(4, pname); \
400 __GLX_PUT_ ## type ## _ARRAY(8, v, compsize); \
401 __GLX_END(cmdlen); \
402 }
403
404 #define glxproto_enum2_1s(name, rop, type) \
405 void __indirect_gl ## name (GLenum target, GLenum pname, type v1) \
406 { \
407 __GLX_DECLARE_VARIABLES(); \
408 __GLX_LOAD_VARIABLES(); \
409 cmdlen = 8 + RENDER_SIZE(type, 1); \
410 __GLX_BEGIN(rop, cmdlen); \
411 if (type ## _SIZE == 8) { \
412 __GLX_PUT_ ## type (4 + (0 * type ## _SIZE), v1); \
413 __GLX_PUT_LONG (4 + (1 * type ## _SIZE), target); \
414 __GLX_PUT_LONG (8 + (1 * type ## _SIZE), pname); \
415 } else { \
416 __GLX_PUT_LONG(4, target); \
417 __GLX_PUT_LONG(8, pname); \
418 __GLX_PUT_ ## type (12 + (0 * type ## _SIZE), v1); \
419 } \
420 __GLX_END(cmdlen); \
421 }
422
423 #define glxproto_enum2_Vv(name, rop, type) \
424 void __indirect_gl ## name (GLenum target, GLenum pname, const type * v) \
425 { \
426 __GLX_DECLARE_VARIABLES(); \
427 __GLX_LOAD_VARIABLES(); \
428 compsize = __gl ## name ## _size(pname); \
429 cmdlen = 8 + RENDER_SIZE(type, compsize); \
430 __GLX_BEGIN(rop, cmdlen); \
431 __GLX_PUT_LONG(4, target); \
432 __GLX_PUT_LONG(8, pname); \
433 __GLX_PUT_ ## type ## _ARRAY(12, v, compsize); \
434 __GLX_END(cmdlen); \
435 }
436
437 #define GENERATE_GLX_PROTOCOL_FUNCTIONS
438 #include "indirect.h"
439
440 void __indirect_glRectdv(const GLdouble *v1, const GLdouble *v2)
441 {
442 __GLX_DECLARE_VARIABLES();
443 __GLX_LOAD_VARIABLES();
444 __GLX_BEGIN(X_GLrop_Rectdv,36);
445 __GLX_PUT_DOUBLE(4,v1[0]);
446 __GLX_PUT_DOUBLE(12,v1[1]);
447 __GLX_PUT_DOUBLE(20,v2[0]);
448 __GLX_PUT_DOUBLE(28,v2[1]);
449 __GLX_END(36);
450 }
451
452 void __indirect_glRectfv(const GLfloat *v1, const GLfloat *v2)
453 {
454 __GLX_DECLARE_VARIABLES();
455 __GLX_LOAD_VARIABLES();
456 __GLX_BEGIN(X_GLrop_Rectfv,20);
457 __GLX_PUT_FLOAT(4,v1[0]);
458 __GLX_PUT_FLOAT(8,v1[1]);
459 __GLX_PUT_FLOAT(12,v2[0]);
460 __GLX_PUT_FLOAT(16,v2[1]);
461 __GLX_END(20);
462 }
463
464 void __indirect_glRectiv(const GLint *v1, const GLint *v2)
465 {
466 __GLX_DECLARE_VARIABLES();
467 __GLX_LOAD_VARIABLES();
468 __GLX_BEGIN(X_GLrop_Rectiv,20);
469 __GLX_PUT_LONG(4,v1[0]);
470 __GLX_PUT_LONG(8,v1[1]);
471 __GLX_PUT_LONG(12,v2[0]);
472 __GLX_PUT_LONG(16,v2[1]);
473 __GLX_END(20);
474 }
475
476 void __indirect_glRectsv(const GLshort *v1, const GLshort *v2)
477 {
478 __GLX_DECLARE_VARIABLES();
479 __GLX_LOAD_VARIABLES();
480 __GLX_BEGIN(X_GLrop_Rectsv,12);
481 __GLX_PUT_SHORT(4,v1[0]);
482 __GLX_PUT_SHORT(6,v1[1]);
483 __GLX_PUT_SHORT(8,v2[0]);
484 __GLX_PUT_SHORT(10,v2[1]);
485 __GLX_END(12);
486 }
487
488 void __indirect_glLineStipple(GLint factor, GLushort pattern)
489 {
490 __GLX_DECLARE_VARIABLES();
491 __GLX_LOAD_VARIABLES();
492 __GLX_BEGIN(X_GLrop_LineStipple,12);
493 __GLX_PUT_LONG(4,factor);
494 __GLX_PUT_SHORT(8,pattern);
495 __GLX_END(12);
496 }
497
498 void __indirect_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
499 {
500 __GLX_DECLARE_VARIABLES();
501 __GLX_LOAD_VARIABLES();
502 __GLX_BEGIN(X_GLrop_Scissor,20);
503 __GLX_PUT_LONG(4,x);
504 __GLX_PUT_LONG(8,y);
505 __GLX_PUT_LONG(12,width);
506 __GLX_PUT_LONG(16,height);
507 __GLX_END(20);
508 }
509
510 void __indirect_glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
511 {
512 __GLX_DECLARE_VARIABLES();
513 __GLX_LOAD_VARIABLES();
514 __GLX_BEGIN(X_GLrop_MapGrid1d,24);
515 __GLX_PUT_DOUBLE(4,u1);
516 __GLX_PUT_DOUBLE(12,u2);
517 __GLX_PUT_LONG(20,un);
518 __GLX_END(24);
519 }
520
521 void __indirect_glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
522 {
523 __GLX_DECLARE_VARIABLES();
524 __GLX_LOAD_VARIABLES();
525 __GLX_BEGIN(X_GLrop_MapGrid1f,16);
526 __GLX_PUT_LONG(4,un);
527 __GLX_PUT_FLOAT(8,u1);
528 __GLX_PUT_FLOAT(12,u2);
529 __GLX_END(16);
530 }
531
532 void __indirect_glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
533 {
534 __GLX_DECLARE_VARIABLES();
535 __GLX_LOAD_VARIABLES();
536 __GLX_BEGIN(X_GLrop_MapGrid2d,44);
537 __GLX_PUT_DOUBLE(4,u1);
538 __GLX_PUT_DOUBLE(12,u2);
539 __GLX_PUT_DOUBLE(20,v1);
540 __GLX_PUT_DOUBLE(28,v2);
541 __GLX_PUT_LONG(36,un);
542 __GLX_PUT_LONG(40,vn);
543 __GLX_END(44);
544 }
545
546 void __indirect_glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
547 {
548 __GLX_DECLARE_VARIABLES();
549 __GLX_LOAD_VARIABLES();
550 __GLX_BEGIN(X_GLrop_MapGrid2f,28);
551 __GLX_PUT_LONG(4,un);
552 __GLX_PUT_FLOAT(8,u1);
553 __GLX_PUT_FLOAT(12,u2);
554 __GLX_PUT_LONG(16,vn);
555 __GLX_PUT_FLOAT(20,v1);
556 __GLX_PUT_FLOAT(24,v2);
557 __GLX_END(28);
558 }
559
560 void __indirect_glStencilFunc(GLenum func, GLint ref, GLuint mask)
561 {
562 __GLX_DECLARE_VARIABLES();
563 __GLX_LOAD_VARIABLES();
564 __GLX_BEGIN(X_GLrop_StencilFunc,16);
565 __GLX_PUT_LONG(4,func);
566 __GLX_PUT_LONG(8,ref);
567 __GLX_PUT_LONG(12,mask);
568 __GLX_END(16);
569 }
570
571 void __indirect_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)
572 {
573 __GLX_DECLARE_VARIABLES();
574 __GLX_LOAD_VARIABLES();
575 __GLX_BEGIN(X_GLrop_CopyPixels,24);
576 __GLX_PUT_LONG(4,x);
577 __GLX_PUT_LONG(8,y);
578 __GLX_PUT_LONG(12,width);
579 __GLX_PUT_LONG(16,height);
580 __GLX_PUT_LONG(20,type);
581 __GLX_END(24);
582 }
583
584 void __indirect_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
585 {
586 __GLX_DECLARE_VARIABLES();
587 __GLX_LOAD_VARIABLES();
588 __GLX_BEGIN(X_GLrop_Viewport,20);
589 __GLX_PUT_LONG(4,x);
590 __GLX_PUT_LONG(8,y);
591 __GLX_PUT_LONG(12,width);
592 __GLX_PUT_LONG(16,height);
593 __GLX_END(20);
594 }
595
596 void __indirect_glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)
597 {
598 __GLX_DECLARE_VARIABLES();
599 __GLX_LOAD_VARIABLES();
600 __GLX_BEGIN(X_GLrop_CopyTexImage1D,32);
601 __GLX_PUT_LONG(4,target);
602 __GLX_PUT_LONG(8,level);
603 __GLX_PUT_LONG(12,internalformat);
604 __GLX_PUT_LONG(16,x);
605 __GLX_PUT_LONG(20,y);
606 __GLX_PUT_LONG(24,width);
607 __GLX_PUT_LONG(28,border);
608 __GLX_END(32);
609 }
610
611 void __indirect_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
612 {
613 __GLX_DECLARE_VARIABLES();
614 __GLX_LOAD_VARIABLES();
615 __GLX_BEGIN(X_GLrop_CopyTexImage2D,36);
616 __GLX_PUT_LONG(4,target);
617 __GLX_PUT_LONG(8,level);
618 __GLX_PUT_LONG(12,internalformat);
619 __GLX_PUT_LONG(16,x);
620 __GLX_PUT_LONG(20,y);
621 __GLX_PUT_LONG(24,width);
622 __GLX_PUT_LONG(28,height);
623 __GLX_PUT_LONG(32,border);
624 __GLX_END(36);
625 }
626
627 void __indirect_glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)
628 {
629 __GLX_DECLARE_VARIABLES();
630 __GLX_LOAD_VARIABLES();
631 __GLX_BEGIN(X_GLrop_CopyTexSubImage1D,28);
632 __GLX_PUT_LONG(4,target);
633 __GLX_PUT_LONG(8,level);
634 __GLX_PUT_LONG(12,xoffset);
635 __GLX_PUT_LONG(16,x);
636 __GLX_PUT_LONG(20,y);
637 __GLX_PUT_LONG(24,width);
638 __GLX_END(28);
639 }
640
641 void __indirect_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
642 {
643 __GLX_DECLARE_VARIABLES();
644 __GLX_LOAD_VARIABLES();
645 __GLX_BEGIN(X_GLrop_CopyTexSubImage2D,36);
646 __GLX_PUT_LONG(4,target);
647 __GLX_PUT_LONG(8,level);
648 __GLX_PUT_LONG(12,xoffset);
649 __GLX_PUT_LONG(16,yoffset);
650 __GLX_PUT_LONG(20,x);
651 __GLX_PUT_LONG(24,y);
652 __GLX_PUT_LONG(28,width);
653 __GLX_PUT_LONG(32,height);
654 __GLX_END(36);
655 }
656
657 void __indirect_glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLclampf *priorities)
658 {
659 __GLX_DECLARE_VARIABLES();
660 __GLX_LOAD_VARIABLES();
661 if (n < 0) return;
662 cmdlen = 8+n*4+n*4;
663 __GLX_BEGIN(X_GLrop_PrioritizeTextures,cmdlen);
664 __GLX_PUT_LONG(4,n);
665 __GLX_PUT_LONG_ARRAY(8,textures,n);
666 __GLX_PUT_FLOAT_ARRAY(8+n*4,priorities,n);
667 __GLX_END(cmdlen);
668 }
669
670 void __indirect_glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
671 {
672 __GLX_DECLARE_VARIABLES();
673 __GLX_LOAD_VARIABLES();
674 __GLX_BEGIN(X_GLrop_CopyColorTable,24);
675 __GLX_PUT_LONG(4,target);
676 __GLX_PUT_LONG(8,internalformat);
677 __GLX_PUT_LONG(12,x);
678 __GLX_PUT_LONG(16,y);
679 __GLX_PUT_LONG(20,width);
680 __GLX_END(24);
681 }
682
683 void __indirect_glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)
684 {
685 __GLX_DECLARE_VARIABLES();
686 __GLX_LOAD_VARIABLES();
687 __GLX_BEGIN(X_GLrop_CopyColorSubTable,24);
688 __GLX_PUT_LONG(4,target);
689 __GLX_PUT_LONG(8,start);
690 __GLX_PUT_LONG(12,x);
691 __GLX_PUT_LONG(16,y);
692 __GLX_PUT_LONG(20,width);
693 __GLX_END(24);
694 }
695
696 void __indirect_glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)
697 {
698 __GLX_DECLARE_VARIABLES();
699 __GLX_LOAD_VARIABLES();
700 __GLX_BEGIN(X_GLrop_CopyConvolutionFilter1D,24);
701 __GLX_PUT_LONG(4,target);
702 __GLX_PUT_LONG(8,internalformat);
703 __GLX_PUT_LONG(12,x);
704 __GLX_PUT_LONG(16,y);
705 __GLX_PUT_LONG(20,width);
706 __GLX_END(24);
707 }
708
709 void __indirect_glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)
710 {
711 __GLX_DECLARE_VARIABLES();
712 __GLX_LOAD_VARIABLES();
713 __GLX_BEGIN(X_GLrop_CopyConvolutionFilter2D,28);
714 __GLX_PUT_LONG(4,target);
715 __GLX_PUT_LONG(8,internalformat);
716 __GLX_PUT_LONG(12,x);
717 __GLX_PUT_LONG(16,y);
718 __GLX_PUT_LONG(20,width);
719 __GLX_PUT_LONG(24,height);
720 __GLX_END(28);
721 }
722
723 void __indirect_glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)
724 {
725 __GLX_DECLARE_VARIABLES();
726 __GLX_LOAD_VARIABLES();
727 __GLX_BEGIN(X_GLrop_Histogram,20);
728 __GLX_PUT_LONG(4,target);
729 __GLX_PUT_LONG(8,width);
730 __GLX_PUT_LONG(12,internalformat);
731 __GLX_PUT_CHAR(16,sink);
732 __GLX_END(20);
733 }
734
735 void __indirect_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
736 {
737 __GLX_DECLARE_VARIABLES();
738 __GLX_LOAD_VARIABLES();
739 __GLX_BEGIN(X_GLrop_CopyTexSubImage3D,40);
740 __GLX_PUT_LONG(4,target);
741 __GLX_PUT_LONG(8,level);
742 __GLX_PUT_LONG(12,xoffset);
743 __GLX_PUT_LONG(16,yoffset);
744 __GLX_PUT_LONG(20,zoffset);
745 __GLX_PUT_LONG(24,x);
746 __GLX_PUT_LONG(28,y);
747 __GLX_PUT_LONG(32,width);
748 __GLX_PUT_LONG(36,height);
749 __GLX_END(40);
750 }
751
752 void __indirect_glWindowPos2dARB(GLdouble x, GLdouble y)
753 {
754 __indirect_glWindowPos3fARB(x, y, 0.0);
755 }
756
757 void __indirect_glWindowPos2iARB(GLint x, GLint y)
758 {
759 __indirect_glWindowPos3fARB(x, y, 0.0);
760 }
761
762 void __indirect_glWindowPos2fARB(GLfloat x, GLfloat y)
763 {
764 __indirect_glWindowPos3fARB(x, y, 0.0);
765 }
766
767 void __indirect_glWindowPos2sARB(GLshort x, GLshort y)
768 {
769 __indirect_glWindowPos3fARB(x, y, 0.0);
770 }
771
772 void __indirect_glWindowPos2dvARB(const GLdouble * p)
773 {
774 __indirect_glWindowPos3fARB(p[0], p[1], 0.0);
775 }
776
777 void __indirect_glWindowPos2fvARB(const GLfloat * p)
778 {
779 __indirect_glWindowPos3fARB(p[0], p[1], 0.0);
780 }
781
782 void __indirect_glWindowPos2ivARB(const GLint * p)
783 {
784 __indirect_glWindowPos3fARB(p[0], p[1], 0.0);
785 }
786
787 void __indirect_glWindowPos2svARB(const GLshort * p)
788 {
789 __indirect_glWindowPos3fARB(p[0], p[1], 0.0);
790 }
791
792 void __indirect_glWindowPos3dARB(GLdouble x, GLdouble y, GLdouble z)
793 {
794 __indirect_glWindowPos3fARB(x, y, z);
795 }
796
797 void __indirect_glWindowPos3iARB(GLint x, GLint y, GLint z)
798 {
799 __indirect_glWindowPos3fARB(x, y, z);
800 }
801
802 void __indirect_glWindowPos3sARB(GLshort x, GLshort y, GLshort z)
803 {
804 __indirect_glWindowPos3fARB(x, y, z);
805 }
806
807 void __indirect_glWindowPos3dvARB(const GLdouble * p)
808 {
809 __indirect_glWindowPos3fARB(p[0], p[1], p[2]);
810 }
811
812 void __indirect_glWindowPos3ivARB(const GLint * p)
813 {
814 __indirect_glWindowPos3fARB(p[0], p[1], p[2]);
815 }
816
817 void __indirect_glWindowPos3svARB(const GLshort * p)
818 {
819 __indirect_glWindowPos3fARB(p[0], p[1], p[2]);
820 }