update source for tizen_2.1
[sdk/emulator/qemu.git] / tizen / src / hw / opengl_func.h
1 /*
2  *  Copyright (c) 2006,2007 Even Rouault
3  *
4  *  Parts written by: 
5  *    Gordon Williams <gordon.williams@collabora.co.uk>
6  *    Ian Molton <ian.molton@collabora.co.uk>
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  */
26
27 #ifndef INCLUDE_OPENGL_FUNC_H
28 #define INCLUDE_OPENGL_FUNC_H
29
30 #include "mesa_gl.h"
31 #include "mesa_glext.h"
32
33 #ifdef TARGET_X86_64
34 #define TARGET_LONG_BITS 64
35 #define TARGET_PHYS_ADDR_BITS 64
36 #else
37 #define TARGET_LONG_BITS 32
38 #define TARGET_PHYS_ADDR_BITS 32
39 #endif
40
41 //#define NEED_CPU_H
42 //#include "exec.h"  // For arg_t typedef
43 //#undef NEED_CPU_H
44 #include "targphys.h"
45
46 /* Argument list are internally of a type that can hold a target pointer
47  * or a host pointer.  */
48 typedef target_phys_addr_t arg_t;
49
50 enum {
51     TYPE_NONE,
52     TYPE_CHAR,
53     TYPE_UNSIGNED_CHAR,
54     TYPE_SHORT,
55     TYPE_UNSIGNED_SHORT,
56     TYPE_INT,
57     TYPE_UNSIGNED_INT,
58     TYPE_FLOAT,
59     TYPE_DOUBLE,
60     TYPE_1CHAR,
61     TYPE_2CHAR,
62     TYPE_3CHAR,
63     TYPE_4CHAR,
64     TYPE_128UCHAR,
65     TYPE_1SHORT,
66     TYPE_2SHORT,
67     TYPE_3SHORT,
68     TYPE_4SHORT,
69     TYPE_1INT,
70     TYPE_2INT,
71     TYPE_3INT,
72     TYPE_4INT,
73     TYPE_1FLOAT,
74     TYPE_2FLOAT,
75     TYPE_3FLOAT,
76     TYPE_4FLOAT,
77     TYPE_16FLOAT,
78     TYPE_1DOUBLE,
79     TYPE_2DOUBLE,
80     TYPE_3DOUBLE,
81     TYPE_4DOUBLE,
82     TYPE_16DOUBLE,
83     TYPE_OUT_1INT,
84     TYPE_OUT_1FLOAT,
85     TYPE_OUT_4CHAR,
86     TYPE_OUT_4INT,
87     TYPE_OUT_4FLOAT,
88     TYPE_OUT_4DOUBLE,
89     TYPE_OUT_128UCHAR,
90     TYPE_CONST_CHAR,
91     TYPE_ARRAY_CHAR,
92     TYPE_ARRAY_SHORT,
93     TYPE_ARRAY_INT,
94     TYPE_ARRAY_FLOAT,
95     TYPE_ARRAY_DOUBLE,
96     TYPE_IN_IGNORED_POINTER,
97     TYPE_OUT_ARRAY_CHAR,
98     TYPE_OUT_ARRAY_SHORT,
99     TYPE_OUT_ARRAY_INT,
100     TYPE_OUT_ARRAY_FLOAT,
101     TYPE_OUT_ARRAY_DOUBLE,
102     TYPE_NULL_TERMINATED_STRING,
103
104     TYPE_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
105     TYPE_ARRAY_SHORT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
106     TYPE_ARRAY_INT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
107     TYPE_ARRAY_FLOAT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
108     TYPE_ARRAY_DOUBLE_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
109     TYPE_OUT_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
110     TYPE_OUT_ARRAY_SHORT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
111     TYPE_OUT_ARRAY_INT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
112     TYPE_OUT_ARRAY_FLOAT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
113     TYPE_OUT_ARRAY_DOUBLE_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
114     /* .... */
115     TYPE_LAST,
116     /* .... */
117     TYPE_1UCHAR = TYPE_CHAR,
118     TYPE_1USHORT = TYPE_1SHORT,
119     TYPE_1UINT = TYPE_1INT,
120     TYPE_OUT_1UINT = TYPE_OUT_1INT,
121     TYPE_OUT_4UCHAR = TYPE_OUT_4CHAR,
122     TYPE_ARRAY_VOID = TYPE_ARRAY_CHAR,
123     TYPE_ARRAY_SIGNED_CHAR = TYPE_ARRAY_CHAR,
124     TYPE_ARRAY_UNSIGNED_CHAR = TYPE_ARRAY_CHAR,
125     TYPE_ARRAY_UNSIGNED_SHORT = TYPE_ARRAY_SHORT,
126     TYPE_ARRAY_UNSIGNED_INT = TYPE_ARRAY_INT,
127     TYPE_OUT_ARRAY_VOID = TYPE_OUT_ARRAY_CHAR,
128     TYPE_OUT_ARRAY_SIGNED_CHAR = TYPE_OUT_ARRAY_CHAR,
129     TYPE_OUT_ARRAY_UNSIGNED_CHAR = TYPE_OUT_ARRAY_CHAR,
130     TYPE_OUT_ARRAY_UNSIGNED_SHORT = TYPE_OUT_ARRAY_SHORT,
131     TYPE_OUT_ARRAY_UNSIGNED_INT = TYPE_OUT_ARRAY_INT,
132     TYPE_ARRAY_VOID_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS =
133         TYPE_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
134     TYPE_ARRAY_SIGNED_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS =
135         TYPE_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
136     TYPE_ARRAY_UNSIGNED_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS =
137         TYPE_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
138     TYPE_ARRAY_UNSIGNED_SHORT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS =
139         TYPE_ARRAY_SHORT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
140     TYPE_ARRAY_UNSIGNED_INT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS =
141         TYPE_ARRAY_INT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
142     TYPE_OUT_ARRAY_VOID_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS =
143         TYPE_OUT_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
144     TYPE_OUT_ARRAY_SIGNED_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS =
145         TYPE_OUT_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
146     TYPE_OUT_ARRAY_UNSIGNED_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS =
147         TYPE_OUT_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
148     TYPE_OUT_ARRAY_UNSIGNED_SHORT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS =
149         TYPE_OUT_ARRAY_SHORT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
150     TYPE_OUT_ARRAY_UNSIGNED_INT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS =
151         TYPE_OUT_ARRAY_INT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS,
152 };
153
154 #define CASE_IN_LENGTH_DEPENDING_ON_PREVIOUS_ARGS \
155   case TYPE_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS: \
156   case TYPE_ARRAY_SHORT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS: \
157   case TYPE_ARRAY_INT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS: \
158   case TYPE_ARRAY_FLOAT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS: \
159   case TYPE_ARRAY_DOUBLE_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS
160
161 #define CASE_OUT_LENGTH_DEPENDING_ON_PREVIOUS_ARGS \
162   case TYPE_OUT_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS: \
163   case TYPE_OUT_ARRAY_SHORT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS: \
164   case TYPE_OUT_ARRAY_INT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS: \
165   case TYPE_OUT_ARRAY_FLOAT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS: \
166   case TYPE_OUT_ARRAY_DOUBLE_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS
167
168 #define CASE_IN_UNKNOWN_SIZE_POINTERS \
169   case TYPE_ARRAY_CHAR: \
170   case TYPE_ARRAY_SHORT: \
171   case TYPE_ARRAY_INT: \
172   case TYPE_ARRAY_FLOAT: \
173   case TYPE_ARRAY_DOUBLE
174
175 #define CASE_IN_KNOWN_SIZE_POINTERS \
176   case TYPE_1CHAR:\
177   case TYPE_2CHAR:\
178   case TYPE_3CHAR:\
179   case TYPE_4CHAR:\
180   case TYPE_128UCHAR:\
181   case TYPE_1SHORT:\
182   case TYPE_2SHORT:\
183   case TYPE_3SHORT:\
184   case TYPE_4SHORT:\
185   case TYPE_1INT:\
186   case TYPE_2INT:\
187   case TYPE_3INT:\
188   case TYPE_4INT:\
189   case TYPE_1FLOAT:\
190   case TYPE_2FLOAT:\
191   case TYPE_3FLOAT:\
192   case TYPE_4FLOAT:\
193   case TYPE_16FLOAT:\
194   case TYPE_1DOUBLE:\
195   case TYPE_2DOUBLE:\
196   case TYPE_3DOUBLE:\
197   case TYPE_4DOUBLE:\
198   case TYPE_16DOUBLE
199
200 #define CASE_OUT_UNKNOWN_SIZE_POINTERS \
201   case TYPE_OUT_ARRAY_CHAR: \
202   case TYPE_OUT_ARRAY_SHORT: \
203   case TYPE_OUT_ARRAY_INT: \
204   case TYPE_OUT_ARRAY_FLOAT: \
205   case TYPE_OUT_ARRAY_DOUBLE
206
207 #define CASE_OUT_KNOWN_SIZE_POINTERS \
208   case TYPE_OUT_1INT: \
209   case TYPE_OUT_1FLOAT: \
210   case TYPE_OUT_4CHAR: \
211   case TYPE_OUT_4INT: \
212   case TYPE_OUT_4FLOAT: \
213   case TYPE_OUT_4DOUBLE: \
214   case TYPE_OUT_128UCHAR \
215
216 #define CASE_IN_POINTERS CASE_IN_UNKNOWN_SIZE_POINTERS: CASE_IN_KNOWN_SIZE_POINTERS: CASE_IN_LENGTH_DEPENDING_ON_PREVIOUS_ARGS
217 #define CASE_OUT_POINTERS CASE_OUT_UNKNOWN_SIZE_POINTERS: CASE_OUT_KNOWN_SIZE_POINTERS: CASE_OUT_LENGTH_DEPENDING_ON_PREVIOUS_ARGS
218
219 #define CASE_POINTERS CASE_IN_POINTERS: CASE_OUT_POINTERS
220 #define CASE_KNOWN_SIZE_POINTERS CASE_IN_KNOWN_SIZE_POINTERS: CASE_OUT_KNOWN_SIZE_POINTERS
221
222
223 #define IS_ARRAY_CHAR(type)  (type == TYPE_ARRAY_CHAR || type == TYPE_1CHAR || type == TYPE_2CHAR || type == TYPE_3CHAR || type == TYPE_4CHAR || type == TYPE_ARRAY_CHAR_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS)
224 #define IS_ARRAY_SHORT(type)  (type == TYPE_ARRAY_SHORT || type == TYPE_1SHORT || type == TYPE_2SHORT || type == TYPE_3SHORT || type == TYPE_4SHORT || type == TYPE_ARRAY_SHORT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS)
225 #define IS_ARRAY_INT(type)  (type == TYPE_ARRAY_INT || type == TYPE_1INT || type == TYPE_2INT || type == TYPE_3INT || type == TYPE_4INT || type == TYPE_ARRAY_INT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS)
226 #define IS_ARRAY_FLOAT(type)  (type == TYPE_ARRAY_FLOAT || type == TYPE_1FLOAT || type == TYPE_2FLOAT || type == TYPE_3FLOAT || type == TYPE_4FLOAT || type == TYPE_16FLOAT || type == TYPE_ARRAY_FLOAT_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS)
227 #define IS_ARRAY_DOUBLE(type)  (type == TYPE_ARRAY_DOUBLE || type == TYPE_1DOUBLE || type == TYPE_2DOUBLE || type == TYPE_3DOUBLE || type == TYPE_4DOUBLE || type == TYPE_16DOUBLE || type == TYPE_ARRAY_DOUBLE_OF_LENGTH_DEPENDING_ON_PREVIOUS_ARGS)
228
229 #define NB_MAX_TEXTURES 16
230 #define MY_GL_MAX_VERTEX_ATTRIBS_ARB 16
231 #define MY_GL_MAX_VERTEX_ATTRIBS_NV 16
232 #define MY_GL_MAX_VARIANT_POINTER_EXT 16
233
234 typedef struct {
235     int ret_type;
236     int has_out_parameters;
237     int nb_args;
238     int args_type[0];
239 } Signature;
240
241 static const int _init32_signature[] =
242     { TYPE_NONE, 1, 3, TYPE_INT, TYPE_INT, TYPE_OUT_1INT };
243 static const int _init64_signature[] =
244     { TYPE_NONE, 1, 3, TYPE_INT, TYPE_INT, TYPE_OUT_1INT };
245
246 static const int _resize_surface_signature[] =
247     {TYPE_NONE, 0, 3, TYPE_INT, TYPE_INT, TYPE_INT};
248
249 static const int _render_surface_signature[] =
250     {TYPE_NONE, 1, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_OUT_ARRAY_CHAR};
251
252 /* XVisualInfo* glXChooseVisual( Display *dpy, int screen, int *attribList ) */
253 static const int glXChooseVisual_signature[] =
254     { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_ARRAY_INT };
255
256 /*GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
257                              GLXContext shareList, Bool direct )*/
258 static const int glXCreateContext_signature[] =
259     { TYPE_INT, 0, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT, TYPE_INT };
260
261 static const int glXCopyContext_signature[] =
262     { TYPE_NONE, 0, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT,
263 TYPE_INT };
264
265 /* void glXDestroyContext( Display *dpy, GLXContext ctx ) */
266 static const int glXDestroyContext_signature[] =
267     { TYPE_NONE, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
268
269 /* Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx) */
270 /* making it asynchronous */
271 static const int glXMakeCurrent_signature[] =
272     { TYPE_NONE, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
273
274 /*int glXGetConfig( Display *dpy, XVisualInfo *visual,
275                   int attrib, int *value )*/
276 static const int glXGetConfig_signature[] =
277     { TYPE_INT, 1, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT,
278 TYPE_OUT_1INT };
279
280 /* "glXGetConfig_extended"(dpy, visual_id, int n, int* attribs, int* values, int* rets) */
281 static const int glXGetConfig_extended_signature[] =
282     { TYPE_NONE, 1, 6, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT,
283 TYPE_ARRAY_INT, TYPE_OUT_ARRAY_INT, TYPE_OUT_ARRAY_INT };
284
285 /* void glXSwapBuffers( Display *dpy, GLXDrawable drawable ); */
286 static const int glXSwapBuffers_signature[] =
287     { TYPE_NONE, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
288
289 /* Bool glXQueryVersion( Display *dpy, int *maj, int *min ) */
290 static const int glXQueryVersion_signature[] =
291     { TYPE_INT, 1, 3, TYPE_IN_IGNORED_POINTER, TYPE_OUT_1INT, TYPE_OUT_1INT };
292
293 /* Bool glXQueryExtension( Display *dpy, int *errorBase, int *eventBase ) */
294 static const int glXQueryExtension_signature[] =
295     { TYPE_INT, 1, 3, TYPE_IN_IGNORED_POINTER, TYPE_OUT_1INT, TYPE_OUT_1INT };
296
297 static const int glXWaitGL_signature[] = { TYPE_INT, 0, 0 };
298 static const int glXWaitX_signature[] = { TYPE_INT, 0, 0 };
299
300 /* GLX 1.1 and later */
301
302 /* const char *glXGetClientString( Display *dpy, int name ) */
303 static const int glXGetClientString_signature[] =
304     { TYPE_CONST_CHAR, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
305
306 /*const char *glXQueryExtensionsString( Display *dpy, int screen ) */
307 static const int glXQueryExtensionsString_signature[] =
308     { TYPE_CONST_CHAR, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
309
310 /* const char *glXQueryServerString( Display *dpy, int screen, int name ) */
311 static const int glXQueryServerString_signature[] =
312     { TYPE_CONST_CHAR, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
313
314
315 static const int glXGetProcAddress_fake_signature[] =
316     { TYPE_INT, 0, 1, TYPE_NULL_TERMINATED_STRING };
317
318 static const int glXGetProcAddress_global_fake_signature[] =
319     { TYPE_NONE, 1, 3, TYPE_INT, TYPE_ARRAY_CHAR, TYPE_OUT_ARRAY_CHAR };
320
321
322 /* GLX 1.3 and later */
323
324 /*
325 GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen,
326                                        const int *attribList, int *nitems ); */
327 static const int glXChooseFBConfig_signature[] =
328     { TYPE_INT, 1, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_ARRAY_INT,
329 TYPE_OUT_1INT };
330
331 static const int glXChooseFBConfigSGIX_signature[] =
332     { TYPE_INT, 1, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_ARRAY_INT,
333 TYPE_OUT_1INT };
334
335 static const int glXGetFBConfigs_signature[] =
336     { TYPE_INT, 1, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_OUT_1INT };
337
338 /* "glXGetFBConfigAttrib_extended"(dpy, fbconfig, int n, int* attribs, int* values, int* rets) */
339 static const int glXGetFBConfigAttrib_extended_signature[] =
340     { TYPE_NONE, 1, 6, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT,
341 TYPE_ARRAY_INT, TYPE_OUT_ARRAY_INT, TYPE_OUT_ARRAY_INT };
342
343
344 /* GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
345                              const int *attribList ) */
346 static const int glXCreatePbuffer_signature[] =
347     { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_ARRAY_INT };
348
349 static const int glXCreateGLXPbufferSGIX_signature[] =
350     { TYPE_INT, 0, 5, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT, TYPE_INT,
351 TYPE_ARRAY_INT };
352
353 static const int glXDestroyPbuffer_signature[] =
354     { TYPE_NONE, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
355
356 static const int glXDestroyGLXPbufferSGIX_signature[] =
357     { TYPE_NONE, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
358
359 /* GLXContext glXCreateNewContext(Display * dpy
360                                GLXFBConfig  config
361                                int  renderType
362                                GLXContext  ShareList
363                                Bool  Direct) */
364 static const int glXCreateNewContext_signature[] =
365     { TYPE_INT, 0, 5, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT, TYPE_INT,
366 TYPE_INT };
367
368 static const int glXCreateContextWithConfigSGIX_signature[] =
369     { TYPE_INT, 0, 5, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT, TYPE_INT,
370 TYPE_INT };
371
372 /*XVisualInfo *glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) */
373 static const int glXGetVisualFromFBConfig_signature[] =
374     { TYPE_INT, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
375
376 /*int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig  config, int attribute, int *value)*/
377 static const int glXGetFBConfigAttrib_signature[] =
378     { TYPE_INT, 1, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT,
379 TYPE_OUT_1INT };
380
381 static const int glXGetFBConfigAttribSGIX_signature[] =
382     { TYPE_INT, 1, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT,
383 TYPE_OUT_1INT };
384
385 static const int glXQueryContext_signature[] =
386     { TYPE_INT, 1, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT,
387 TYPE_OUT_1INT };
388
389 static const int glXQueryGLXPbufferSGIX_signature[] =
390     { TYPE_INT, 1, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT,
391 TYPE_OUT_1INT };
392
393 static const int glXQueryDrawable_signature[] =
394     { TYPE_NONE, 1, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT,
395 TYPE_OUT_1INT };
396
397 /* void glXUseXFont( Font font, int first, int count, int list ) */
398 static const int glXUseXFont_signature[] =
399     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT };
400
401 /* Bool glXIsDirect( Display *dpy, GLXContext ctx ) */
402 static const int glXIsDirect_signature[] =
403     { TYPE_CHAR, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
404
405 static const int glXGetScreenDriver_signature[] =
406     { TYPE_CONST_CHAR, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
407
408 static const int glXGetDriverConfig_signature[] =
409     { TYPE_CONST_CHAR, 0, 1, TYPE_NULL_TERMINATED_STRING };
410
411
412 static const int glXWaitVideoSyncSGI_signature[] =
413     { TYPE_INT, 1, 3, TYPE_INT, TYPE_INT, TYPE_OUT_1INT };
414
415 static const int glXGetVideoSyncSGI_signature[] =
416     { TYPE_INT, 1, 1, TYPE_OUT_1INT };
417
418 static const int glXSwapIntervalSGI_signature[] =
419     { TYPE_INT, 0, 1, TYPE_INT };
420
421 static const int glXCreatePixmap_signature[] =
422     { TYPE_INT, 0, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT, TYPE_ARRAY_INT };
423
424 static const int glXDestroyPixmap_signature[] =
425     { TYPE_NONE, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
426
427 static const int glXBindTexImageATI_signature[] =
428     { TYPE_NONE, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
429 static const int glXReleaseTexImageATI_signature[] =
430     { TYPE_NONE, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
431 static const int glXBindTexImageARB_fake_signature[] =
432     { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
433 static const int glXReleaseTexImageARB_fake_signature[] =
434     { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
435
436 static const int glEGLImageTargetTexture2DOES_fake_signature[] =
437     { TYPE_NONE, 0, 2, TYPE_UNSIGNED_INT, TYPE_INT };
438
439 /* const GLubyte * glGetString( GLenum name ) */
440 static const int glGetString_signature[] =
441     { TYPE_CONST_CHAR, 0, 1, TYPE_INT };
442
443 /* void glShaderSourceARB (GLhandleARB handle , GLsizei size, const GLcharARB* *p_tab_prog, const GLint * tab_length) */
444 /* --> void glShaderSourceARB (GLhandleARB handle , GLsizei size, const GLcharARB* all_progs, const GLint * tab_length) */
445 static const int glShaderSourceARB_fake_signature[] =
446     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR, TYPE_ARRAY_INT };
447 static const int glShaderSource_fake_signature[] =
448     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR, TYPE_ARRAY_INT };
449
450 static const int glVertexPointer_fake_signature[] =
451     { TYPE_NONE, 0, 6, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
452 TYPE_ARRAY_CHAR };
453 static const int glNormalPointer_fake_signature[] =
454     { TYPE_NONE, 0, 5, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
455 TYPE_ARRAY_CHAR };
456 static const int glColorPointer_fake_signature[] =
457     { TYPE_NONE, 0, 6, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
458 TYPE_ARRAY_CHAR };
459 static const int glSecondaryColorPointer_fake_signature[] =
460     { TYPE_NONE, 0, 6, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
461 TYPE_ARRAY_CHAR };
462 static const int glIndexPointer_fake_signature[] =
463     { TYPE_NONE, 0, 5, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
464 TYPE_ARRAY_CHAR };
465 static const int glTexCoordPointer_fake_signature[] =
466     { TYPE_NONE, 0, 7, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
467 TYPE_INT, TYPE_ARRAY_CHAR };
468 static const int glEdgeFlagPointer_fake_signature[] =
469     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
470 static const int glVertexAttribPointerARB_fake_signature[] =
471     { TYPE_NONE, 0, 8, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
472 TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
473 static const int glVertexAttribPointerNV_fake_signature[] =
474     { TYPE_NONE, 0, 7, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
475 TYPE_INT, TYPE_ARRAY_CHAR };
476 static const int glWeightPointerARB_fake_signature[] =
477     { TYPE_NONE, 0, 6, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
478 TYPE_ARRAY_CHAR };
479 static const int glMatrixIndexPointerARB_fake_signature[] =
480     { TYPE_NONE, 0, 6, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
481 TYPE_ARRAY_CHAR };
482 static const int glFogCoordPointer_fake_signature[] =
483     { TYPE_NONE, 0, 5, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
484 TYPE_ARRAY_CHAR };
485 static const int glInterleavedArrays_fake_signature[] =
486     { TYPE_NONE, 0, 5, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
487 TYPE_ARRAY_CHAR };
488 static const int glElementPointerATI_fake_signature[] =
489     { TYPE_NONE, 0, 3, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
490 static const int glVariantPointerEXT_fake_signature[] =
491     { TYPE_NONE, 0, 6, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
492 TYPE_ARRAY_CHAR };
493 static const int glTuxRacerDrawElements_fake_signature[] =
494     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
495 static const int glVertexAndNormalPointer_fake_signature[] =
496     { TYPE_NONE, 0, 7, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
497 TYPE_INT, TYPE_ARRAY_CHAR };
498 static const int glTexCoordPointer01_fake_signature[] =
499     { TYPE_NONE, 0, 5, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
500 TYPE_ARRAY_CHAR };
501 static const int glTexCoordPointer012_fake_signature[] =
502     { TYPE_NONE, 0, 5, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
503 TYPE_ARRAY_CHAR };
504 static const int glVertexNormalPointerInterlaced_fake_signature[] =
505     { TYPE_NONE, 0, 8, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
506 TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
507 static const int glVertexNormalColorPointerInterlaced_fake_signature[] =
508     { TYPE_NONE, 0, 11, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
509 TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
510 static const int glVertexColorTexCoord0PointerInterlaced_fake_signature[] =
511     { TYPE_NONE, 0, 12, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
512 TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
513 static const int glVertexNormalTexCoord0PointerInterlaced_fake_signature[] =
514     { TYPE_NONE, 0, 11, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
515 TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
516 static const int glVertexNormalTexCoord01PointerInterlaced_fake_signature[] =
517     { TYPE_NONE, 0, 14, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
518 TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
519 static const int glVertexNormalTexCoord012PointerInterlaced_fake_signature[] =
520     { TYPE_NONE, 0, 17, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
521 TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
522 static const int
523     glVertexNormalColorTexCoord0PointerInterlaced_fake_signature[] =
524     { TYPE_NONE, 0, 14, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
525 TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
526 TYPE_ARRAY_CHAR };
527 static const int
528     glVertexNormalColorTexCoord01PointerInterlaced_fake_signature[] =
529     { TYPE_NONE, 0, 17, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
530 TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
531 TYPE_INT, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
532 static const int
533     glVertexNormalColorTexCoord012PointerInterlaced_fake_signature[] =
534     { TYPE_NONE, 0, 20, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
535 TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
536 TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_ARRAY_CHAR };
537
538 static const int glGenTextures_fake_signature[] =
539     { TYPE_NONE, 0, 1, TYPE_INT };
540 static const int glGenBuffersARB_fake_signature[] =
541     { TYPE_NONE, 0, 1, TYPE_INT };
542 static const int glGenLists_fake_signature[] = { TYPE_NONE, 0, 1, TYPE_INT };
543
544 static const int _glDrawElements_buffer_signature[] =
545     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT };
546 static const int _glDrawRangeElements_buffer_signature[] =
547     { TYPE_NONE, 0, 6, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
548 TYPE_INT };
549 static const int _glMultiDrawElements_buffer_signature[] =
550     { TYPE_NONE, 0, 5, TYPE_INT, TYPE_ARRAY_INT, TYPE_INT, TYPE_ARRAY_INT,
551 TYPE_INT };
552
553 static const int _glVertexPointer_buffer_signature[] =
554     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT };
555 static const int _glNormalPointer_buffer_signature[] =
556     { TYPE_NONE, 0, 3, TYPE_INT, TYPE_INT, TYPE_INT };
557 static const int _glColorPointer_buffer_signature[] =
558     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT };
559 static const int _glSecondaryColorPointer_buffer_signature[] =
560     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT };
561 static const int _glIndexPointer_buffer_signature[] =
562     { TYPE_NONE, 0, 3, TYPE_INT, TYPE_INT, TYPE_INT };
563 static const int _glTexCoordPointer_buffer_signature[] =
564     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT };
565 static const int _glEdgeFlagPointer_buffer_signature[] =
566     { TYPE_NONE, 0, 2, TYPE_INT, TYPE_INT };
567 static const int _glVertexAttribPointerARB_buffer_signature[] =
568     { TYPE_NONE, 0, 6, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
569 TYPE_INT };
570 static const int _glWeightPointerARB_buffer_signature[] =
571     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT };
572 static const int _glMatrixIndexPointerARB_buffer_signature[] =
573     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT };
574 static const int _glFogCoordPointer_buffer_signature[] =
575     { TYPE_NONE, 0, 3, TYPE_INT, TYPE_INT, TYPE_INT };
576 static const int _glVariantPointerEXT_buffer_signature[] =
577     { TYPE_NONE, 0, 4, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT };
578
579 static const int _glReadPixels_pbo_signature[] =
580     { TYPE_INT, 0, 7, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT,
581 TYPE_INT, TYPE_INT };
582 static const int _glDrawPixels_pbo_signature[] =
583     { TYPE_NONE, 0, 5, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT };
584 static const int _glMapBufferARB_fake_signature[] =
585     { TYPE_INT, 1, 3, TYPE_INT, TYPE_INT, TYPE_OUT_ARRAY_CHAR };
586
587 static const int _glSelectBuffer_fake_signature[] =
588     { TYPE_NONE, 0, 1, TYPE_INT };
589 static const int _glGetSelectBuffer_fake_signature[] =
590     { TYPE_NONE, 1, 1, TYPE_ARRAY_CHAR };
591 static const int _glFeedbackBuffer_fake_signature[] =
592     { TYPE_NONE, 0, 2, TYPE_INT, TYPE_INT };
593 static const int _glGetFeedbackBuffer_fake_signature[] =
594     { TYPE_NONE, 1, 1, TYPE_ARRAY_CHAR };
595
596 static const int _glGetError_fake_signature[] = { TYPE_NONE, 0, 0 };
597
598 #include "gl_func.h"
599
600 #define IS_NULL_POINTER_OK_FOR_FUNC(func_number) \
601                  (func_number == glBitmap_func || \
602                   func_number == glTexImage1D_func || \
603                   func_number == glTexImage2D_func || \
604                   func_number == glTexImage3D_func || \
605                   func_number == glBufferDataARB_func || \
606                   func_number == glNewObjectBufferATI_func)
607
608 #endif // INCLUDE_OPENGL_FUNC_H
609