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"):
|
---|
59 | continue
|
---|
60 | if apiutil.Category(func_name) == "Chromium":
|
---|
61 | print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
|
---|
62 |
|
---|
63 |
|
---|
64 | print """
|
---|
65 | { NULL, NULL }
|
---|
66 | };
|
---|
67 |
|
---|
68 | CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
|
---|
69 | {
|
---|
70 | int i;
|
---|
71 | stubInit();
|
---|
72 |
|
---|
73 | for (i = 0; functions[i].name; i++) {
|
---|
74 | if (crStrcmp(name, functions[i].name) == 0) {
|
---|
75 | return functions[i].address;
|
---|
76 | }
|
---|
77 | }
|
---|
78 |
|
---|
79 |
|
---|
80 | #define GLXAPI_ENTRY(Func) if (!crStrcmp(name, "glX"#Func)) return (CR_PROC) &VBOXGLXENTRYTAG(glX##Func);
|
---|
81 | #include "fakedri_glxfuncsList.h"
|
---|
82 | #undef GLXAPI_ENTRY
|
---|
83 |
|
---|
84 | /*CR_EXT_texture_from_pixmap*/
|
---|
85 | if (!crStrcmp( name, "glXBindTexImageEXT" )) return (CR_PROC) VBOXGLXTAG(glXBindTexImageEXT);
|
---|
86 | if (!crStrcmp( name, "glXReleaseTexImageEXT" )) return (CR_PROC) VBOXGLXTAG(glXReleaseTexImageEXT);
|
---|
87 |
|
---|
88 | if (name) crDebug("Returning NULL for %s", name);
|
---|
89 | return NULL;
|
---|
90 | }
|
---|
91 |
|
---|
92 | """
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 | # XXX should crGetProcAddress really handle WGL/GLX functions???
|
---|
97 |
|
---|
98 | print_foo = """
|
---|
99 | /* As these are Windows specific (i.e. wgl), define these now.... */
|
---|
100 | #ifdef WINDOWS
|
---|
101 | {
|
---|
102 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
|
---|
103 | wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
|
---|
104 | wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
|
---|
105 | wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
|
---|
106 | if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
|
---|
107 | if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
|
---|
108 | if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
|
---|
109 | if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
|
---|
110 | }
|
---|
111 | #endif
|
---|
112 | """
|
---|