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 | from __future__ import print_function
|
---|
7 | import sys
|
---|
8 |
|
---|
9 | import apiutil
|
---|
10 |
|
---|
11 | apiutil.CopyrightC()
|
---|
12 |
|
---|
13 | print("""
|
---|
14 | /* DO NOT EDIT - THIS FILE GENERATED BY THE getprocaddress.py SCRIPT */
|
---|
15 |
|
---|
16 | #include "chromium.h"
|
---|
17 | #include "cr_error.h"
|
---|
18 | #include "cr_string.h"
|
---|
19 | #include "cr_version.h"
|
---|
20 | #include "stub.h"
|
---|
21 | #include "dri_glx.h"
|
---|
22 | #if defined(VBOXOGL_DRI) || defined(VBOXOGL_FAKEDRI)
|
---|
23 | #include "cr_gl.h"
|
---|
24 | #include "fakedri_drv.h"
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | struct name_address {
|
---|
28 | const char *name;
|
---|
29 | CR_PROC address;
|
---|
30 | };
|
---|
31 |
|
---|
32 | static struct name_address functions[] = {
|
---|
33 | """)
|
---|
34 |
|
---|
35 |
|
---|
36 | keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
37 | for func_name in keys:
|
---|
38 | if "Chromium" == apiutil.Category(func_name):
|
---|
39 | continue
|
---|
40 | if "VBox" == apiutil.Category(func_name):
|
---|
41 | continue
|
---|
42 | if func_name == "BoundsInfoCR":
|
---|
43 | continue
|
---|
44 | if "GL_chromium" == apiutil.Category(func_name):
|
---|
45 | pass #continue
|
---|
46 |
|
---|
47 | wrap = apiutil.GetCategoryWrapper(func_name)
|
---|
48 | name = "gl" + func_name
|
---|
49 | address = "VBOXGLTAG(gl" + func_name + ")"
|
---|
50 | if wrap:
|
---|
51 | print('#ifdef CR_%s' % wrap)
|
---|
52 | print('\t{ "%s", (CR_PROC) %s },' % (name, address))
|
---|
53 | if wrap:
|
---|
54 | print('#endif')
|
---|
55 |
|
---|
56 |
|
---|
57 | print("\t/* Chromium binding/glue functions */")
|
---|
58 |
|
---|
59 | for func_name in keys:
|
---|
60 | if (func_name == "Writeback" or
|
---|
61 | func_name == "BoundsInfoCR" or
|
---|
62 | func_name == "GetUniformsLocations" or
|
---|
63 | func_name == "GetAttribsLocations"):
|
---|
64 | continue
|
---|
65 | if apiutil.Category(func_name) == "Chromium":
|
---|
66 | print('\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name))
|
---|
67 |
|
---|
68 |
|
---|
69 | print("""
|
---|
70 | { NULL, NULL }
|
---|
71 | };
|
---|
72 |
|
---|
73 | CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
|
---|
74 | {
|
---|
75 | int i;
|
---|
76 | stubInit();
|
---|
77 |
|
---|
78 | for (i = 0; functions[i].name; i++) {
|
---|
79 | if (crStrcmp(name, functions[i].name) == 0) {
|
---|
80 | return functions[i].address;
|
---|
81 | }
|
---|
82 | }
|
---|
83 |
|
---|
84 |
|
---|
85 | #define GLXAPI_ENTRY(Func) if (!crStrcmp(name, "glX"#Func)) return (CR_PROC) &VBOXGLXENTRYTAG(glX##Func);
|
---|
86 | #include "fakedri_glxfuncsList.h"
|
---|
87 | #undef GLXAPI_ENTRY
|
---|
88 |
|
---|
89 | /*CR_EXT_texture_from_pixmap*/
|
---|
90 | if (!crStrcmp(name, "glXBindTexImageEXT")) return (CR_PROC) VBOXGLXTAG(glXBindTexImageEXT);
|
---|
91 | if (!crStrcmp(name, "glXReleaseTexImageEXT")) return (CR_PROC) VBOXGLXTAG(glXReleaseTexImageEXT);
|
---|
92 |
|
---|
93 | #if defined(Linux) && defined(CR_EXT_framebuffer_blit)
|
---|
94 | /* Hacky way to make gnome3 happy on ubuntu 11.04, even though glBlitFramebuffer is part of OpenGL 3.0 spec,
|
---|
95 | * it expects to find glBlitFramebuffer and not glBlitFramebufferEXT after checking for EXT_framebuffer_blit support.
|
---|
96 | * 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.
|
---|
97 | */
|
---|
98 | if (!crStrcmp(name, "glBlitFramebuffer")) return crGetProcAddress("glBlitFramebufferEXT");
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | if (name) crDebug("Returning NULL for %s", name);
|
---|
102 | return NULL;
|
---|
103 | }
|
---|
104 |
|
---|
105 | """)
|
---|
106 |
|
---|
107 |
|
---|
108 |
|
---|
109 | # XXX should crGetProcAddress really handle WGL/GLX functions???
|
---|
110 |
|
---|
111 | print_foo = """
|
---|
112 | /* As these are Windows specific (i.e. wgl), define these now.... */
|
---|
113 | #ifdef WINDOWS
|
---|
114 | {
|
---|
115 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
|
---|
116 | wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
|
---|
117 | wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
|
---|
118 | wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
|
---|
119 | if (!crStrcmp(name, "wglGetExtensionsStringEXT")) return (CR_PROC) wglGetExtensionsStringEXT;
|
---|
120 | if (!crStrcmp(name, "wglChoosePixelFormatEXT")) return (CR_PROC) wglChoosePixelFormatEXT;
|
---|
121 | if (!crStrcmp(name, "wglGetPixelFormatAttribivEXT")) return (CR_PROC) wglGetPixelFormatAttribivEXT;
|
---|
122 | if (!crStrcmp(name, "wglGetPixelFormatAttribfvEXT")) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
|
---|
123 | }
|
---|
124 | #endif
|
---|
125 | """
|
---|