Remove the never-used SI-style imports/exports code.

This commit is contained in:
Brian
2007-04-04 22:18:53 -06:00
parent 4d864b087e
commit 33c3739628
5 changed files with 7 additions and 478 deletions

View File

@@ -154,166 +154,6 @@ static void
free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ); 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. * Swap buffers notification callback.
* *
@@ -328,105 +168,6 @@ _mesa_notifySwapBuffers(__GLcontext *gc)
FLUSH_VERTICES( gc, 0 ); 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 */ /** \name GL Visual allocation/destruction */
@@ -621,6 +362,8 @@ one_time_init( GLcontext *ctx )
assert( sizeof(GLint) == 4 ); assert( sizeof(GLint) == 4 );
assert( sizeof(GLuint) == 4 ); assert( sizeof(GLuint) == 4 );
_mesa_init_sqrt_table();
#if _HAVE_FULL_GL #if _HAVE_FULL_GL
_math_init(); _math_init();
@@ -1292,14 +1035,6 @@ _mesa_initialize_context(GLcontext *ctx,
assert(driverFunctions->NewTextureObject); assert(driverFunctions->NewTextureObject);
assert(driverFunctions->FreeTexImageData); 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 */ /* misc one-time initializations */
one_time_init(ctx); one_time_init(ctx);

View File

@@ -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 extern void
_mesa_notifySwapBuffers(__GLcontext *gc); _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 * extern struct _glapi_table *
_mesa_get_dispatch(GLcontext *ctx); _mesa_get_dispatch(GLcontext *ctx);

View File

@@ -348,7 +348,8 @@ _mesa_sqrtd(double x)
*/ */
static short sqrttab[0x100]; /* declare table of square roots */ 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) #if defined(USE_IEEE) && !defined(DEBUG)
unsigned short i; unsigned short i;
@@ -1088,10 +1089,6 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
/*@}*/ /*@}*/
/**********************************************************************/
/** \name Exit */
/*@{*/
/** /**
* Wrapper for exit(). * Wrapper for exit().
*/ */
@@ -1100,156 +1097,3 @@ _mesa_exit( int status )
{ {
exit(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;
}

View File

@@ -690,6 +690,9 @@ _mesa_sqrtf(float x);
extern float extern float
_mesa_inv_sqrtf(float x); _mesa_inv_sqrtf(float x);
extern void
_mesa_init_sqrt_table(void);
extern double extern double
_mesa_pow(double x, double y); _mesa_pow(double x, double y);
@@ -772,10 +775,6 @@ extern void
_mesa_exit( int status ); _mesa_exit( int status );
extern void
_mesa_init_default_imports( __GLimports *imports, void *driverCtx );
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -2882,17 +2882,6 @@ struct gl_dlist_state
*/ */
struct __GLcontextRec 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 */ /** State possibly shared with other contexts in the address space */
struct gl_shared_state *Shared; struct gl_shared_state *Shared;