1 | # Copyright (c) 2001, Stanford University
|
---|
2 | # All rights reserved.
|
---|
3 | #
|
---|
4 | # See the file LICENSE.txt for information on redistributing this software.
|
---|
5 |
|
---|
6 | from __future__ import print_function
|
---|
7 | import sys
|
---|
8 |
|
---|
9 | import apiutil
|
---|
10 |
|
---|
11 | apiutil.CopyrightC()
|
---|
12 |
|
---|
13 | print("""
|
---|
14 | /* DO NOT EDIT - THIS FILE GENERATED BY THE getprocaddress.py SCRIPT */
|
---|
15 | #include "chromium.h"
|
---|
16 | #include "cr_string.h"
|
---|
17 | #include "cr_version.h"
|
---|
18 | #include "stub.h"
|
---|
19 | #include "icd_drv.h"
|
---|
20 | #include "cr_gl.h"
|
---|
21 | #include "cr_error.h"
|
---|
22 |
|
---|
23 | #ifdef WINDOWS
|
---|
24 | #pragma warning( disable: 4055 )
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | """)
|
---|
28 |
|
---|
29 | print("""
|
---|
30 | struct name_address {
|
---|
31 | const char *name;
|
---|
32 | CR_PROC address;
|
---|
33 | };
|
---|
34 |
|
---|
35 | PROC WINAPI wglGetProcAddress_prox( LPCSTR name );
|
---|
36 |
|
---|
37 | static struct name_address functions[] = {
|
---|
38 | """)
|
---|
39 |
|
---|
40 |
|
---|
41 | keys = apiutil.GetAllFunctionsAndOmittedAliases(sys.argv[1]+"/APIspec.txt")
|
---|
42 | for func_name in keys:
|
---|
43 | if "Chromium" == apiutil.Category(func_name):
|
---|
44 | continue
|
---|
45 | if "VBox" == apiutil.Category(func_name):
|
---|
46 | continue
|
---|
47 | if func_name == "BoundsInfoCR":
|
---|
48 | continue
|
---|
49 | if "GL_chromium" == apiutil.Category(func_name):
|
---|
50 | pass #continue
|
---|
51 |
|
---|
52 | # alias is the function we're aliasing
|
---|
53 | proc_name = func_name
|
---|
54 | if "omit" in apiutil.ChromiumProps(func_name):
|
---|
55 | alias = apiutil.Alias(func_name)
|
---|
56 | if alias:
|
---|
57 | proc_name = alias
|
---|
58 |
|
---|
59 | wrap = apiutil.GetCategoryWrapper(func_name)
|
---|
60 | name = "gl" + func_name
|
---|
61 | address = "cr_gl" + proc_name
|
---|
62 | if wrap:
|
---|
63 | print('#ifdef CR_%s' % wrap)
|
---|
64 | print('\t{ "%s", (CR_PROC) %s },' % (name, address))
|
---|
65 | if wrap:
|
---|
66 | print('#endif')
|
---|
67 |
|
---|
68 |
|
---|
69 | print("\t/* Chromium binding/glue functions */")
|
---|
70 |
|
---|
71 | for func_name in keys:
|
---|
72 | if (func_name == "Writeback" or
|
---|
73 | func_name == "BoundsInfoCR" or
|
---|
74 | func_name == "GetUniformsLocations" or
|
---|
75 | func_name == "GetAttribsLocations"):
|
---|
76 | continue
|
---|
77 | if apiutil.Category(func_name) == "Chromium":
|
---|
78 | print('\t{ "cr%s", (CR_PROC) cr%s },' % (func_name, func_name))
|
---|
79 |
|
---|
80 | print("\t/* Windows ICD functions */")
|
---|
81 |
|
---|
82 | for func_name in ( "CopyContext",
|
---|
83 | "CreateContext",
|
---|
84 | "CreateLayerContext",
|
---|
85 | "DeleteContext",
|
---|
86 | "DescribeLayerPlane",
|
---|
87 | "DescribePixelFormat",
|
---|
88 | "GetLayerPaletteEntries",
|
---|
89 | "RealizeLayerPalette",
|
---|
90 | "SetLayerPaletteEntries",
|
---|
91 | "SetPixelFormat",
|
---|
92 | "ShareLists",
|
---|
93 | "SwapBuffers",
|
---|
94 | "SwapLayerBuffers",
|
---|
95 | "ReleaseContext",
|
---|
96 | "SetContext",
|
---|
97 | "ValidateVersion"):
|
---|
98 | print('\t{ "Drv%s", (CR_PROC) Drv%s },' % (func_name, func_name))
|
---|
99 |
|
---|
100 | print('\t{ "DrvGetProcAddress", (CR_PROC) wglGetProcAddress_prox },')
|
---|
101 |
|
---|
102 | print("""
|
---|
103 | { NULL, NULL }
|
---|
104 | };
|
---|
105 |
|
---|
106 | extern const GLubyte * WINAPI wglGetExtensionsStringEXT_prox(void);
|
---|
107 | extern const GLubyte * WINAPI wglGetExtensionsStringARB_prox(HDC hdc);
|
---|
108 | extern BOOL WINAPI wglChoosePixelFormatEXT_prox(HDC hdc, const int *piAttributes, const FLOAT *pfAttributes, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
---|
109 | extern BOOL WINAPI wglGetPixelFormatAttribivEXT_prox(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *pValues);
|
---|
110 | extern BOOL WINAPI wglGetPixelFormatAttribfvEXT_prox(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, float *pValues);
|
---|
111 |
|
---|
112 | BOOL WINAPI wglSwapIntervalEXT(int interval)
|
---|
113 | {
|
---|
114 | return false;
|
---|
115 | }
|
---|
116 |
|
---|
117 | CR_PROC CR_APIENTRY crGetProcAddress( const char *name )
|
---|
118 | {
|
---|
119 | int i;
|
---|
120 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = wglGetExtensionsStringEXT_prox;
|
---|
121 | wglGetExtensionsStringARBFunc_t wglGetExtensionsStringARB = wglGetExtensionsStringARB_prox;
|
---|
122 | wglChoosePixelFormatEXTFunc_t wglChoosePixelFormatEXT = wglChoosePixelFormatEXT_prox;
|
---|
123 | wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = wglGetPixelFormatAttribivEXT_prox;
|
---|
124 | wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = wglGetPixelFormatAttribfvEXT_prox;
|
---|
125 |
|
---|
126 | stubInit();
|
---|
127 |
|
---|
128 | for (i = 0; functions[i].name; i++) {
|
---|
129 | if (crStrcmp(name, functions[i].name) == 0) {
|
---|
130 | /*crDebug("crGetProcAddress(%s) returns %p", name, functions[i].address);*/
|
---|
131 | return functions[i].address;
|
---|
132 | }
|
---|
133 | }
|
---|
134 |
|
---|
135 | if (!crStrcmp(name, "wglGetExtensionsStringEXT")) return (CR_PROC) wglGetExtensionsStringEXT;
|
---|
136 | if (!crStrcmp(name, "wglGetExtensionsStringARB")) return (CR_PROC) wglGetExtensionsStringARB;
|
---|
137 |
|
---|
138 | if (!crStrcmp(name, "wglChoosePixelFormatEXT")) return (CR_PROC) wglChoosePixelFormatEXT;
|
---|
139 | if (!crStrcmp(name, "wglGetPixelFormatAttribivEXT")) return (CR_PROC) wglGetPixelFormatAttribivEXT;
|
---|
140 | if (!crStrcmp(name, "wglGetPixelFormatAttribfvEXT")) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
|
---|
141 |
|
---|
142 | if (!crStrcmp(name, "wglChoosePixelFormatARB")) return (CR_PROC) wglChoosePixelFormatEXT;
|
---|
143 | if (!crStrcmp(name, "wglGetPixelFormatAttribivARB")) return (CR_PROC) wglGetPixelFormatAttribivEXT;
|
---|
144 | if (!crStrcmp(name, "wglGetPixelFormatAttribfvARB")) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
|
---|
145 |
|
---|
146 | if (!crStrcmp(name, "wglSwapIntervalEXT")) return (CR_PROC) wglSwapIntervalEXT;
|
---|
147 |
|
---|
148 | crDebug("Returning GetProcAddress:NULL for %s", name);
|
---|
149 | return NULL;
|
---|
150 | }
|
---|
151 |
|
---|
152 | """)
|
---|
153 |
|
---|
154 |
|
---|
155 |
|
---|
156 | # XXX should crGetProcAddress really handle WGL/GLX functions???
|
---|
157 | print_foo = """
|
---|
158 | /* As these are Windows specific (i.e. wgl), define these now.... */
|
---|
159 | #ifdef WINDOWS
|
---|
160 | {
|
---|
161 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT = NULL;
|
---|
162 | wglChoosePixelFormatFunc_t wglChoosePixelFormatEXT = NULL;
|
---|
163 | wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT = NULL;
|
---|
164 | wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT = NULL;
|
---|
165 | if (!crStrcmp(name, "wglGetExtensionsStringEXT")) return (CR_PROC) wglGetExtensionsStringEXT;
|
---|
166 | if (!crStrcmp(name, "wglChoosePixelFormatEXT")) return (CR_PROC) wglChoosePixelFormatEXT;
|
---|
167 | if (!crStrcmp(name, "wglGetPixelFormatAttribivEXT")) return (CR_PROC) wglGetPixelFormatAttribivEXT;
|
---|
168 | if (!crStrcmp(name, "wglGetPixelFormatAttribfvEXT")) return (CR_PROC) wglGetPixelFormatAttribfvEXT;
|
---|
169 | }
|
---|
170 | #endif
|
---|
171 | """
|
---|