1 | # Copyright (c) 2001, Stanford University
|
---|
2 | # All rights reserved.
|
---|
3 | #
|
---|
4 | # See the file LICENSE.txt for information on redistributing this software.
|
---|
5 |
|
---|
6 | import sys
|
---|
7 |
|
---|
8 | import apiutil
|
---|
9 |
|
---|
10 | apiutil.CopyrightC()
|
---|
11 |
|
---|
12 | print """
|
---|
13 | /* DO NOT EDIT - THIS FILE GENERATED BY THE getprocaddress.py SCRIPT */
|
---|
14 |
|
---|
15 | #include "chromium.h"
|
---|
16 | #include "cr_error.h"
|
---|
17 | #include "cr_string.h"
|
---|
18 | #include "cr_version.h"
|
---|
19 | #include "stub.h"
|
---|
20 | #include "dri_glx.h"
|
---|
21 | #if defined(VBOXOGL_DRI) || defined(VBOXOGL_FAKEDRI)
|
---|
22 | #include "cr_gl.h"
|
---|
23 | #include "fakedri_drv.h"
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | struct name_address {
|
---|
27 | const char *name;
|
---|
28 | CR_PROC address;
|
---|
29 | };
|
---|
30 |
|
---|
31 | static struct name_address functions[] = {
|
---|
32 | """
|
---|
33 |
|
---|
34 |
|
---|
35 | keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
36 | for func_name in keys:
|
---|
37 | if "Chromium" == apiutil.Category(func_name):
|
---|
38 | continue
|
---|
39 | if func_name == "BoundsInfoCR":
|
---|
40 | continue
|
---|
41 | if "GL_chromium" == apiutil.Category(func_name):
|
---|
42 | pass #continue
|
---|
43 |
|
---|
44 | wrap = apiutil.GetCategoryWrapper(func_name)
|
---|
45 | name = "gl" + func_name
|
---|
46 | address = "VBOXGLTAG(gl" + func_name + ")"
|
---|
47 | if wrap:
|
---|
48 | print '#ifdef CR_%s' % wrap
|
---|
49 | print '\t{ "%s", (CR_PROC) %s },' % (name, address)
|
---|
50 | if wrap:
|
---|
51 | print '#endif'
|
---|
52 |
|
---|
53 |
|
---|
54 | print "\t/* Chromium binding/glue functions */"
|
---|
55 |
|
---|
56 | for func_name in keys:
|
---|
57 | if (func_name == "Writeback" or
|
---|
58 | func_name == "BoundsInfoCR" or
|
---|
59 | func_name == "GetUniformsLocations"):
|
---|
60 | continue
|
---|
61 | if apiutil.Category(func_name) == "Chromium":
|
---|
62 | print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
|
---|
63 |
|
---|
64 |
|
---|
65 | print """
|
---|
66 | { NULL, NULL }
|
---|
67 | };
|
---|
68 |
|
---|
69 | CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
|
---|
70 | {
|
---|
71 | int i;
|
---|
72 | stubInit();
|
---|
73 |
|
---|
74 | for (i = 0; functions[i].name; i++) {
|
---|
75 | if (crStrcmp(name, functions[i].name) == 0) {
|
---|
76 | return functions[i].address;
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 |
|
---|
81 | #define GLXAPI_ENTRY(Func) if (!crStrcmp(name, "glX"#Func)) return (CR_PROC) &VBOXGLXENTRYTAG(glX##Func);
|
---|
82 | #include "fakedri_glxfuncsList.h"
|
---|
83 | #undef GLXAPI_ENTRY
|
---|
84 |
|
---|
85 | /*CR_EXT_texture_from_pixmap*/
|
---|
86 | if (!crStrcmp( name, "glXBindTexImageEXT" )) return (CR_PROC) VBOXGLXTAG(glXBindTexImageEXT);
|
---|
87 | if (!crStrcmp( name, "glXReleaseTexImageEXT" )) return (CR_PROC) VBOXGLXTAG(glXReleaseTexImageEXT);
|
---|
88 |
|
---|
89 | if (name) crDebug("Returning NULL for %s", name);
|
---|
90 | return NULL;
|
---|
91 | }
|
---|
92 |
|
---|
93 | """
|
---|
94 |
|
---|
95 |
|
---|
96 |
|
---|
97 | # XXX should crGetProcAddress really handle WGL/GLX functions???
|
---|
98 |
|
---|
99 | print_foo = """
|
---|
100 | /* As these are Windows specific (i.e. wgl), define these now.... */
|
---|
101 | #ifdef WINDOWS
|
---|
102 | {
|
---|
103 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
|
---|
104 | wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
|
---|
105 | wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
|
---|
106 | wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
|
---|
107 | if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
|
---|
108 | if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
|
---|
109 | if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
|
---|
110 | if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
|
---|
111 | }
|
---|
112 | #endif
|
---|
113 | """
|
---|