From 33c3739628616c0aaf10e51eae50611169ded0dd Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 4 Apr 2007 22:18:53 -0600 Subject: Remove the never-used SI-style imports/exports code. --- src/mesa/main/context.c | 269 +----------------------------------------------- src/mesa/main/context.h | 38 ------- src/mesa/main/imports.c | 160 +--------------------------- src/mesa/main/imports.h | 7 +- src/mesa/main/mtypes.h | 11 -- 5 files changed, 7 insertions(+), 478 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index ae1c576248..59170716f1 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -154,166 +154,6 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); -/**********************************************************************/ -/** \name OpenGL SI-style interface (new in Mesa 3.5) - * - * \if subset - * \note Most of these functions are never called in the Mesa subset. - * \endif - */ -/*@{*/ - -/** - * Destroy context callback. - * - * \param gc context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::destroyCurrent) when - * the rendering context is to be destroyed. - * \endif - * - * Frees the context data and the context structure. - */ -GLboolean -_mesa_destroyContext(__GLcontext *gc) -{ - if (gc) { - _mesa_free_context_data(gc); - _mesa_free(gc); - } - return GL_TRUE; -} - -/** - * Unbind context callback. - * - * \param gc context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::loseCurrent) - * when the rendering context is made non-current. - * \endif - * - * No-op - */ -GLboolean -_mesa_loseCurrent(__GLcontext *gc) -{ - /* XXX unbind context from thread */ - (void) gc; - return GL_TRUE; -} - -/** - * Bind context callback. - * - * \param gc context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::makeCurrent) - * when the rendering context is made current. - * \endif - * - * No-op - */ -GLboolean -_mesa_makeCurrent(__GLcontext *gc) -{ - /* XXX bind context to thread */ - (void) gc; - return GL_TRUE; -} - -/** - * Share context callback. - * - * \param gc context. - * \param gcShare shared context. - * \return GL_TRUE on success, or GL_FALSE on failure. - * - * \ifnot subset - * Called by window system/device driver (via __GLexports::shareContext) - * \endif - * - * Update the shared context reference count, gl_shared_state::RefCount. - */ -GLboolean -_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare) -{ - if (gc && gcShare && gc->Shared && gcShare->Shared) { - gc->Shared->RefCount--; - if (gc->Shared->RefCount == 0) { - free_shared_state(gc, gc->Shared); - } - gc->Shared = gcShare->Shared; - gc->Shared->RefCount++; - return GL_TRUE; - } - else { - return GL_FALSE; - } -} - - -#if _HAVE_FULL_GL -/** - * Copy context callback. - */ -GLboolean -_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask) -{ - if (dst && src) { - _mesa_copy_context( src, dst, mask ); - return GL_TRUE; - } - else { - return GL_FALSE; - } -} -#endif - -/** No-op */ -GLboolean -_mesa_forceCurrent(__GLcontext *gc) -{ - (void) gc; - return GL_TRUE; -} - -/** - * Windows/buffer resizing notification callback. - * - * \param gc GL context. - * \return GL_TRUE on success, or GL_FALSE on failure. - */ -GLboolean -_mesa_notifyResize(__GLcontext *gc) -{ - /* update viewport, resize software buffers, etc. */ - (void) gc; - return GL_TRUE; -} - -/** - * Window/buffer destruction notification callback. - * - * \param gc GL context. - * - * Called when the context's window/buffer is going to be destroyed. - * - * No-op - */ -void -_mesa_notifyDestroy(__GLcontext *gc) -{ - /* Unbind from it. */ - (void) gc; -} - /** * Swap buffers notification callback. * @@ -328,105 +168,6 @@ _mesa_notifySwapBuffers(__GLcontext *gc) FLUSH_VERTICES( gc, 0 ); } -/** No-op */ -struct __GLdispatchStateRec * -_mesa_dispatchExec(__GLcontext *gc) -{ - (void) gc; - return NULL; -} - -/** No-op */ -void -_mesa_beginDispatchOverride(__GLcontext *gc) -{ - (void) gc; -} - -/** No-op */ -void -_mesa_endDispatchOverride(__GLcontext *gc) -{ - (void) gc; -} - -/** - * \ifnot subset - * Setup the exports. - * - * The window system will call these functions when it needs Mesa to do - * something. - * - * \note Device drivers should override these functions! For example, - * the Xlib driver should plug in the XMesa*-style functions into this - * structure. The XMesa-style functions should then call the _mesa_* - * version of these functions. This is an approximation to OO design - * (inheritance and virtual functions). - * \endif - * - * \if subset - * No-op. - * - * \endif - */ -static void -_mesa_init_default_exports(__GLexports *exports) -{ -#if _HAVE_FULL_GL - exports->destroyContext = _mesa_destroyContext; - exports->loseCurrent = _mesa_loseCurrent; - exports->makeCurrent = _mesa_makeCurrent; - exports->shareContext = _mesa_shareContext; - exports->copyContext = _mesa_copyContext; - exports->forceCurrent = _mesa_forceCurrent; - exports->notifyResize = _mesa_notifyResize; - exports->notifyDestroy = _mesa_notifyDestroy; - exports->notifySwapBuffers = _mesa_notifySwapBuffers; - exports->dispatchExec = _mesa_dispatchExec; - exports->beginDispatchOverride = _mesa_beginDispatchOverride; - exports->endDispatchOverride = _mesa_endDispatchOverride; -#else - (void) exports; -#endif -} - -/** - * Exported OpenGL SI interface. - */ -__GLcontext * -__glCoreCreateContext(__GLimports *imports, __GLcontextModes *modes) -{ - GLcontext *ctx; - - ctx = (GLcontext *) (*imports->calloc)(NULL, 1, sizeof(GLcontext)); - if (ctx == NULL) { - return NULL; - } - - /* XXX doesn't work at this time */ - _mesa_initialize_context(ctx, modes, NULL, NULL, NULL); - ctx->imports = *imports; - - return ctx; -} - -/** - * Exported OpenGL SI interface. - */ -void -__glCoreNopDispatch(void) -{ -#if 0 - /* SI */ - __gl_dispatch = __glNopDispatchState; -#else - /* Mesa */ - _glapi_set_dispatch(NULL); -#endif -} - -/*@}*/ - /**********************************************************************/ /** \name GL Visual allocation/destruction */ @@ -621,6 +362,8 @@ one_time_init( GLcontext *ctx ) assert( sizeof(GLint) == 4 ); assert( sizeof(GLuint) == 4 ); + _mesa_init_sqrt_table(); + #if _HAVE_FULL_GL _math_init(); @@ -1292,14 +1035,6 @@ _mesa_initialize_context(GLcontext *ctx, assert(driverFunctions->NewTextureObject); assert(driverFunctions->FreeTexImageData); - /* If the driver wants core Mesa to use special imports, it'll have to - * override these defaults. - */ - _mesa_init_default_imports( &(ctx->imports), driverContext ); - - /* initialize the exports (Mesa functions called by the window system) */ - _mesa_init_default_exports( &(ctx->exports) ); - /* misc one-time initializations */ one_time_init(ctx); diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index e7e0fda72e..b6a9d13149 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -138,47 +138,9 @@ _mesa_get_current_context(void); /*@}*/ -/** \name OpenGL SI-style export functions */ -/*@{*/ - -extern GLboolean -_mesa_destroyContext(__GLcontext *gc); - -extern GLboolean -_mesa_loseCurrent(__GLcontext *gc); - -extern GLboolean -_mesa_makeCurrent(__GLcontext *gc); - -extern GLboolean -_mesa_shareContext(__GLcontext *gc, __GLcontext *gcShare); - -extern GLboolean -_mesa_copyContext(__GLcontext *dst, const __GLcontext *src, GLuint mask); - -extern GLboolean -_mesa_forceCurrent(__GLcontext *gc); - -extern GLboolean -_mesa_notifyResize(__GLcontext *gc); - -extern void -_mesa_notifyDestroy(__GLcontext *gc); - extern void _mesa_notifySwapBuffers(__GLcontext *gc); -extern struct __GLdispatchStateRec * -_mesa_dispatchExec(__GLcontext *gc); - -extern void -_mesa_beginDispatchOverride(__GLcontext *gc); - -extern void -_mesa_endDispatchOverride(__GLcontext *gc); - -/*@}*/ - extern struct _glapi_table * _mesa_get_dispatch(GLcontext *ctx); diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index e2d44fa07c..2a13250238 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -348,7 +348,8 @@ _mesa_sqrtd(double x) */ static short sqrttab[0x100]; /* declare table of square roots */ -static void init_sqrt_table(void) +void +_mesa_init_sqrt_table(void) { #if defined(USE_IEEE) && !defined(DEBUG) unsigned short i; @@ -1088,10 +1089,6 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) /*@}*/ -/**********************************************************************/ -/** \name Exit */ -/*@{*/ - /** * Wrapper for exit(). */ @@ -1100,156 +1097,3 @@ _mesa_exit( int status ) { exit(status); } - -/*@}*/ - - -/**********************************************************************/ -/** \name Default Imports Wrapper */ -/*@{*/ - -/** Wrapper around _mesa_malloc() */ -static void * -default_malloc(__GLcontext *gc, size_t size) -{ - (void) gc; - return _mesa_malloc(size); -} - -/** Wrapper around _mesa_malloc() */ -static void * -default_calloc(__GLcontext *gc, size_t numElem, size_t elemSize) -{ - (void) gc; - return _mesa_calloc(numElem * elemSize); -} - -/** Wrapper around realloc() */ -static void * -default_realloc(__GLcontext *gc, void *oldAddr, size_t newSize) -{ - (void) gc; - return realloc(oldAddr, newSize); -} - -/** Wrapper around _mesa_free() */ -static void -default_free(__GLcontext *gc, void *addr) -{ - (void) gc; - _mesa_free(addr); -} - -/** Wrapper around _mesa_getenv() */ -static char * CAPI -default_getenv( __GLcontext *gc, const char *var ) -{ - (void) gc; - return _mesa_getenv(var); -} - -/** Wrapper around _mesa_warning() */ -static void -default_warning(__GLcontext *gc, char *str) -{ - _mesa_warning(gc, str); -} - -/** Wrapper around _mesa_problem() */ -static void -default_fatal(__GLcontext *gc, char *str) -{ - _mesa_problem(gc, str); - abort(); -} - -/** Wrapper around atoi() */ -static int CAPI -default_atoi(__GLcontext *gc, const char *str) -{ - (void) gc; - return atoi(str); -} - -/** Wrapper around vsprintf() */ -static int CAPI -default_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) -{ - int r; - va_list args; - (void) gc; - va_start( args, fmt ); - r = vsprintf( str, fmt, args ); - va_end( args ); - return r; -} - -/** Wrapper around fopen() */ -static void * CAPI -default_fopen(__GLcontext *gc, const char *path, const char *mode) -{ - (void) gc; - return fopen(path, mode); -} - -/** Wrapper around fclose() */ -static int CAPI -default_fclose(__GLcontext *gc, void *stream) -{ - (void) gc; - return fclose((FILE *) stream); -} - -/** Wrapper around vfprintf() */ -static int CAPI -default_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) -{ - int r; - va_list args; - (void) gc; - va_start( args, fmt ); - r = vfprintf( (FILE *) stream, fmt, args ); - va_end( args ); - return r; -} - -/*@}*/ - - -/** - * Initialize a __GLimports object to point to the functions in this - * file. - * - * This is to be called from device drivers. - * - * Also, do some one-time initializations. - * - * \param imports the object to initialize. - * \param driverCtx pointer to device driver-specific data. - */ -void -_mesa_init_default_imports(__GLimports *imports, void *driverCtx) -{ - /* XXX maybe move this one-time init stuff into context.c */ - static GLboolean initialized = GL_FALSE; - if (!initialized) { - init_sqrt_table(); - initialized = GL_TRUE; - } - - imports->malloc = default_malloc; - imports->calloc = default_calloc; - imports->realloc = default_realloc; - imports->free = default_free; - imports->warning = default_warning; - imports->fatal = default_fatal; - imports->getenv = default_getenv; /* not used for now */ - imports->atoi = default_atoi; - imports->sprintf = default_sprintf; - imports->fopen = default_fopen; - imports->fclose = default_fclose; - imports->fprintf = default_fprintf; - imports->getDrawablePrivate = NULL; /* driver-specific */ - imports->getReadablePrivate = NULL; /* driver-specific */ - imports->other = driverCtx; -} diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 0633b3b8bf..9be8014a13 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -690,6 +690,9 @@ _mesa_sqrtf(float x); extern float _mesa_inv_sqrtf(float x); +extern void +_mesa_init_sqrt_table(void); + extern double _mesa_pow(double x, double y); @@ -772,10 +775,6 @@ extern void _mesa_exit( int status ); -extern void -_mesa_init_default_imports( __GLimports *imports, void *driverCtx ); - - #ifdef __cplusplus } #endif diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4fc98f4628..c24e2e389f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2882,17 +2882,6 @@ struct gl_dlist_state */ struct __GLcontextRec { - /** - * \name OS related interfaces. - * - * These \b must be the first members of this structure, because they are - * exposed to the outside world (i.e. GLX extension). - */ - /*@{*/ - __GLimports imports; - __GLexports exports; - /*@}*/ - /** State possibly shared with other contexts in the address space */ struct gl_shared_state *Shared; -- cgit v1.2.3