cr_spu.h revision 610972deee47d5e5229ccdb6c86cbb332d2b4626
/* Copyright (c) 2001, Stanford University
* All rights reserved.
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#ifndef CR_SPU_H
#define CR_SPU_H
#ifdef WINDOWS
#define SPULOAD_APIENTRY __stdcall
#else
#define SPULOAD_APIENTRY
#endif
#include "cr_dll.h"
#include "spu_dispatch_table.h"
#include "cr_net.h"
#ifdef DARWIN
# ifdef VBOX_WITH_COCOA_QT
# else
# endif
#endif
#define SPU_ENTRY_POINT_NAME "SPULoad"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _SPUSTRUCT SPU;
typedef void (*SPUGenericFunction)(void);
/**
* SPU Named function descriptor
*/
typedef struct {
char *name;
/**
* SPU function table descriptor
*/
typedef struct {
void *data;
} SPUFunctions;
/**
* SPU Option callback
* \param spu
* \param response
*/
/**
* SPU Options table
*/
typedef struct {
const char *option; /**< Name of the option */
int numValues; /**< usually 1 */
const char *deflt; /**< comma-separated string of [numValues] defaults */
const char *min; /**< comma-separated string of [numValues] minimums */
const char *max; /**< comma-separated string of [numValues] maximums */
const char *description; /**< Textual description of the option */
} SPUOptions, *SPUOptionsPtr;
/** Init spu */
typedef void (*SPUSelfDispatchFuncPtr)(SPUDispatchTable *);
/** Cleanup spu */
typedef int (*SPUCleanupFuncPtr)(void);
/** Load spu */
typedef int (*SPULoadFunction)(char **, char **, void *, void *, void *,
SPUOptionsPtr *, int *);
/**
* masks for spu_flags
*/
#define SPU_PACKER_MASK 0x1
#define SPU_NO_PACKER 0x0
#define SPU_HAS_PACKER 0x1
#define SPU_TERMINAL_MASK 0x2
#define SPU_NOT_TERMINAL 0x0
#define SPU_IS_TERMINAL 0x2
#define SPU_MAX_SERVERS_MASK 0xc
#define SPU_MAX_SERVERS_ZERO 0x0
#define SPU_MAX_SERVERS_ONE 0x4
#define SPU_MAX_SERVERS_UNLIMITED 0x8
/**
* SPU descriptor
*/
struct _SPUSTRUCT {
char *name; /**< Name of the spu */
char *super_name; /**< Name of the super class of the spu */
int id; /**< Id num of the spu */
int spu_flags; /**< options fags for the SPU */
void *privatePtr; /**< pointer to SPU-private data */
};
/**
* These are the OpenGL / window system interface functions
*/
#if defined(WINDOWS)
/**
*/
/*@{*/
typedef BOOL (WGL_APIENTRY *wglChoosePixelFormatEXTFunc_t)(HDC, const int *, const FLOAT *, UINT, int *, UINT *);
typedef int (WGL_APIENTRY *wglDescribePixelFormatFunc_t)(HDC, int, UINT, CONST PIXELFORMATDESCRIPTOR *);
typedef BOOL (WGL_APIENTRY *wglChoosePixelFormatEXTFunc_t)(HDC, const int *, const FLOAT *, UINT, int *, UINT *);
typedef BOOL (WGL_APIENTRY *wglGetPixelFormatAttribfvEXTFunc_t)(HDC, int, int, UINT, int *, float *);
/*@}*/
# ifndef VBOX_WITH_COCOA_QT
/**
*/
/*@{*/
typedef void (*aglSwapBuffersFunc_t)( AGLContext );
/* <--set pixel format */
typedef AGLContext (*aglGetCurrentContextFunc_t)();
/* <--get proc address -- none exists */
/* These are here just in case */
typedef void (*aglDestroyPixelFormatFunc_t)( AGLPixelFormat );
typedef void (*aglDestroyRendererInfoFunc_t)( AGLRendererInfo );
typedef GLenum (*aglGetErrorFunc_t)();
typedef void (*aglReserLibraryFunc_t)();
# endif
/*@}*/
/**
*/
/*@{*/
typedef CGLContextObj (*CGLGetCurrentContextFunc_t)();
typedef CGLError (*CGLChoosePixelFormatFunc_t)( const CGLPixelFormatAttribute *, CGLPixelFormatObj *, long * );
typedef CGLError (*CGLDescribePixelFormatFunc_t)( CGLPixelFormatObj , long , CGLPixelFormatAttribute , long * );
typedef CGLError (*CGLDescribeRendererFunc_t)( CGLRendererInfoObj, long, CGLRendererProperty, long * );
typedef CGLError (*CGLCreatePBufferFunc_t)( long, long, unsigned long, unsigned long, long, CGLPBufferObj * ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
typedef CGLError (*CGLDestroyPBufferFunc_t)( CGLPBufferObj ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
typedef CGLError (*CGLDescribePBufferFunc_t)( CGLPBufferObj, long *, long *, unsigned long *, unsigned long *, long * ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
typedef CGLError (*CGLTexImagePBufferFunc_t)( CGLContextObj, CGLPBufferObj, unsigned long ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
typedef CGLError (*CGLSetPBufferFunc_t)( CGLContextObj, CGLPBufferObj, unsigned long, long, long ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
typedef CGLError (*CGLGetPBufferFunc_t)( CGLContextObj, CGLPBufferObj *, unsigned long *, long *, long * ) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;
typedef void (*CGLGetVersionFunc_t)( long *, long * );
typedef const char * (*CGLErrorStringFunc_t)( CGLError );
/** XXX \todo Undocumented CGL functions. Are these all correct? */
typedef void *CGSConnectionID;
typedef int CGSWindowID;
typedef int CGSSurfaceID;
typedef CGLError (*CGLSetSurfaceFunc_t)( CGLContextObj, CGSConnectionID, CGSWindowID, CGSSurfaceID );
typedef CGLError (*CGLGetSurfaceFunc_t)( CGLContextObj, CGSConnectionID, CGSWindowID, CGSSurfaceID* );
/*@}*/
#else
/**
*/
/*@{*/
typedef const char *(*glXQueryExtensionsStringFunc_t) (Display *, int );
typedef Display *(*glXGetCurrentDisplayFunc_t)( void );
typedef GLXContext (*glXGetCurrentContextFunc_t)( void );
typedef GLXDrawable (*glXGetCurrentDrawableFunc_t)( void );
typedef void (*glXWaitGLFunc_t)(void);
typedef void (*glXWaitXFunc_t)(void);
typedef void (*glXCopyContextFunc_t)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask );
typedef Bool (*glXQuerySwapGroupNVFunc_t)(Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
typedef Bool (*glXQueryMaxSwapGroupsNVFunc_t)(Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
#ifdef GLX_VERSION_1_3
typedef GLXContext (*glXCreateNewContextFunc_t)( Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct );
typedef GLXWindow (*glXCreateWindowFunc_t)(Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
typedef Bool (*glXMakeContextCurrentFunc_t)( Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx );
typedef GLXFBConfig *(*glXChooseFBConfigFunc_t)( Display *dpy, int screen, const int *attribList, int *nitems );
typedef int (*glXGetFBConfigAttribFunc_t)(Display *dpy, GLXFBConfig config, int attribute, int *value);
typedef GLXPbuffer (*glXCreatePbufferFunc_t)( Display *dpy, GLXFBConfig config, const int *attribList );
typedef void (*glXQueryDrawableFunc_t)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
#endif /* GLX_VERSION_1_3 */
/*@}*/
#endif
/**
* this in a few different places.
*/
typedef struct {
#if defined(WINDOWS)
# ifndef VBOX_WITH_COCOA_QT
# endif
#else
/* GLX_NV_swap_group */
#ifdef GLX_VERSION_1_3
#endif
#endif
/** This is the one required function in _all_ SPUs */
DECLEXPORT(int) crSPUGetEnumIndex( const SPUOptions *option, const char *optName, const char *value );
DECLEXPORT(SPUGenericFunction) crSPUFindFunction( const SPUNamedFunctionTable *table, const char *fname );
DECLEXPORT(void) crSPUInitDispatch( SPUDispatchTable *dispatch, const SPUNamedFunctionTable *table );
DECLEXPORT(void) crUnloadOpenGL( void );
DECLEXPORT(int) crLoadOpenGLExtensions( const crOpenGLInterface *crInterface, SPUNamedFunctionTable table[] );
#if defined(GLX)
#else
DECLEXPORT(int)
#endif
#ifdef USE_OSMESA
DECLEXPORT(int)
#endif
#ifdef __cplusplus
}
#endif
#endif /* CR_SPU_H */