VirtualBox

source: vbox/trunk/src/VBox/Additions/common/crOpenGL/windows_getprocaddress.py@ 42227

Last change on this file since 42227 was 40267, checked in by vboxsync, 13 years ago

crOpenGL: fixe VSG Open Inventor interop issues

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.2 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#include "chromium.h"
15#include "cr_string.h"
16#include "cr_version.h"
17#include "stub.h"
18#include "icd_drv.h"
19#include "cr_gl.h"
20#include "cr_error.h"
21
22#ifdef WINDOWS
23#pragma warning( disable: 4055 )
24#endif
25
26"""
27
28print """
29struct name_address {
30 const char *name;
31 CR_PROC address;
32};
33
34PROC WINAPI wglGetProcAddress_prox( LPCSTR name );
35
36static struct name_address functions[] = {
37"""
38
39
40keys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
41for func_name in keys:
42 if "Chromium" == apiutil.Category(func_name):
43 continue
44 if "VBox" == apiutil.Category(func_name):
45 continue
46 if func_name == "BoundsInfoCR":
47 continue
48 if "GL_chromium" == apiutil.Category(func_name):
49 pass #continue
50
51 wrap = apiutil.GetCategoryWrapper(func_name)
52 name = "gl" + func_name
53 address = "cr_gl" + func_name
54 if wrap:
55 print '#ifdef CR_%s' % wrap
56 print '\t{ "%s", (CR_PROC) %s },' % (name, address)
57 if wrap:
58 print '#endif'
59
60
61print "\t/* Chromium binding/glue functions */"
62
63for func_name in keys:
64 if (func_name == "Writeback" or
65 func_name == "BoundsInfoCR" or
66 func_name == "GetUniformsLocations"):
67 continue
68 if apiutil.Category(func_name) == "Chromium":
69 print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
70
71print "\t/* Windows ICD functions */"
72
73for func_name in ( "CopyContext",
74 "CreateContext",
75 "CreateLayerContext",
76 "DeleteContext",
77 "DescribeLayerPlane",
78 "DescribePixelFormat",
79 "GetLayerPaletteEntries",
80 "RealizeLayerPalette",
81 "SetLayerPaletteEntries",
82 "SetPixelFormat",
83 "ShareLists",
84 "SwapBuffers",
85 "SwapLayerBuffers",
86 "ReleaseContext",
87 "SetContext",
88 "ValidateVersion"):
89 print '\t{ "Drv%s", (CR_PROC) Drv%s },' % (func_name, func_name)
90
91print '\t{ "DrvGetProcAddress", (CR_PROC) wglGetProcAddress_prox },'
92
93print """
94 { NULL, NULL }
95};
96
97extern const GLubyte * WINAPI wglGetExtensionsStringEXT_prox(void);
98extern const GLubyte * WINAPI wglGetExtensionsStringARB_prox(HDC hdc);
99extern BOOL WINAPI wglChoosePixelFormatEXT_prox(HDC hdc, const int *piAttributes, const FLOAT *pfAttributes, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
100extern BOOL WINAPI wglGetPixelFormatAttribivEXT_prox(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *pValues);
101extern BOOL WINAPI wglGetPixelFormatAttribfvEXT_prox(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, float *pValues);
102
103BOOL WINAPI wglSwapIntervalEXT(int interval)
104{
105 return false;
106}
107
108CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
109{
110 int i;
111 wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = wglGetExtensionsStringEXT_prox;
112 wglGetExtensionsStringARBFunc_t wglGetExtensionsStringARB = wglGetExtensionsStringARB_prox;
113 wglChoosePixelFormatEXTFunc_t wglChoosePixelFormatEXT = wglChoosePixelFormatEXT_prox;
114 wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = wglGetPixelFormatAttribivEXT_prox;
115 wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = wglGetPixelFormatAttribfvEXT_prox;
116
117 stubInit();
118
119 for (i = 0; functions[i].name; i++) {
120 if (crStrcmp(name, functions[i].name) == 0) {
121 /*crDebug("crGetProcAddress(%s) returns %p", name, functions[i].address);*/
122 return functions[i].address;
123 }
124 }
125
126 if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
127 if (!crStrcmp( name, "wglGetExtensionsStringARB" )) return (CR_PROC) wglGetExtensionsStringARB;
128
129 if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
130 if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
131 if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
132
133 if (!crStrcmp( name, "wglChoosePixelFormatARB" )) return (CR_PROC) wglChoosePixelFormatEXT;
134 if (!crStrcmp( name, "wglGetPixelFormatAttribivARB" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
135 if (!crStrcmp( name, "wglGetPixelFormatAttribfvARB" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
136
137 if (!crStrcmp( name, "wglSwapIntervalEXT" )) return (CR_PROC) wglSwapIntervalEXT;
138
139 /* this is needed for VSG Open Inventor stuff.
140 * @todo: make all these auto-generated!!! */
141 if (!crStrcmp( name, "glBeginQuery" )) return (CR_PROC) cr_glBeginQueryARB;
142 if (!crStrcmp( name, "glDeleteQueries" )) return (CR_PROC) cr_glDeleteQueriesARB;
143 if (!crStrcmp( name, "glEndQuery" )) return (CR_PROC) cr_glEndQueryARB;
144 if (!crStrcmp( name, "glGenQueries" )) return (CR_PROC) cr_glGenQueriesARB;
145 if (!crStrcmp( name, "glGetQueryObjectiv" )) return (CR_PROC) cr_glGetQueryObjectivARB;
146 if (!crStrcmp( name, "glGetQueryObjectuiv" )) return (CR_PROC) cr_glGetQueryObjectuivARB;
147 if (!crStrcmp( name, "glGetQueryiv" )) return (CR_PROC) cr_glGetQueryivARB;
148 if (!crStrcmp( name, "glIsQuery" )) return (CR_PROC) cr_glIsQueryARB;
149
150 crWarning("Returning GetProcAddress:NULL for %s", name);
151 return NULL;
152}
153
154"""
155
156
157
158# XXX should crGetProcAddress really handle WGL/GLX functions???
159print_foo = """
160/* As these are Windows specific (i.e. wgl), define these now.... */
161#ifdef WINDOWS
162 {
163 wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
164 wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
165 wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
166 wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
167 if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
168 if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
169 if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
170 if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
171 }
172#endif
173"""
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