VirtualBox

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

Last change on this file since 17543 was 16574, checked in by vboxsync, 16 years ago

crOpenGL: linux, fixes for compiz to work

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.4 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_string.h"
17#include "cr_version.h"
18#include "stub.h"
19
20
21struct name_address {
22 const char *name;
23 CR_PROC address;
24};
25
26static struct name_address functions[] = {
27"""
28
29
30keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
31for func_name in keys:
32 if "Chromium" == apiutil.Category(func_name):
33 continue
34 if func_name == "BoundsInfoCR":
35 continue
36 if "GL_chromium" == apiutil.Category(func_name):
37 pass #continue
38
39 wrap = apiutil.GetCategoryWrapper(func_name)
40 name = "gl" + func_name
41 address = "gl" + func_name
42 if wrap:
43 print '#ifdef CR_%s' % wrap
44 print '\t{ "%s", (CR_PROC) %s },' % (name, address)
45 if wrap:
46 print '#endif'
47
48
49print "\t/* Chromium binding/glue functions */"
50
51for func_name in keys:
52 if (func_name == "Writeback" or
53 func_name == "BoundsInfoCR"):
54 continue
55 if apiutil.Category(func_name) == "Chromium":
56 print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
57
58
59print """
60 { NULL, NULL }
61};
62
63DECLEXPORT(void) glXBindTexImageEXT(Display *dpy, GLXDrawable draw, int buffer, const int *attrib_list);
64DECLEXPORT(void) glXReleaseTexImageEXT(Display *dpy, GLXDrawable draw, int buffer);
65DECLEXPORT(void) glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
66DECLEXPORT(GLXFBConfig *) glXGetFBConfigs(Display *dpy, int screen, int *nelements);
67DECLEXPORT(int) glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value);
68DECLEXPORT(GLXPixmap) glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
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 if (!crStrcmp( name, "glXBindTexImageEXT" )) return (CR_PROC) glXBindTexImageEXT;
83 if (!crStrcmp( name, "glXReleaseTexImageEXT" )) return (CR_PROC) glXReleaseTexImageEXT;
84 if (!crStrcmp( name, "glXQueryDrawable" )) return (CR_PROC) glXQueryDrawable;
85 if (!crStrcmp( name, "glXGetFBConfigs" )) return (CR_PROC) glXGetFBConfigs;
86 if (!crStrcmp( name, "glXGetFBConfigAttrib" )) return (CR_PROC) glXGetFBConfigAttrib;
87 if (!crStrcmp( name, "glXCreatePixmap" )) return (CR_PROC) glXCreatePixmap;
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
99print_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"""
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette