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 | #ifndef CR_SPU_H
|
---|
7 | #define CR_SPU_H
|
---|
8 |
|
---|
9 | #ifdef WINDOWS
|
---|
10 | #define SPULOAD_APIENTRY __stdcall
|
---|
11 | #else
|
---|
12 | #define SPULOAD_APIENTRY
|
---|
13 | #endif
|
---|
14 |
|
---|
15 | #include "cr_dll.h"
|
---|
16 | #include "spu_dispatch_table.h"
|
---|
17 | #include "cr_net.h"
|
---|
18 |
|
---|
19 | #include <iprt/types.h>
|
---|
20 |
|
---|
21 | #ifdef DARWIN
|
---|
22 | # include <OpenGL/OpenGL.h>
|
---|
23 | # ifdef VBOX_WITH_COCOA_QT
|
---|
24 | # else
|
---|
25 | # include <AGL/agl.h>
|
---|
26 | # endif
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | #define SPU_ENTRY_POINT_NAME "SPULoad"
|
---|
30 |
|
---|
31 | #ifdef __cplusplus
|
---|
32 | extern "C" {
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | #define MAX_THREADS 32 /**< max threads per spu */
|
---|
36 |
|
---|
37 | typedef struct _SPUSTRUCT SPU;
|
---|
38 |
|
---|
39 | typedef void (*SPUGenericFunction)(void);
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * SPU Named function descriptor
|
---|
43 | */
|
---|
44 | typedef struct {
|
---|
45 | char *name;
|
---|
46 | SPUGenericFunction fn;
|
---|
47 | } SPUNamedFunctionTable;
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * SPU function table descriptor
|
---|
51 | */
|
---|
52 | typedef struct {
|
---|
53 | SPUDispatchTable *childCopy;
|
---|
54 | void *data;
|
---|
55 | SPUNamedFunctionTable *table;
|
---|
56 | } SPUFunctions;
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * SPU Option callback
|
---|
60 | * \param spu
|
---|
61 | * \param response
|
---|
62 | */
|
---|
63 | typedef void (*SPUOptionCB)( void *spu, const char *response );
|
---|
64 |
|
---|
65 | typedef enum { CR_BOOL, CR_INT, CR_FLOAT, CR_STRING, CR_ENUM } cr_type;
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * SPU Options table
|
---|
69 | */
|
---|
70 | typedef struct {
|
---|
71 | const char *option; /**< Name of the option */
|
---|
72 | cr_type type; /**< Type of option */
|
---|
73 | int numValues; /**< usually 1 */
|
---|
74 | const char *deflt; /**< comma-separated string of [numValues] defaults */
|
---|
75 | const char *min; /**< comma-separated string of [numValues] minimums */
|
---|
76 | const char *max; /**< comma-separated string of [numValues] maximums */
|
---|
77 | const char *description; /**< Textual description of the option */
|
---|
78 | SPUOptionCB cb; /**< Callback function */
|
---|
79 | } SPUOptions, *SPUOptionsPtr;
|
---|
80 |
|
---|
81 |
|
---|
82 | /** Init spu */
|
---|
83 | typedef SPUFunctions *(*SPUInitFuncPtr)(int id, SPU *child,
|
---|
84 | SPU *super, unsigned int, unsigned int );
|
---|
85 | typedef void (*SPUSelfDispatchFuncPtr)(SPUDispatchTable *);
|
---|
86 | /** Cleanup spu */
|
---|
87 | typedef int (*SPUCleanupFuncPtr)(void);
|
---|
88 | /** Load spu */
|
---|
89 | typedef int (*SPULoadFunction)(char **, char **, void *, void *, void *,
|
---|
90 | SPUOptionsPtr *, int *);
|
---|
91 |
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * masks for spu_flags
|
---|
95 | */
|
---|
96 | #define SPU_PACKER_MASK 0x1
|
---|
97 | #define SPU_NO_PACKER 0x0
|
---|
98 | #define SPU_HAS_PACKER 0x1
|
---|
99 | #define SPU_TERMINAL_MASK 0x2
|
---|
100 | #define SPU_NOT_TERMINAL 0x0
|
---|
101 | #define SPU_IS_TERMINAL 0x2
|
---|
102 | #define SPU_MAX_SERVERS_MASK 0xc
|
---|
103 | #define SPU_MAX_SERVERS_ZERO 0x0
|
---|
104 | #define SPU_MAX_SERVERS_ONE 0x4
|
---|
105 | #define SPU_MAX_SERVERS_UNLIMITED 0x8
|
---|
106 |
|
---|
107 |
|
---|
108 | /**
|
---|
109 | * SPU descriptor
|
---|
110 | */
|
---|
111 | struct _SPUSTRUCT {
|
---|
112 | char *name; /**< Name of the spu */
|
---|
113 | char *super_name; /**< Name of the super class of the spu */
|
---|
114 | int id; /**< Id num of the spu */
|
---|
115 | int spu_flags; /**< options fags for the SPU */
|
---|
116 | struct _SPUSTRUCT *superSPU; /**< Pointer to the descriptor for the super class */
|
---|
117 | CRDLL *dll; /**< pointer to shared lib for spu */
|
---|
118 | SPULoadFunction entry_point; /**< SPU's entry point (SPULoad()) */
|
---|
119 | SPUInitFuncPtr init; /**< SPU init function */
|
---|
120 | SPUSelfDispatchFuncPtr self; /**< */
|
---|
121 | SPUCleanupFuncPtr cleanup; /**< SPU cleanup func */
|
---|
122 | SPUFunctions *function_table; /**< Function table for spu */
|
---|
123 | SPUOptions *options; /**< Options table */
|
---|
124 | SPUDispatchTable dispatch_table;
|
---|
125 | void *privatePtr; /**< pointer to SPU-private data */
|
---|
126 | };
|
---|
127 |
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * These are the OpenGL / window system interface functions
|
---|
131 | */
|
---|
132 | #if defined(WINDOWS)
|
---|
133 | /**
|
---|
134 | * Windows/WGL
|
---|
135 | */
|
---|
136 | /*@{*/
|
---|
137 | typedef HGLRC (WGL_APIENTRY *wglCreateContextFunc_t)(HDC);
|
---|
138 | typedef void (WGL_APIENTRY *wglDeleteContextFunc_t)(HGLRC);
|
---|
139 | typedef BOOL (WGL_APIENTRY *wglShareListsFunc_t)(HGLRC,HGLRC);
|
---|
140 | typedef BOOL (WGL_APIENTRY *wglMakeCurrentFunc_t)(HDC,HGLRC);
|
---|
141 | typedef BOOL (WGL_APIENTRY *wglSwapBuffersFunc_t)(HDC);
|
---|
142 | typedef int (WGL_APIENTRY *wglChoosePixelFormatFunc_t)(HDC, CONST PIXELFORMATDESCRIPTOR *);
|
---|
143 | typedef BOOL (WGL_APIENTRY *wglChoosePixelFormatEXTFunc_t)(HDC, const int *, const FLOAT *, UINT, int *, UINT *);
|
---|
144 | typedef int (WGL_APIENTRY *wglDescribePixelFormatFunc_t)(HDC, int, UINT, CONST PIXELFORMATDESCRIPTOR *);
|
---|
145 | typedef int (WGL_APIENTRY *wglSetPixelFormatFunc_t)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
|
---|
146 | typedef HGLRC (WGL_APIENTRY *wglGetCurrentContextFunc_t)();
|
---|
147 | typedef PROC (WGL_APIENTRY *wglGetProcAddressFunc_t)();
|
---|
148 | typedef BOOL (WGL_APIENTRY *wglChoosePixelFormatEXTFunc_t)(HDC, const int *, const FLOAT *, UINT, int *, UINT *);
|
---|
149 | typedef BOOL (WGL_APIENTRY *wglGetPixelFormatAttribivEXTFunc_t)(HDC, int, int, UINT, int *, int *);
|
---|
150 | typedef BOOL (WGL_APIENTRY *wglGetPixelFormatAttribfvEXTFunc_t)(HDC, int, int, UINT, int *, float *);
|
---|
151 | typedef const GLubyte *(WGL_APIENTRY *glGetStringFunc_t)( GLenum );
|
---|
152 | typedef const GLubyte *(WGL_APIENTRY *wglGetExtensionsStringEXTFunc_t)();
|
---|
153 | typedef const GLubyte *(WGL_APIENTRY *wglGetExtensionsStringARBFunc_t)(HDC);
|
---|
154 | /*@}*/
|
---|
155 | #elif defined(DARWIN)
|
---|
156 | # ifndef VBOX_WITH_COCOA_QT
|
---|
157 | /**
|
---|
158 | * Apple/AGL
|
---|
159 | */
|
---|
160 | /*@{*/
|
---|
161 | typedef AGLContext (*aglCreateContextFunc_t)( AGLPixelFormat, AGLContext );
|
---|
162 | typedef GLboolean (*aglDestroyContextFunc_t)( AGLContext );
|
---|
163 | typedef GLboolean (*aglSetCurrentContextFunc_t)( AGLContext );
|
---|
164 | typedef void (*aglSwapBuffersFunc_t)( AGLContext );
|
---|
165 | typedef AGLPixelFormat (*aglChoosePixelFormatFunc_t) (const AGLDevice *, GLint, const GLint *);
|
---|
166 | typedef GLboolean (*aglDescribePixelFormatFunc_t)( AGLPixelFormat, GLint, GLint * );
|
---|
167 | /* <--set pixel format */
|
---|
168 | typedef AGLContext (*aglGetCurrentContextFunc_t)();
|
---|
169 | /* <--get proc address -- none exists */
|
---|
170 | typedef void* (*aglGetProcAddressFunc_t)( const GLubyte *name );
|
---|
171 |
|
---|
172 | /* These are here just in case */
|
---|
173 | typedef GLboolean (*aglDescribeRendererFunc_t)( AGLRendererInfo, GLint, GLint * );
|
---|
174 | typedef void (*aglDestroyPixelFormatFunc_t)( AGLPixelFormat );
|
---|
175 | typedef void (*aglDestroyRendererInfoFunc_t)( AGLRendererInfo );
|
---|
176 | typedef AGLDevice* (*aglDevicesOfPixelFormatFunc_t)( AGLPixelFormat, GLint );
|
---|
177 | typedef GLboolean (*aglDisableFunc_t)( AGLContext, GLenum );
|
---|
178 | typedef GLboolean (*aglEnableFunc_t)( AGLContext, GLenum );
|
---|
179 | typedef const GLubyte* (*aglErrorStringFunc_t)( GLenum );
|
---|
180 | typedef AGLDrawable (*aglGetDrawableFunc_t)( AGLContext );
|
---|
181 | typedef GLenum (*aglGetErrorFunc_t)();
|
---|
182 | typedef GLboolean (*aglGetIntegerFunc_t)( AGLContext, GLenum, GLint* );
|
---|
183 | typedef void (*aglGetVersionFunc_t)( GLint *, GLint * );
|
---|
184 | typedef GLint (*aglGetVirtualScreenFunc_t)( AGLContext );
|
---|
185 | typedef GLboolean (*aglIsEnabledFunc_t)( AGLContext, GLenum );
|
---|
186 | typedef AGLPixelFormat (*aglNextPixelFormatFunc_t)( AGLPixelFormat );
|
---|
187 | typedef AGLRendererInfo (*aglNextRendererInfoFunc_t)( AGLRendererInfo );
|
---|
188 | typedef AGLRendererInfo (*aglQueryRendererInfoFunc_t)( const AGLDevice *, GLint );
|
---|
189 | typedef void (*aglReserLibraryFunc_t)();
|
---|
190 | typedef GLboolean (*aglSetDrawableFunc_t)( AGLContext, AGLDrawable );
|
---|
191 | typedef GLboolean (*aglSetFullScreenFunc_t)( AGLContext, GLsizei, GLsizei, GLsizei, GLint );
|
---|
192 | typedef GLboolean (*aglSetIntegerFunc_t)( AGLContext, GLenum, const GLint * );
|
---|
193 | typedef GLboolean (*aglSetOffScreenFunc_t)( AGLContext, GLsizei, GLsizei, GLsizei, void * );
|
---|
194 | typedef GLboolean (*aglSetVirtualScreenFunc_t)( AGLContext, GLint );
|
---|
195 | typedef GLboolean (*aglUpdateContextFunc_t)( AGLContext );
|
---|
196 | typedef GLboolean (*aglUseFontFunc_t)( AGLContext, GLint, Style, GLint, GLint, GLint, GLint );
|
---|
197 | # endif
|
---|
198 |
|
---|
199 | typedef const GLubyte *(*glGetStringFunc_t)( GLenum );
|
---|
200 | /*@}*/
|
---|
201 |
|
---|
202 | /**
|
---|
203 | * Apple/CGL
|
---|
204 | */
|
---|
205 | /*@{*/
|
---|
206 | typedef CGLError (*CGLSetCurrentContextFunc_t)( CGLContextObj );
|
---|
207 | typedef CGLContextObj (*CGLGetCurrentContextFunc_t)();
|
---|
208 |
|
---|
209 | typedef CGLError (*CGLChoosePixelFormatFunc_t)( const CGLPixelFormatAttribute *, CGLPixelFormatObj *, long * );
|
---|
210 | typedef CGLError (*CGLDestroyPixelFormatFunc_t)( CGLPixelFormatObj );
|
---|
211 | typedef CGLError (*CGLDescribePixelFormatFunc_t)( CGLPixelFormatObj , long , CGLPixelFormatAttribute , long * );
|
---|
212 |
|
---|
213 | typedef CGLError (*CGLQueryRendererInfoFunc_t)( unsigned long, CGLRendererInfoObj *, long * );
|
---|
214 | typedef CGLError (*CGLDestroyRendererInfoFunc_t)( CGLRendererInfoObj );
|
---|
215 | typedef CGLError (*CGLDescribeRendererFunc_t)( CGLRendererInfoObj, long, CGLRendererProperty, long * );
|
---|
216 |
|
---|
217 | typedef CGLError (*CGLCreateContextFunc_t)( CGLPixelFormatObj, CGLContextObj, CGLContextObj * );
|
---|
218 | typedef CGLError (*CGLDestroyContextFunc_t)( CGLContextObj );
|
---|
219 | typedef CGLError (*CGLCopyContextFunc_t)( CGLContextObj src, CGLContextObj, unsigned long );
|
---|
220 |
|
---|
221 | typedef CGLError (*CGLCreatePBufferFunc_t)( long, long, unsigned long, unsigned long, long, CGLPBufferObj * ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
222 | typedef CGLError (*CGLDestroyPBufferFunc_t)( CGLPBufferObj ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
223 | typedef CGLError (*CGLDescribePBufferFunc_t)( CGLPBufferObj, long *, long *, unsigned long *, unsigned long *, long * ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
224 | typedef CGLError (*CGLTexImagePBufferFunc_t)( CGLContextObj, CGLPBufferObj, unsigned long ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
225 |
|
---|
226 | typedef CGLError (*CGLSetOffScreenFunc_t)( CGLContextObj, long, long, long, void * );
|
---|
227 | typedef CGLError (*CGLGetOffScreenFunc_t)( CGLContextObj, long *, long *, long *, void ** );
|
---|
228 | typedef CGLError (*CGLSetFullScreenFunc_t)( CGLContextObj );
|
---|
229 |
|
---|
230 | typedef CGLError (*CGLSetPBufferFunc_t)( CGLContextObj, CGLPBufferObj, unsigned long, long, long ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
231 | typedef CGLError (*CGLGetPBufferFunc_t)( CGLContextObj, CGLPBufferObj *, unsigned long *, long *, long * ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
232 |
|
---|
233 | typedef CGLError (*CGLClearDrawableFunc_t)( CGLContextObj );
|
---|
234 | typedef CGLError (*CGLFlushDrawableFunc_t)( CGLContextObj ); /* <-- swap buffers */
|
---|
235 |
|
---|
236 | typedef CGLError (*CGLEnableFunc_t)( CGLContextObj, CGLContextEnable );
|
---|
237 | typedef CGLError (*CGLDisableFunc_t)( CGLContextObj, CGLContextEnable );
|
---|
238 | typedef CGLError (*CGLIsEnabledFunc_t)( CGLContextObj, CGLContextEnable, long * );
|
---|
239 |
|
---|
240 | typedef CGLError (*CGLSetParameterFunc_t)( CGLContextObj, CGLContextParameter, const long * );
|
---|
241 | typedef CGLError (*CGLGetParameterFunc_t)( CGLContextObj, CGLContextParameter, long * );
|
---|
242 |
|
---|
243 | typedef CGLError (*CGLSetVirtualScreenFunc_t)( CGLContextObj, long );
|
---|
244 | typedef CGLError (*CGLGetVirtualScreenFunc_t)( CGLContextObj, long *);
|
---|
245 |
|
---|
246 | typedef CGLError (*CGLSetOptionFunc_t)( CGLGlobalOption, long );
|
---|
247 | typedef CGLError (*CGLGetOptionFunc_t)( CGLGlobalOption, long * );
|
---|
248 | typedef void (*CGLGetVersionFunc_t)( long *, long * );
|
---|
249 |
|
---|
250 | typedef const char * (*CGLErrorStringFunc_t)( CGLError );
|
---|
251 |
|
---|
252 | /** XXX \todo Undocumented CGL functions. Are these all correct? */
|
---|
253 | typedef void *CGSConnectionID;
|
---|
254 | typedef int CGSWindowID;
|
---|
255 | typedef int CGSSurfaceID;
|
---|
256 |
|
---|
257 | typedef CGLError (*CGLSetSurfaceFunc_t)( CGLContextObj, CGSConnectionID, CGSWindowID, CGSSurfaceID );
|
---|
258 | typedef CGLError (*CGLGetSurfaceFunc_t)( CGLContextObj, CGSConnectionID, CGSWindowID, CGSSurfaceID* );
|
---|
259 | typedef CGLError (*CGLUpdateContextFunc_t)( CGLContextObj );
|
---|
260 | /*@}*/
|
---|
261 | #else
|
---|
262 | /**
|
---|
263 | * X11/GLX
|
---|
264 | */
|
---|
265 | /*@{*/
|
---|
266 | typedef int (*glXGetConfigFunc_t)( Display *, XVisualInfo *, int, int * );
|
---|
267 | typedef Bool (*glXQueryExtensionFunc_t) (Display *, int *, int * );
|
---|
268 | typedef const char *(*glXQueryExtensionsStringFunc_t) (Display *, int );
|
---|
269 | typedef Bool (*glXQueryVersionFunc_t)( Display *dpy, int *maj, int *min );
|
---|
270 | typedef XVisualInfo *(*glXChooseVisualFunc_t)( Display *, int, int * );
|
---|
271 | typedef GLXContext (*glXCreateContextFunc_t)( Display *, XVisualInfo *, GLXContext, Bool );
|
---|
272 | typedef void (*glXUseXFontFunc_t)(Font font, int first, int count, int listBase);
|
---|
273 | typedef void (*glXDestroyContextFunc_t)( Display *, GLXContext );
|
---|
274 | typedef Bool (*glXIsDirectFunc_t)( Display *, GLXContext );
|
---|
275 | typedef Bool (*glXMakeCurrentFunc_t)( Display *, GLXDrawable, GLXContext );
|
---|
276 | typedef void (*glXSwapBuffersFunc_t)( Display *, GLXDrawable );
|
---|
277 | typedef CR_GLXFuncPtr (*glXGetProcAddressARBFunc_t)( const GLubyte *name );
|
---|
278 | typedef Display *(*glXGetCurrentDisplayFunc_t)( void );
|
---|
279 | typedef GLXContext (*glXGetCurrentContextFunc_t)( void );
|
---|
280 | typedef GLXDrawable (*glXGetCurrentDrawableFunc_t)( void );
|
---|
281 | typedef char * (*glXGetClientStringFunc_t)( Display *dpy, int name );
|
---|
282 | typedef void (*glXWaitGLFunc_t)(void);
|
---|
283 | typedef void (*glXWaitXFunc_t)(void);
|
---|
284 | typedef void (*glXCopyContextFunc_t)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask );
|
---|
285 | typedef const GLubyte *(*glGetStringFunc_t)( GLenum );
|
---|
286 | typedef Bool (*glXJoinSwapGroupNVFunc_t)(Display *dpy, GLXDrawable drawable, GLuint group);
|
---|
287 | typedef Bool (*glXBindSwapBarrierNVFunc_t)(Display *dpy, GLuint group, GLuint barrier);
|
---|
288 | typedef Bool (*glXQuerySwapGroupNVFunc_t)(Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
|
---|
289 | typedef Bool (*glXQueryMaxSwapGroupsNVFunc_t)(Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
|
---|
290 | typedef Bool (*glXQueryFrameCountNVFunc_t)(Display *dpy, int screen, GLuint *count);
|
---|
291 | typedef Bool (*glXResetFrameCountNVFunc_t)(Display *dpy, int screen);
|
---|
292 | #ifdef GLX_VERSION_1_3
|
---|
293 | typedef GLXContext (*glXCreateNewContextFunc_t)( Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct );
|
---|
294 | typedef GLXWindow (*glXCreateWindowFunc_t)(Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
|
---|
295 | typedef Bool (*glXMakeContextCurrentFunc_t)( Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx );
|
---|
296 | typedef GLXFBConfig *(*glXChooseFBConfigFunc_t)( Display *dpy, int screen, const int *attribList, int *nitems );
|
---|
297 | typedef GLXFBConfig *(*glXGetFBConfigsFunc_t)(Display *dpy, int screen, int *nelements);
|
---|
298 | typedef int (*glXGetFBConfigAttribFunc_t)(Display *dpy, GLXFBConfig config, int attribute, int *value);
|
---|
299 | typedef XVisualInfo *(*glXGetVisualFromFBConfigFunc_t)(Display *dpy, GLXFBConfig config);
|
---|
300 | typedef GLXPbuffer (*glXCreatePbufferFunc_t)( Display *dpy, GLXFBConfig config, const int *attribList );
|
---|
301 | typedef void (*glXDestroyPbufferFunc_t)( Display *dpy, GLXPbuffer pbuf );
|
---|
302 | typedef int (*glXQueryContextFunc_t)(Display *dpy, GLXContext ctx, int attribute, int *value);
|
---|
303 | typedef void (*glXQueryDrawableFunc_t)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
|
---|
304 | #endif /* GLX_VERSION_1_3 */
|
---|
305 | /*@}*/
|
---|
306 | #endif
|
---|
307 |
|
---|
308 |
|
---|
309 | /**
|
---|
310 | * Package up the WGL/AGL/CGL/GLX function pointers into a struct. We use
|
---|
311 | * this in a few different places.
|
---|
312 | */
|
---|
313 | typedef struct {
|
---|
314 | #if defined(WINDOWS)
|
---|
315 | wglGetProcAddressFunc_t wglGetProcAddress;
|
---|
316 | wglCreateContextFunc_t wglCreateContext;
|
---|
317 | wglDeleteContextFunc_t wglDeleteContext;
|
---|
318 | wglShareListsFunc_t wglShareLists;
|
---|
319 | wglMakeCurrentFunc_t wglMakeCurrent;
|
---|
320 | wglSwapBuffersFunc_t wglSwapBuffers;
|
---|
321 | wglGetCurrentContextFunc_t wglGetCurrentContext;
|
---|
322 | wglChoosePixelFormatFunc_t wglChoosePixelFormat;
|
---|
323 | wglDescribePixelFormatFunc_t wglDescribePixelFormat;
|
---|
324 | wglSetPixelFormatFunc_t wglSetPixelFormat;
|
---|
325 | wglChoosePixelFormatEXTFunc_t wglChoosePixelFormatEXT;
|
---|
326 | wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT;
|
---|
327 | wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT;
|
---|
328 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT;
|
---|
329 | #elif defined(DARWIN)
|
---|
330 | # ifndef VBOX_WITH_COCOA_QT
|
---|
331 | aglCreateContextFunc_t aglCreateContext;
|
---|
332 | aglDestroyContextFunc_t aglDestroyContext;
|
---|
333 | aglSetCurrentContextFunc_t aglSetCurrentContext;
|
---|
334 | aglSwapBuffersFunc_t aglSwapBuffers;
|
---|
335 | aglChoosePixelFormatFunc_t aglChoosePixelFormat;
|
---|
336 | aglDestroyPixelFormatFunc_t aglDestroyPixelFormat;
|
---|
337 | aglDescribePixelFormatFunc_t aglDescribePixelFormat;
|
---|
338 | aglGetCurrentContextFunc_t aglGetCurrentContext;
|
---|
339 | aglSetDrawableFunc_t aglSetDrawable;
|
---|
340 | aglGetDrawableFunc_t aglGetDrawable;
|
---|
341 | aglSetFullScreenFunc_t aglSetFullScreen;
|
---|
342 | aglGetProcAddressFunc_t aglGetProcAddress;
|
---|
343 | aglUpdateContextFunc_t aglUpdateContext;
|
---|
344 | aglUseFontFunc_t aglUseFont;
|
---|
345 | aglSetIntegerFunc_t aglSetInteger;
|
---|
346 | aglGetErrorFunc_t aglGetError;
|
---|
347 | aglGetIntegerFunc_t aglGetInteger;
|
---|
348 | aglEnableFunc_t aglEnable;
|
---|
349 | aglDisableFunc_t aglDisable;
|
---|
350 | # endif
|
---|
351 |
|
---|
352 | CGLChoosePixelFormatFunc_t CGLChoosePixelFormat;
|
---|
353 | CGLDestroyPixelFormatFunc_t CGLDestroyPixelFormat;
|
---|
354 | CGLDescribePixelFormatFunc_t CGLDescribePixelFormat;
|
---|
355 | CGLQueryRendererInfoFunc_t CGLQueryRendererInfo;
|
---|
356 | CGLDestroyRendererInfoFunc_t CGLDestroyRendererInfo;
|
---|
357 | CGLDescribeRendererFunc_t CGLDescribeRenderer;
|
---|
358 | CGLCreateContextFunc_t CGLCreateContext;
|
---|
359 | CGLDestroyContextFunc_t CGLDestroyContext;
|
---|
360 | CGLCopyContextFunc_t CGLCopyContext;
|
---|
361 | CGLSetCurrentContextFunc_t CGLSetCurrentContext;
|
---|
362 | CGLGetCurrentContextFunc_t CGLGetCurrentContext;
|
---|
363 | CGLCreatePBufferFunc_t CGLCreatePBuffer;
|
---|
364 | CGLDestroyPBufferFunc_t CGLDestroyPBuffer;
|
---|
365 | CGLDescribePBufferFunc_t CGLDescribePBuffer;
|
---|
366 | CGLTexImagePBufferFunc_t CGLTexImagePBuffer;
|
---|
367 | CGLSetOffScreenFunc_t CGLSetOffScreen;
|
---|
368 | CGLGetOffScreenFunc_t CGLGetOffScreen;
|
---|
369 | CGLSetFullScreenFunc_t CGLSetFullScreen;
|
---|
370 | CGLSetPBufferFunc_t CGLSetPBuffer;
|
---|
371 | CGLGetPBufferFunc_t CGLGetPBuffer;
|
---|
372 | CGLClearDrawableFunc_t CGLClearDrawable;
|
---|
373 | CGLFlushDrawableFunc_t CGLFlushDrawable;
|
---|
374 | CGLEnableFunc_t CGLEnable;
|
---|
375 | CGLDisableFunc_t CGLDisable;
|
---|
376 | CGLIsEnabledFunc_t CGLIsEnabled;
|
---|
377 | CGLSetParameterFunc_t CGLSetParameter;
|
---|
378 | CGLGetParameterFunc_t CGLGetParameter;
|
---|
379 | CGLSetVirtualScreenFunc_t CGLSetVirtualScreen;
|
---|
380 | CGLGetVirtualScreenFunc_t CGLGetVirtualScreen;
|
---|
381 | CGLSetOptionFunc_t CGLSetOption;
|
---|
382 | CGLGetOptionFunc_t CGLGetOption;
|
---|
383 | CGLGetVersionFunc_t CGLGetVersion;
|
---|
384 | CGLErrorStringFunc_t CGLErrorString;
|
---|
385 |
|
---|
386 | CGLSetSurfaceFunc_t CGLSetSurface;
|
---|
387 | CGLGetSurfaceFunc_t CGLGetSurface;
|
---|
388 | CGLUpdateContextFunc_t CGLUpdateContext;
|
---|
389 | #else
|
---|
390 | glXGetConfigFunc_t glXGetConfig;
|
---|
391 | glXQueryExtensionFunc_t glXQueryExtension;
|
---|
392 | glXQueryVersionFunc_t glXQueryVersion;
|
---|
393 | glXQueryExtensionsStringFunc_t glXQueryExtensionsString;
|
---|
394 | glXChooseVisualFunc_t glXChooseVisual;
|
---|
395 | glXCreateContextFunc_t glXCreateContext;
|
---|
396 | glXDestroyContextFunc_t glXDestroyContext;
|
---|
397 | glXUseXFontFunc_t glXUseXFont;
|
---|
398 | glXIsDirectFunc_t glXIsDirect;
|
---|
399 | glXMakeCurrentFunc_t glXMakeCurrent;
|
---|
400 | glXSwapBuffersFunc_t glXSwapBuffers;
|
---|
401 | glXGetProcAddressARBFunc_t glXGetProcAddressARB;
|
---|
402 | glXGetCurrentDisplayFunc_t glXGetCurrentDisplay;
|
---|
403 | glXGetCurrentContextFunc_t glXGetCurrentContext;
|
---|
404 | glXGetCurrentDrawableFunc_t glXGetCurrentDrawable;
|
---|
405 | glXGetClientStringFunc_t glXGetClientString;
|
---|
406 | glXWaitGLFunc_t glXWaitGL;
|
---|
407 | glXWaitXFunc_t glXWaitX;
|
---|
408 | glXCopyContextFunc_t glXCopyContext;
|
---|
409 | /* GLX_NV_swap_group */
|
---|
410 | glXJoinSwapGroupNVFunc_t glXJoinSwapGroupNV;
|
---|
411 | glXBindSwapBarrierNVFunc_t glXBindSwapBarrierNV;
|
---|
412 | glXQuerySwapGroupNVFunc_t glXQuerySwapGroupNV;
|
---|
413 | glXQueryMaxSwapGroupsNVFunc_t glXQueryMaxSwapGroupsNV;
|
---|
414 | glXQueryFrameCountNVFunc_t glXQueryFrameCountNV;
|
---|
415 | glXResetFrameCountNVFunc_t glXResetFrameCountNV;
|
---|
416 | #ifdef GLX_VERSION_1_3
|
---|
417 | glXCreateNewContextFunc_t glXCreateNewContext;
|
---|
418 | glXCreateWindowFunc_t glXCreateWindow;
|
---|
419 | glXMakeContextCurrentFunc_t glXMakeContextCurrent;
|
---|
420 | glXChooseFBConfigFunc_t glXChooseFBConfig;
|
---|
421 | glXGetFBConfigsFunc_t glXGetFBConfigs;
|
---|
422 | glXGetFBConfigAttribFunc_t glXGetFBConfigAttrib;
|
---|
423 | glXGetVisualFromFBConfigFunc_t glXGetVisualFromFBConfig;
|
---|
424 | glXCreatePbufferFunc_t glXCreatePbuffer;
|
---|
425 | glXDestroyPbufferFunc_t glXDestroyPbuffer;
|
---|
426 | glXQueryContextFunc_t glXQueryContext;
|
---|
427 | glXQueryDrawableFunc_t glXQueryDrawable;
|
---|
428 | #endif
|
---|
429 | #endif
|
---|
430 | glGetStringFunc_t glGetString;
|
---|
431 | } crOpenGLInterface;
|
---|
432 |
|
---|
433 |
|
---|
434 | /** This is the one required function in _all_ SPUs */
|
---|
435 | DECLEXPORT(int) SPULoad( char **name, char **super, SPUInitFuncPtr *init,
|
---|
436 | SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
|
---|
437 | SPUOptionsPtr *options, int *flags );
|
---|
438 |
|
---|
439 | DECLEXPORT(SPU *) crSPULoad( SPU *child, int id, char *name, char *dir, void *server);
|
---|
440 | DECLEXPORT(SPU *) crSPULoadChain( int count, int *ids, char **names, char *dir, void *server );
|
---|
441 | DECLEXPORT(void) crSPUUnloadChain(SPU *headSPU);
|
---|
442 |
|
---|
443 | DECLEXPORT(void) crSPUInitDispatchTable( SPUDispatchTable *table );
|
---|
444 | DECLEXPORT(void) crSPUCopyDispatchTable( SPUDispatchTable *dst, SPUDispatchTable *src );
|
---|
445 | DECLEXPORT(void) crSPUChangeInterface( SPUDispatchTable *table, void *origFunc, void *newFunc );
|
---|
446 |
|
---|
447 |
|
---|
448 | DECLEXPORT(void) crSPUSetDefaultParams( void *spu, SPUOptions *options );
|
---|
449 | DECLEXPORT(int) crSPUGetEnumIndex( const SPUOptions *option, const char *optName, const char *value );
|
---|
450 |
|
---|
451 |
|
---|
452 | DECLEXPORT(SPUGenericFunction) crSPUFindFunction( const SPUNamedFunctionTable *table, const char *fname );
|
---|
453 | DECLEXPORT(void) crSPUInitDispatch( SPUDispatchTable *dispatch, const SPUNamedFunctionTable *table );
|
---|
454 | DECLEXPORT(void) crSPUInitDispatchNops(SPUDispatchTable *table);
|
---|
455 |
|
---|
456 | DECLEXPORT(int) crLoadOpenGL( crOpenGLInterface *crInterface, SPUNamedFunctionTable table[] );
|
---|
457 | DECLEXPORT(void) crUnloadOpenGL( void );
|
---|
458 | DECLEXPORT(int) crLoadOpenGLExtensions( const crOpenGLInterface *crInterface, SPUNamedFunctionTable table[] );
|
---|
459 | DECLEXPORT(void) crSPUChangeDispatch(SPUDispatchTable *dispatch, const SPUNamedFunctionTable *newtable);
|
---|
460 |
|
---|
461 | #if defined(GLX)
|
---|
462 | DECLEXPORT(XVisualInfo *)
|
---|
463 | crChooseVisual(const crOpenGLInterface *ws, Display *dpy, int screen,
|
---|
464 | GLboolean directColor, int visBits);
|
---|
465 | #else
|
---|
466 | DECLEXPORT(int)
|
---|
467 | crChooseVisual(const crOpenGLInterface *ws, int visBits);
|
---|
468 | #endif
|
---|
469 |
|
---|
470 |
|
---|
471 | #ifdef USE_OSMESA
|
---|
472 | DECLEXPORT(int)
|
---|
473 | crLoadOSMesa( OSMesaContext (**createContext)( GLenum format, OSMesaContext sharelist ),
|
---|
474 | GLboolean (**makeCurrent)( OSMesaContext ctx, GLubyte *buffer,
|
---|
475 | GLenum type, GLsizei width, GLsizei height ),
|
---|
476 | void (**destroyContext)( OSMesaContext ctx ));
|
---|
477 | #endif
|
---|
478 |
|
---|
479 | #ifdef __cplusplus
|
---|
480 | }
|
---|
481 | #endif
|
---|
482 |
|
---|
483 | #endif /* CR_SPU_H */
|
---|