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 "VBox" == apiutil.Category(func_name):
|
---|
40 | continue
|
---|
41 | if func_name == "BoundsInfoCR":
|
---|
42 | continue
|
---|
43 | if "GL_chromium" == apiutil.Category(func_name):
|
---|
44 | pass #continue
|
---|
45 |
|
---|
46 | wrap = apiutil.GetCategoryWrapper(func_name)
|
---|
47 | name = "gl" + func_name
|
---|
48 | address = "VBOXGLTAG(gl" + func_name + ")"
|
---|
49 | if wrap:
|
---|
50 | print '#ifdef CR_%s' % wrap
|
---|
51 | print '\t{ "%s", (CR_PROC) %s },' % (name, address)
|
---|
52 | if wrap:
|
---|
53 | print '#endif'
|
---|
54 |
|
---|
55 |
|
---|
56 | print "\t/* Chromium binding/glue functions */"
|
---|
57 |
|
---|
58 | for func_name in keys:
|
---|
59 | if (func_name == "Writeback" or
|
---|
60 | func_name == "BoundsInfoCR" or
|
---|
61 | func_name == "GetUniformsLocations" or
|
---|
62 | func_name == "GetAttribsLocations"):
|
---|
63 | continue
|
---|
64 | if apiutil.Category(func_name) == "Chromium":
|
---|
65 | print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
|
---|
66 |
|
---|
67 |
|
---|
68 | print """
|
---|
69 | { NULL, NULL }
|
---|
70 | };
|
---|
71 |
|
---|
72 | CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
|
---|
73 | {
|
---|
74 | int i;
|
---|
75 | stubInit();
|
---|
76 |
|
---|
77 | for (i = 0; functions[i].name; i++) {
|
---|
78 | if (crStrcmp(name, functions[i].name) == 0) {
|
---|
79 | return functions[i].address;
|
---|
80 | }
|
---|
81 | }
|
---|
82 |
|
---|
83 |
|
---|
84 | #define GLXAPI_ENTRY(Func) if (!crStrcmp(name, "glX"#Func)) return (CR_PROC) &VBOXGLXENTRYTAG(glX##Func);
|
---|
85 | #include "fakedri_glxfuncsList.h"
|
---|
86 | #undef GLXAPI_ENTRY
|
---|
87 |
|
---|
88 | /*CR_EXT_texture_from_pixmap*/
|
---|
89 | if (!crStrcmp( name, "glXBindTexImageEXT" )) return (CR_PROC) VBOXGLXTAG(glXBindTexImageEXT);
|
---|
90 | if (!crStrcmp( name, "glXReleaseTexImageEXT" )) return (CR_PROC) VBOXGLXTAG(glXReleaseTexImageEXT);
|
---|
91 |
|
---|
92 | #if defined(Linux) && defined(CR_EXT_framebuffer_blit)
|
---|
93 | /* Hacky way to make gnome3 happy on ubuntu 11.04, even though glBlitFramebuffer is part of OpenGL 3.0 spec,
|
---|
94 | * it expects to find glBlitFramebuffer and not glBlitFramebufferEXT after checking for EXT_framebuffer_blit support.
|
---|
95 | * Untill 3.0 support, it's better to go this way instead of adding an alias to src/VBox/GuestHost/OpenGL/glapi_parser/apispec.txt.
|
---|
96 | */
|
---|
97 | if (!crStrcmp(name, "glBlitFramebuffer")) return crGetProcAddress("glBlitFramebufferEXT");
|
---|
98 | #endif
|
---|
99 |
|
---|
100 | if (name) crDebug("Returning NULL for %s", name);
|
---|
101 | return NULL;
|
---|
102 | }
|
---|
103 |
|
---|
104 | """
|
---|
105 |
|
---|
106 |
|
---|
107 |
|
---|
108 | # XXX should crGetProcAddress really handle WGL/GLX functions???
|
---|
109 |
|
---|
110 | print_foo = """
|
---|
111 | /* As these are Windows specific (i.e. wgl), define these now.... */
|
---|
112 | #ifdef WINDOWS
|
---|
113 | {
|
---|
114 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
|
---|
115 | wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
|
---|
116 | wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
|
---|
117 | wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
|
---|
118 | if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
|
---|
119 | if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
|
---|
120 | if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
|
---|
121 | if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
|
---|
122 | }
|
---|
123 | #endif
|
---|
124 | """
|
---|