VirtualBox

source: vbox/trunk/src/VBox/Additions/common/crOpenGL/getprocaddress.py@ 35263

Last change on this file since 35263 was 30457, checked in by vboxsync, 14 years ago

crOpenGL: build fix

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1# Copyright (c) 2001, Stanford University
2# All rights reserved.
3#
4# See the file LICENSE.txt for information on redistributing this software.
5
6import sys
7
8import apiutil
9
10apiutil.CopyrightC()
11
12print """
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
26struct name_address {
27 const char *name;
28 CR_PROC address;
29};
30
31static struct name_address functions[] = {
32"""
33
34
35keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
36for 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
56print "\t/* Chromium binding/glue functions */"
57
58for func_name in keys:
59 if (func_name == "Writeback" or
60 func_name == "BoundsInfoCR" or
61 func_name == "GetUniformsLocations"):
62 continue
63 if apiutil.Category(func_name) == "Chromium":
64 print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
65
66
67print """
68 { NULL, NULL }
69};
70
71CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
72{
73 int i;
74 stubInit();
75
76 for (i = 0; functions[i].name; i++) {
77 if (crStrcmp(name, functions[i].name) == 0) {
78 return functions[i].address;
79 }
80 }
81
82
83#define GLXAPI_ENTRY(Func) if (!crStrcmp(name, "glX"#Func)) return (CR_PROC) &VBOXGLXENTRYTAG(glX##Func);
84#include "fakedri_glxfuncsList.h"
85#undef GLXAPI_ENTRY
86
87 /*CR_EXT_texture_from_pixmap*/
88 if (!crStrcmp( name, "glXBindTexImageEXT" )) return (CR_PROC) VBOXGLXTAG(glXBindTexImageEXT);
89 if (!crStrcmp( name, "glXReleaseTexImageEXT" )) return (CR_PROC) VBOXGLXTAG(glXReleaseTexImageEXT);
90
91 if (name) crDebug("Returning NULL for %s", name);
92 return NULL;
93}
94
95"""
96
97
98
99# XXX should crGetProcAddress really handle WGL/GLX functions???
100
101print_foo = """
102/* As these are Windows specific (i.e. wgl), define these now.... */
103#ifdef WINDOWS
104 {
105 wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
106 wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
107 wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
108 wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
109 if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
110 if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
111 if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
112 if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
113 }
114#endif
115"""
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use