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 *wglMakeCurrentFunc_t)(HDC,HGLRC);
|
---|
140 | typedef BOOL (WGL_APIENTRY *wglSwapBuffersFunc_t)(HDC);
|
---|
141 | typedef int (WGL_APIENTRY *wglChoosePixelFormatFunc_t)(HDC, CONST PIXELFORMATDESCRIPTOR *);
|
---|
142 | typedef BOOL (WGL_APIENTRY *wglChoosePixelFormatEXTFunc_t)(HDC, const int *, const FLOAT *, UINT, int *, UINT *);
|
---|
143 | typedef int (WGL_APIENTRY *wglDescribePixelFormatFunc_t)(HDC, int, UINT, CONST PIXELFORMATDESCRIPTOR *);
|
---|
144 | typedef int (WGL_APIENTRY *wglSetPixelFormatFunc_t)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
|
---|
145 | typedef HGLRC (WGL_APIENTRY *wglGetCurrentContextFunc_t)();
|
---|
146 | typedef PROC (WGL_APIENTRY *wglGetProcAddressFunc_t)();
|
---|
147 | typedef BOOL (WGL_APIENTRY *wglChoosePixelFormatEXTFunc_t)(HDC, const int *, const FLOAT *, UINT, int *, UINT *);
|
---|
148 | typedef BOOL (WGL_APIENTRY *wglGetPixelFormatAttribivEXTFunc_t)(HDC, int, int, UINT, int *, int *);
|
---|
149 | typedef BOOL (WGL_APIENTRY *wglGetPixelFormatAttribfvEXTFunc_t)(HDC, int, int, UINT, int *, float *);
|
---|
150 | typedef const GLubyte *(WGL_APIENTRY *glGetStringFunc_t)( GLenum );
|
---|
151 | typedef const GLubyte *(WGL_APIENTRY *wglGetExtensionsStringEXTFunc_t)();
|
---|
152 | typedef const GLubyte *(WGL_APIENTRY *wglGetExtensionsStringARBFunc_t)(HDC);
|
---|
153 | /*@}*/
|
---|
154 | #elif defined(DARWIN)
|
---|
155 | # ifndef VBOX_WITH_COCOA_QT
|
---|
156 | /**
|
---|
157 | * Apple/AGL
|
---|
158 | */
|
---|
159 | /*@{*/
|
---|
160 | typedef AGLContext (*aglCreateContextFunc_t)( AGLPixelFormat, AGLContext );
|
---|
161 | typedef GLboolean (*aglDestroyContextFunc_t)( AGLContext );
|
---|
162 | typedef GLboolean (*aglSetCurrentContextFunc_t)( AGLContext );
|
---|
163 | typedef void (*aglSwapBuffersFunc_t)( AGLContext );
|
---|
164 | typedef AGLPixelFormat (*aglChoosePixelFormatFunc_t) (const AGLDevice *, GLint, const GLint *);
|
---|
165 | typedef GLboolean (*aglDescribePixelFormatFunc_t)( AGLPixelFormat, GLint, GLint * );
|
---|
166 | /* <--set pixel format */
|
---|
167 | typedef AGLContext (*aglGetCurrentContextFunc_t)();
|
---|
168 | /* <--get proc address -- none exists */
|
---|
169 | typedef void* (*aglGetProcAddressFunc_t)( const GLubyte *name );
|
---|
170 |
|
---|
171 | /* These are here just in case */
|
---|
172 | typedef GLboolean (*aglDescribeRendererFunc_t)( AGLRendererInfo, GLint, GLint * );
|
---|
173 | typedef void (*aglDestroyPixelFormatFunc_t)( AGLPixelFormat );
|
---|
174 | typedef void (*aglDestroyRendererInfoFunc_t)( AGLRendererInfo );
|
---|
175 | typedef AGLDevice* (*aglDevicesOfPixelFormatFunc_t)( AGLPixelFormat, GLint );
|
---|
176 | typedef GLboolean (*aglDisableFunc_t)( AGLContext, GLenum );
|
---|
177 | typedef GLboolean (*aglEnableFunc_t)( AGLContext, GLenum );
|
---|
178 | typedef const GLubyte* (*aglErrorStringFunc_t)( GLenum );
|
---|
179 | typedef AGLDrawable (*aglGetDrawableFunc_t)( AGLContext );
|
---|
180 | typedef GLenum (*aglGetErrorFunc_t)();
|
---|
181 | typedef GLboolean (*aglGetIntegerFunc_t)( AGLContext, GLenum, GLint* );
|
---|
182 | typedef void (*aglGetVersionFunc_t)( GLint *, GLint * );
|
---|
183 | typedef GLint (*aglGetVirtualScreenFunc_t)( AGLContext );
|
---|
184 | typedef GLboolean (*aglIsEnabledFunc_t)( AGLContext, GLenum );
|
---|
185 | typedef AGLPixelFormat (*aglNextPixelFormatFunc_t)( AGLPixelFormat );
|
---|
186 | typedef AGLRendererInfo (*aglNextRendererInfoFunc_t)( AGLRendererInfo );
|
---|
187 | typedef AGLRendererInfo (*aglQueryRendererInfoFunc_t)( const AGLDevice *, GLint );
|
---|
188 | typedef void (*aglReserLibraryFunc_t)();
|
---|
189 | typedef GLboolean (*aglSetDrawableFunc_t)( AGLContext, AGLDrawable );
|
---|
190 | typedef GLboolean (*aglSetFullScreenFunc_t)( AGLContext, GLsizei, GLsizei, GLsizei, GLint );
|
---|
191 | typedef GLboolean (*aglSetIntegerFunc_t)( AGLContext, GLenum, const GLint * );
|
---|
192 | typedef GLboolean (*aglSetOffScreenFunc_t)( AGLContext, GLsizei, GLsizei, GLsizei, void * );
|
---|
193 | typedef GLboolean (*aglSetVirtualScreenFunc_t)( AGLContext, GLint );
|
---|
194 | typedef GLboolean (*aglUpdateContextFunc_t)( AGLContext );
|
---|
195 | typedef GLboolean (*aglUseFontFunc_t)( AGLContext, GLint, Style, GLint, GLint, GLint, GLint );
|
---|
196 | # endif
|
---|
197 |
|
---|
198 | typedef const GLubyte *(*glGetStringFunc_t)( GLenum );
|
---|
199 | /*@}*/
|
---|
200 |
|
---|
201 | /**
|
---|
202 | * Apple/CGL
|
---|
203 | */
|
---|
204 | /*@{*/
|
---|
205 | typedef CGLError (*CGLSetCurrentContextFunc_t)( CGLContextObj );
|
---|
206 | typedef CGLContextObj (*CGLGetCurrentContextFunc_t)();
|
---|
207 |
|
---|
208 | typedef CGLError (*CGLChoosePixelFormatFunc_t)( const CGLPixelFormatAttribute *, CGLPixelFormatObj *, long * );
|
---|
209 | typedef CGLError (*CGLDestroyPixelFormatFunc_t)( CGLPixelFormatObj );
|
---|
210 | typedef CGLError (*CGLDescribePixelFormatFunc_t)( CGLPixelFormatObj , long , CGLPixelFormatAttribute , long * );
|
---|
211 |
|
---|
212 | typedef CGLError (*CGLQueryRendererInfoFunc_t)( unsigned long, CGLRendererInfoObj *, long * );
|
---|
213 | typedef CGLError (*CGLDestroyRendererInfoFunc_t)( CGLRendererInfoObj );
|
---|
214 | typedef CGLError (*CGLDescribeRendererFunc_t)( CGLRendererInfoObj, long, CGLRendererProperty, long * );
|
---|
215 |
|
---|
216 | typedef CGLError (*CGLCreateContextFunc_t)( CGLPixelFormatObj, CGLContextObj, CGLContextObj * );
|
---|
217 | typedef CGLError (*CGLDestroyContextFunc_t)( CGLContextObj );
|
---|
218 | typedef CGLError (*CGLCopyContextFunc_t)( CGLContextObj src, CGLContextObj, unsigned long );
|
---|
219 |
|
---|
220 | typedef CGLError (*CGLCreatePBufferFunc_t)( long, long, unsigned long, unsigned long, long, CGLPBufferObj * ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
221 | typedef CGLError (*CGLDestroyPBufferFunc_t)( CGLPBufferObj ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
222 | typedef CGLError (*CGLDescribePBufferFunc_t)( CGLPBufferObj, long *, long *, unsigned long *, unsigned long *, long * ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
223 | typedef CGLError (*CGLTexImagePBufferFunc_t)( CGLContextObj, CGLPBufferObj, unsigned long ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
224 |
|
---|
225 | typedef CGLError (*CGLSetOffScreenFunc_t)( CGLContextObj, long, long, long, void * );
|
---|
226 | typedef CGLError (*CGLGetOffScreenFunc_t)( CGLContextObj, long *, long *, long *, void ** );
|
---|
227 | typedef CGLError (*CGLSetFullScreenFunc_t)( CGLContextObj );
|
---|
228 |
|
---|
229 | typedef CGLError (*CGLSetPBufferFunc_t)( CGLContextObj, CGLPBufferObj, unsigned long, long, long ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
230 | typedef CGLError (*CGLGetPBufferFunc_t)( CGLContextObj, CGLPBufferObj *, unsigned long *, long *, long * ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
|
---|
231 |
|
---|
232 | typedef CGLError (*CGLClearDrawableFunc_t)( CGLContextObj );
|
---|
233 | typedef CGLError (*CGLFlushDrawableFunc_t)( CGLContextObj ); /* <-- swap buffers */
|
---|
234 |
|
---|
235 | typedef CGLError (*CGLEnableFunc_t)( CGLContextObj, CGLContextEnable );
|
---|
236 | typedef CGLError (*CGLDisableFunc_t)( CGLContextObj, CGLContextEnable );
|
---|
237 | typedef CGLError (*CGLIsEnabledFunc_t)( CGLContextObj, CGLContextEnable, long * );
|
---|
238 |
|
---|
239 | typedef CGLError (*CGLSetParameterFunc_t)( CGLContextObj, CGLContextParameter, const long * );
|
---|
240 | typedef CGLError (*CGLGetParameterFunc_t)( CGLContextObj, CGLContextParameter, long * );
|
---|
241 |
|
---|
242 | typedef CGLError (*CGLSetVirtualScreenFunc_t)( CGLContextObj, long );
|
---|
243 | typedef CGLError (*CGLGetVirtualScreenFunc_t)( CGLContextObj, long *);
|
---|
244 |
|
---|
245 | typedef CGLError (*CGLSetOptionFunc_t)( CGLGlobalOption, long );
|
---|
246 | typedef CGLError (*CGLGetOptionFunc_t)( CGLGlobalOption, long * );
|
---|
247 | typedef void (*CGLGetVersionFunc_t)( long *, long * );
|
---|
248 |
|
---|
249 | typedef const char * (*CGLErrorStringFunc_t)( CGLError );
|
---|
250 |
|
---|
251 | /** XXX \todo Undocumented CGL functions. Are these all correct? */
|
---|
252 | typedef void *CGSConnectionID;
|
---|
253 | typedef int CGSWindowID;
|
---|
254 | typedef int CGSSurfaceID;
|
---|
255 |
|
---|
256 | typedef CGLError (*CGLSetSurfaceFunc_t)( CGLContextObj, CGSConnectionID, CGSWindowID, CGSSurfaceID );
|
---|
257 | typedef CGLError (*CGLGetSurfaceFunc_t)( CGLContextObj, CGSConnectionID, CGSWindowID, CGSSurfaceID* );
|
---|
258 | typedef CGLError (*CGLUpdateContextFunc_t)( CGLContextObj );
|
---|
259 | /*@}*/
|
---|
260 | #else
|
---|
261 | /**
|
---|
262 | * X11/GLX
|
---|
263 | */
|
---|
264 | /*@{*/
|
---|
265 | typedef int (*glXGetConfigFunc_t)( Display *, XVisualInfo *, int, int * );
|
---|
266 | typedef Bool (*glXQueryExtensionFunc_t) (Display *, int *, int * );
|
---|
267 | typedef const char *(*glXQueryExtensionsStringFunc_t) (Display *, int );
|
---|
268 | typedef Bool (*glXQueryVersionFunc_t)( Display *dpy, int *maj, int *min );
|
---|
269 | typedef XVisualInfo *(*glXChooseVisualFunc_t)( Display *, int, int * );
|
---|
270 | typedef GLXContext (*glXCreateContextFunc_t)( Display *, XVisualInfo *, GLXContext, Bool );
|
---|
271 | typedef void (*glXUseXFontFunc_t)(Font font, int first, int count, int listBase);
|
---|
272 | typedef void (*glXDestroyContextFunc_t)( Display *, GLXContext );
|
---|
273 | typedef Bool (*glXIsDirectFunc_t)( Display *, GLXContext );
|
---|
274 | typedef Bool (*glXMakeCurrentFunc_t)( Display *, GLXDrawable, GLXContext );
|
---|
275 | typedef void (*glXSwapBuffersFunc_t)( Display *, GLXDrawable );
|
---|
276 | typedef CR_GLXFuncPtr (*glXGetProcAddressARBFunc_t)( const GLubyte *name );
|
---|
277 | typedef Display *(*glXGetCurrentDisplayFunc_t)( void );
|
---|
278 | typedef GLXContext (*glXGetCurrentContextFunc_t)( void );
|
---|
279 | typedef GLXDrawable (*glXGetCurrentDrawableFunc_t)( void );
|
---|
280 | typedef char * (*glXGetClientStringFunc_t)( Display *dpy, int name );
|
---|
281 | typedef void (*glXWaitGLFunc_t)(void);
|
---|
282 | typedef void (*glXWaitXFunc_t)(void);
|
---|
283 | typedef void (*glXCopyContextFunc_t)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask );
|
---|
284 | typedef const GLubyte *(*glGetStringFunc_t)( GLenum );
|
---|
285 | typedef Bool (*glXJoinSwapGroupNVFunc_t)(Display *dpy, GLXDrawable drawable, GLuint group);
|
---|
286 | typedef Bool (*glXBindSwapBarrierNVFunc_t)(Display *dpy, GLuint group, GLuint barrier);
|
---|
287 | typedef Bool (*glXQuerySwapGroupNVFunc_t)(Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
|
---|
288 | typedef Bool (*glXQueryMaxSwapGroupsNVFunc_t)(Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
|
---|
289 | typedef Bool (*glXQueryFrameCountNVFunc_t)(Display *dpy, int screen, GLuint *count);
|
---|
290 | typedef Bool (*glXResetFrameCountNVFunc_t)(Display *dpy, int screen);
|
---|
291 | #ifdef GLX_VERSION_1_3
|
---|
292 | typedef GLXContext (*glXCreateNewContextFunc_t)( Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct );
|
---|
293 | typedef GLXWindow (*glXCreateWindowFunc_t)(Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
|
---|
294 | typedef Bool (*glXMakeContextCurrentFunc_t)( Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx );
|
---|
295 | typedef GLXFBConfig *(*glXChooseFBConfigFunc_t)( Display *dpy, int screen, const int *attribList, int *nitems );
|
---|
296 | typedef GLXFBConfig *(*glXGetFBConfigsFunc_t)(Display *dpy, int screen, int *nelements);
|
---|
297 | typedef int (*glXGetFBConfigAttribFunc_t)(Display *dpy, GLXFBConfig config, int attribute, int *value);
|
---|
298 | typedef XVisualInfo *(*glXGetVisualFromFBConfigFunc_t)(Display *dpy, GLXFBConfig config);
|
---|
299 | typedef GLXPbuffer (*glXCreatePbufferFunc_t)( Display *dpy, GLXFBConfig config, const int *attribList );
|
---|
300 | typedef void (*glXDestroyPbufferFunc_t)( Display *dpy, GLXPbuffer pbuf );
|
---|
301 | typedef int (*glXQueryContextFunc_t)(Display *dpy, GLXContext ctx, int attribute, int *value);
|
---|
302 | typedef void (*glXQueryDrawableFunc_t)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
|
---|
303 | #endif /* GLX_VERSION_1_3 */
|
---|
304 | /*@}*/
|
---|
305 | #endif
|
---|
306 |
|
---|
307 |
|
---|
308 | /**
|
---|
309 | * Package up the WGL/AGL/CGL/GLX function pointers into a struct. We use
|
---|
310 | * this in a few different places.
|
---|
311 | */
|
---|
312 | typedef struct {
|
---|
313 | #if defined(WINDOWS)
|
---|
314 | wglGetProcAddressFunc_t wglGetProcAddress;
|
---|
315 | wglCreateContextFunc_t wglCreateContext;
|
---|
316 | wglDeleteContextFunc_t wglDeleteContext;
|
---|
317 | wglMakeCurrentFunc_t wglMakeCurrent;
|
---|
318 | wglSwapBuffersFunc_t wglSwapBuffers;
|
---|
319 | wglGetCurrentContextFunc_t wglGetCurrentContext;
|
---|
320 | wglChoosePixelFormatFunc_t wglChoosePixelFormat;
|
---|
321 | wglDescribePixelFormatFunc_t wglDescribePixelFormat;
|
---|
322 | wglSetPixelFormatFunc_t wglSetPixelFormat;
|
---|
323 | wglChoosePixelFormatEXTFunc_t wglChoosePixelFormatEXT;
|
---|
324 | wglGetPixelFormatAttribivEXTFunc_t wglGetPixelFormatAttribivEXT;
|
---|
325 | wglGetPixelFormatAttribfvEXTFunc_t wglGetPixelFormatAttribfvEXT;
|
---|
326 | wglGetExtensionsStringEXTFunc_t wglGetExtensionsStringEXT;
|
---|
327 | #elif defined(DARWIN)
|
---|
328 | # ifndef VBOX_WITH_COCOA_QT
|
---|
329 | aglCreateContextFunc_t aglCreateContext;
|
---|
330 | aglDestroyContextFunc_t aglDestroyContext;
|
---|
331 | aglSetCurrentContextFunc_t aglSetCurrentContext;
|
---|
332 | aglSwapBuffersFunc_t aglSwapBuffers;
|
---|
333 | aglChoosePixelFormatFunc_t aglChoosePixelFormat;
|
---|
334 | aglDestroyPixelFormatFunc_t aglDestroyPixelFormat;
|
---|
335 | aglDescribePixelFormatFunc_t aglDescribePixelFormat;
|
---|
336 | aglGetCurrentContextFunc_t aglGetCurrentContext;
|
---|
337 | aglSetDrawableFunc_t aglSetDrawable;
|
---|
338 | aglGetDrawableFunc_t aglGetDrawable;
|
---|
339 | aglSetFullScreenFunc_t aglSetFullScreen;
|
---|
340 | aglGetProcAddressFunc_t aglGetProcAddress;
|
---|
341 | aglUpdateContextFunc_t aglUpdateContext;
|
---|
342 | aglUseFontFunc_t aglUseFont;
|
---|
343 | aglSetIntegerFunc_t aglSetInteger;
|
---|
344 | aglGetErrorFunc_t aglGetError;
|
---|
345 | aglGetIntegerFunc_t aglGetInteger;
|
---|
346 | aglEnableFunc_t aglEnable;
|
---|
347 | aglDisableFunc_t aglDisable;
|
---|
348 | # endif
|
---|
349 |
|
---|
350 | CGLChoosePixelFormatFunc_t CGLChoosePixelFormat;
|
---|
351 | CGLDestroyPixelFormatFunc_t CGLDestroyPixelFormat;
|
---|
352 | CGLDescribePixelFormatFunc_t CGLDescribePixelFormat;
|
---|
353 | CGLQueryRendererInfoFunc_t CGLQueryRendererInfo;
|
---|
354 | CGLDestroyRendererInfoFunc_t CGLDestroyRendererInfo;
|
---|
355 | CGLDescribeRendererFunc_t CGLDescribeRenderer;
|
---|
356 | CGLCreateContextFunc_t CGLCreateContext;
|
---|
357 | CGLDestroyContextFunc_t CGLDestroyContext;
|
---|
358 | CGLCopyContextFunc_t CGLCopyContext;
|
---|
359 | CGLSetCurrentContextFunc_t CGLSetCurrentContext;
|
---|
360 | CGLGetCurrentContextFunc_t CGLGetCurrentContext;
|
---|
361 | CGLCreatePBufferFunc_t CGLCreatePBuffer;
|
---|
362 | CGLDestroyPBufferFunc_t CGLDestroyPBuffer;
|
---|
363 | CGLDescribePBufferFunc_t CGLDescribePBuffer;
|
---|
364 | CGLTexImagePBufferFunc_t CGLTexImagePBuffer;
|
---|
365 | CGLSetOffScreenFunc_t CGLSetOffScreen;
|
---|
366 | CGLGetOffScreenFunc_t CGLGetOffScreen;
|
---|
367 | CGLSetFullScreenFunc_t CGLSetFullScreen;
|
---|
368 | CGLSetPBufferFunc_t CGLSetPBuffer;
|
---|
369 | CGLGetPBufferFunc_t CGLGetPBuffer;
|
---|
370 | CGLClearDrawableFunc_t CGLClearDrawable;
|
---|
371 | CGLFlushDrawableFunc_t CGLFlushDrawable;
|
---|
372 | CGLEnableFunc_t CGLEnable;
|
---|
373 | CGLDisableFunc_t CGLDisable;
|
---|
374 | CGLIsEnabledFunc_t CGLIsEnabled;
|
---|
375 | CGLSetParameterFunc_t CGLSetParameter;
|
---|
376 | CGLGetParameterFunc_t CGLGetParameter;
|
---|
377 | CGLSetVirtualScreenFunc_t CGLSetVirtualScreen;
|
---|
378 | CGLGetVirtualScreenFunc_t CGLGetVirtualScreen;
|
---|
379 | CGLSetOptionFunc_t CGLSetOption;
|
---|
380 | CGLGetOptionFunc_t CGLGetOption;
|
---|
381 | CGLGetVersionFunc_t CGLGetVersion;
|
---|
382 | CGLErrorStringFunc_t CGLErrorString;
|
---|
383 |
|
---|
384 | CGLSetSurfaceFunc_t CGLSetSurface;
|
---|
385 | CGLGetSurfaceFunc_t CGLGetSurface;
|
---|
386 | CGLUpdateContextFunc_t CGLUpdateContext;
|
---|
387 | #else
|
---|
388 | glXGetConfigFunc_t glXGetConfig;
|
---|
389 | glXQueryExtensionFunc_t glXQueryExtension;
|
---|
390 | glXQueryVersionFunc_t glXQueryVersion;
|
---|
391 | glXQueryExtensionsStringFunc_t glXQueryExtensionsString;
|
---|
392 | glXChooseVisualFunc_t glXChooseVisual;
|
---|
393 | glXCreateContextFunc_t glXCreateContext;
|
---|
394 | glXDestroyContextFunc_t glXDestroyContext;
|
---|
395 | glXUseXFontFunc_t glXUseXFont;
|
---|
396 | glXIsDirectFunc_t glXIsDirect;
|
---|
397 | glXMakeCurrentFunc_t glXMakeCurrent;
|
---|
398 | glXSwapBuffersFunc_t glXSwapBuffers;
|
---|
399 | glXGetProcAddressARBFunc_t glXGetProcAddressARB;
|
---|
400 | glXGetCurrentDisplayFunc_t glXGetCurrentDisplay;
|
---|
401 | glXGetCurrentContextFunc_t glXGetCurrentContext;
|
---|
402 | glXGetCurrentDrawableFunc_t glXGetCurrentDrawable;
|
---|
403 | glXGetClientStringFunc_t glXGetClientString;
|
---|
404 | glXWaitGLFunc_t glXWaitGL;
|
---|
405 | glXWaitXFunc_t glXWaitX;
|
---|
406 | glXCopyContextFunc_t glXCopyContext;
|
---|
407 | /* GLX_NV_swap_group */
|
---|
408 | glXJoinSwapGroupNVFunc_t glXJoinSwapGroupNV;
|
---|
409 | glXBindSwapBarrierNVFunc_t glXBindSwapBarrierNV;
|
---|
410 | glXQuerySwapGroupNVFunc_t glXQuerySwapGroupNV;
|
---|
411 | glXQueryMaxSwapGroupsNVFunc_t glXQueryMaxSwapGroupsNV;
|
---|
412 | glXQueryFrameCountNVFunc_t glXQueryFrameCountNV;
|
---|
413 | glXResetFrameCountNVFunc_t glXResetFrameCountNV;
|
---|
414 | #ifdef GLX_VERSION_1_3
|
---|
415 | glXCreateNewContextFunc_t glXCreateNewContext;
|
---|
416 | glXCreateWindowFunc_t glXCreateWindow;
|
---|
417 | glXMakeContextCurrentFunc_t glXMakeContextCurrent;
|
---|
418 | glXChooseFBConfigFunc_t glXChooseFBConfig;
|
---|
419 | glXGetFBConfigsFunc_t glXGetFBConfigs;
|
---|
420 | glXGetFBConfigAttribFunc_t glXGetFBConfigAttrib;
|
---|
421 | glXGetVisualFromFBConfigFunc_t glXGetVisualFromFBConfig;
|
---|
422 | glXCreatePbufferFunc_t glXCreatePbuffer;
|
---|
423 | glXDestroyPbufferFunc_t glXDestroyPbuffer;
|
---|
424 | glXQueryContextFunc_t glXQueryContext;
|
---|
425 | glXQueryDrawableFunc_t glXQueryDrawable;
|
---|
426 | #endif
|
---|
427 | #endif
|
---|
428 | glGetStringFunc_t glGetString;
|
---|
429 | } crOpenGLInterface;
|
---|
430 |
|
---|
431 |
|
---|
432 | /** This is the one required function in _all_ SPUs */
|
---|
433 | DECLEXPORT(int) SPULoad( char **name, char **super, SPUInitFuncPtr *init,
|
---|
434 | SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
|
---|
435 | SPUOptionsPtr *options, int *flags );
|
---|
436 |
|
---|
437 | DECLEXPORT(SPU *) crSPULoad( SPU *child, int id, char *name, char *dir, void *server);
|
---|
438 | DECLEXPORT(SPU *) crSPULoadChain( int count, int *ids, char **names, char *dir, void *server );
|
---|
439 | DECLEXPORT(void) crSPUUnloadChain(SPU *headSPU);
|
---|
440 |
|
---|
441 | DECLEXPORT(void) crSPUInitDispatchTable( SPUDispatchTable *table );
|
---|
442 | DECLEXPORT(void) crSPUCopyDispatchTable( SPUDispatchTable *dst, SPUDispatchTable *src );
|
---|
443 | DECLEXPORT(void) crSPUChangeInterface( SPUDispatchTable *table, void *origFunc, void *newFunc );
|
---|
444 |
|
---|
445 |
|
---|
446 | DECLEXPORT(void) crSPUSetDefaultParams( void *spu, SPUOptions *options );
|
---|
447 | DECLEXPORT(int) crSPUGetEnumIndex( const SPUOptions *option, const char *optName, const char *value );
|
---|
448 |
|
---|
449 |
|
---|
450 | DECLEXPORT(SPUGenericFunction) crSPUFindFunction( const SPUNamedFunctionTable *table, const char *fname );
|
---|
451 | DECLEXPORT(void) crSPUInitDispatch( SPUDispatchTable *dispatch, const SPUNamedFunctionTable *table );
|
---|
452 | DECLEXPORT(void) crSPUInitDispatchNops(SPUDispatchTable *table);
|
---|
453 |
|
---|
454 | DECLEXPORT(int) crLoadOpenGL( crOpenGLInterface *crInterface, SPUNamedFunctionTable table[] );
|
---|
455 | DECLEXPORT(void) crUnloadOpenGL( void );
|
---|
456 | DECLEXPORT(int) crLoadOpenGLExtensions( const crOpenGLInterface *crInterface, SPUNamedFunctionTable table[] );
|
---|
457 | DECLEXPORT(void) crSPUChangeDispatch(SPUDispatchTable *dispatch, const SPUNamedFunctionTable *newtable);
|
---|
458 |
|
---|
459 | #if defined(GLX)
|
---|
460 | DECLEXPORT(XVisualInfo *)
|
---|
461 | crChooseVisual(const crOpenGLInterface *ws, Display *dpy, int screen,
|
---|
462 | GLboolean directColor, int visBits);
|
---|
463 | #else
|
---|
464 | DECLEXPORT(int)
|
---|
465 | crChooseVisual(const crOpenGLInterface *ws, int visBits);
|
---|
466 | #endif
|
---|
467 |
|
---|
468 |
|
---|
469 | #ifdef USE_OSMESA
|
---|
470 | DECLEXPORT(int)
|
---|
471 | crLoadOSMesa( OSMesaContext (**createContext)( GLenum format, OSMesaContext sharelist ),
|
---|
472 | GLboolean (**makeCurrent)( OSMesaContext ctx, GLubyte *buffer,
|
---|
473 | GLenum type, GLsizei width, GLsizei height ),
|
---|
474 | void (**destroyContext)( OSMesaContext ctx ));
|
---|
475 | #endif
|
---|
476 |
|
---|
477 | #ifdef __cplusplus
|
---|
478 | }
|
---|
479 | #endif
|
---|
480 |
|
---|
481 | #endif /* CR_SPU_H */
|
---|