VirtualBox

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

Last change on this file since 63206 was 51200, checked in by vboxsync, 10 years ago

crOpenGL: getAttribLocations

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.7 KB
RevLine 
[15532]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"
[16220]20#include "cr_error.h"
[15532]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
[43647]40keys = apiutil.GetAllFunctionsAndOmittedAliases(sys.argv[1]+"/APIspec.txt")
[15532]41for func_name in keys:
[16219]42 if "Chromium" == apiutil.Category(func_name):
43 continue
[30457]44 if "VBox" == apiutil.Category(func_name):
45 continue
[16219]46 if func_name == "BoundsInfoCR":
47 continue
48 if "GL_chromium" == apiutil.Category(func_name):
49 pass #continue
[15532]50
[43647]51 # alias is the function we're aliasing
52 proc_name = func_name
53 if "omit" in apiutil.ChromiumProps(func_name):
54 alias = apiutil.Alias(func_name)
55 if alias:
56 proc_name = alias
57
[16219]58 wrap = apiutil.GetCategoryWrapper(func_name)
59 name = "gl" + func_name
[43647]60 address = "cr_gl" + proc_name
[16219]61 if wrap:
62 print '#ifdef CR_%s' % wrap
63 print '\t{ "%s", (CR_PROC) %s },' % (name, address)
64 if wrap:
65 print '#endif'
[15532]66
67
68print "\t/* Chromium binding/glue functions */"
69
70for func_name in keys:
[16219]71 if (func_name == "Writeback" or
[23399]72 func_name == "BoundsInfoCR" or
[51200]73 func_name == "GetUniformsLocations" or
74 func_name == "GetAttribsLocations"):
[16219]75 continue
76 if apiutil.Category(func_name) == "Chromium":
77 print '\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name)
[15532]78
79print "\t/* Windows ICD functions */"
80
81for func_name in ( "CopyContext",
82 "CreateContext",
83 "CreateLayerContext",
84 "DeleteContext",
85 "DescribeLayerPlane",
86 "DescribePixelFormat",
87 "GetLayerPaletteEntries",
88 "RealizeLayerPalette",
89 "SetLayerPaletteEntries",
90 "SetPixelFormat",
91 "ShareLists",
92 "SwapBuffers",
93 "SwapLayerBuffers",
[16219]94 "ReleaseContext",
95 "SetContext",
96 "ValidateVersion"):
97 print '\t{ "Drv%s", (CR_PROC) Drv%s },' % (func_name, func_name)
[15532]98
99print '\t{ "DrvGetProcAddress", (CR_PROC) wglGetProcAddress_prox },'
100
101print """
[16219]102 { NULL, NULL }
[15532]103};
104
[21954]105extern const GLubyte * WINAPI wglGetExtensionsStringEXT_prox(void);
106extern const GLubyte * WINAPI wglGetExtensionsStringARB_prox(HDC hdc);
[20635]107extern BOOL WINAPI wglChoosePixelFormatEXT_prox(HDC hdc, const int *piAttributes, const FLOAT *pfAttributes, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
108extern BOOL WINAPI wglGetPixelFormatAttribivEXT_prox(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *pValues);
109extern BOOL WINAPI wglGetPixelFormatAttribfvEXT_prox(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, float *pValues);
[16220]110
[32178]111BOOL WINAPI wglSwapIntervalEXT(int interval)
112{
113 return false;
114}
115
[15532]116CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
117{
[16219]118 int i;
[16220]119 wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = wglGetExtensionsStringEXT_prox;
[21954]120 wglGetExtensionsStringARBFunc_t wglGetExtensionsStringARB = wglGetExtensionsStringARB_prox;
[20635]121 wglChoosePixelFormatEXTFunc_t wglChoosePixelFormatEXT = wglChoosePixelFormatEXT_prox;
122 wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = wglGetPixelFormatAttribivEXT_prox;
123 wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = wglGetPixelFormatAttribfvEXT_prox;
[16220]124
[16219]125 stubInit();
[15532]126
[16219]127 for (i = 0; functions[i].name; i++) {
128 if (crStrcmp(name, functions[i].name) == 0) {
[20327]129 /*crDebug("crGetProcAddress(%s) returns %p", name, functions[i].address);*/
[16219]130 return functions[i].address;
131 }
132 }
[20635]133
134 if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
[21954]135 if (!crStrcmp( name, "wglGetExtensionsStringARB" )) return (CR_PROC) wglGetExtensionsStringARB;
[15532]136
[20635]137 if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
138 if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
139 if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
140
141 if (!crStrcmp( name, "wglChoosePixelFormatARB" )) return (CR_PROC) wglChoosePixelFormatEXT;
142 if (!crStrcmp( name, "wglGetPixelFormatAttribivARB" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
[21954]143 if (!crStrcmp( name, "wglGetPixelFormatAttribfvARB" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
[20635]144
[32178]145 if (!crStrcmp( name, "wglSwapIntervalEXT" )) return (CR_PROC) wglSwapIntervalEXT;
[40267]146
[48058]147 crDebug("Returning GetProcAddress:NULL for %s", name);
[16219]148 return NULL;
[15532]149}
150
151"""
152
153
154
155# XXX should crGetProcAddress really handle WGL/GLX functions???
156print_foo = """
157/* As these are Windows specific (i.e. wgl), define these now.... */
158#ifdef WINDOWS
[16219]159 {
160 wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
161 wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
162 wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
163 wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
164 if (!crStrcmp( name, "wglGetExtensionsStringEXT" )) return (CR_PROC) wglGetExtensionsStringEXT;
165 if (!crStrcmp( name, "wglChoosePixelFormatEXT" )) return (CR_PROC) wglChoosePixelFormatEXT;
166 if (!crStrcmp( name, "wglGetPixelFormatAttribivEXT" )) return (CR_PROC) wglGetPixelFormatAttribivEXT;
167 if (!crStrcmp( name, "wglGetPixelFormatAttribfvEXT" )) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
168 }
[15532]169#endif
170"""
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use