VirtualBox

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

最後變更 在這個檔案從21077是 21022,由 vboxsync 提交於 15 年 前

crOpenGL: fix glew library detection on linux

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 2.9 KB
 
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 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
54print "\t/* Chromium binding/glue functions */"
55
56for 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
64print """
65 { NULL, NULL }
66};
67
68CR_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
98print_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"""
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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