Some source files updated to call _mesa_debug(), but not finished.
Added __GLimports as a parameter to _mesa_create/init_context() and
updated drivers accordingly.
Fleshed-out more of the __GLimports and __GLexports functionality.
Removed run-time config file support (config.c)
-# $Id: Makefile.X11,v 1.67 2002/04/09 14:58:03 keithw Exp $
+# $Id: Makefile.X11,v 1.68 2002/06/13 04:28:29 brianp Exp $
# Mesa 3-D graphics library
# Version: 4.1
buffers.c \
clip.c \
colortab.c \
- config.c \
context.c \
convolve.c \
debug.c \
#include <stdlib.h>\r
#include <allegro.h>\r
#include "context.h"\r
+#include "imports.h"\r
#include "matrix.h"\r
#include "mtypes.h"
#include "GL/amesa.h"\r
\r
AMesaContext AMesaCreateContext(AMesaVisual visual,\r
AMesaContext share)\r
- {\r
+{\r
AMesaContext context;\r
GLboolean direct = GL_FALSE;\r
+ __GLimports imports;
\r
- context = (AMesaContext)calloc(1, sizeof(struct amesa_context));\r
+ context = (AMesaContext)calloc(1, sizeof(struct amesa_context));\r
if (!context)\r
return NULL;\r
\r
context->Buffer = NULL;\r
context->ClearColor = 0;\r
context->CurrentColor = 0;\r
- context->GLContext = _mesa_create_context(visual->GLVisual,\r
+ _mesa_init_default_imports( &imports, (void *) context);
+ context->GLContext = _mesa_create_context(visual->GLVisual,\r
share ? share->GLContext : NULL,\r
- (void*)context,\r
- direct);\r
- if (!context->GLContext)\r
+ &imports );\r
+ if (!context->GLContext)\r
{\r
- free(context);\r
- return NULL;\r
+ free(context);\r
+ return NULL;\r
}\r
\r
return context;\r
- }\r
+}\r
\r
\r
void AMesaDestroyContext(AMesaContext context)\r
#include "context.h"\r
#include "GL/dmesa.h"\r
#include "extensions.h"\r
+#inlcude "imports.h"\r
#include "macros.h"\r
#include "matrix.h"\r
#include "mmath.h"\r
GLboolean direct = GL_FALSE;\r
\r
if ((c=(DMesaContext)calloc(1, sizeof(struct dmesa_context)))!=NULL) {\r
+ __GLimports imports;\r
+ _mesa_init_default_imports( &imports, (void *) c);\r
c->gl_ctx = _mesa_create_context(visual->gl_visual,\r
share ? share->gl_ctx : NULL,\r
- (void *)c, direct);\r
+ &imports);\r
\r
_mesa_enable_sw_extensions(c->gl_ctx);\r
_mesa_enable_1_3_extensions(c->gl_ctx);\r
#include <ggi/mesa/ggimesa_int.h>
#include <ggi/mesa/debug.h>
#include "extensions.h"
+#include "imports.h"
#include "matrix.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
int err;
ggi_color pal[256];
int i;
+ __GLimports imports;
GGIMESADPRINT_CORE("ggiMesaCreateContext() called\n");
ctx->ggi_visual = vis;
ctx->color = 0;
+ _mesa_init_default_imports( &imports, (void *) ctx);
ctx->gl_ctx =
_mesa_create_context(&(LIBGGI_MESAEXT(vis)->mesa_visual.gl_visual),
- NULL, (void *)ctx, GL_TRUE);
+ NULL, &imports);
if (!ctx->gl_ctx)
goto free_context;
goto free_gl_context;
}
- _mesa_read_config_file(ctx->gl_ctx);
-
return ctx;
free_gl_context:
-/* $Id: fxdd.c,v 1.85 2002/03/16 00:53:15 brianp Exp $ */
+/* $Id: fxdd.c,v 1.86 2002/06/13 04:28:30 brianp Exp $ */
/*
* Mesa 3-D graphics library
FX_grGlideGetState((GrState *) fxMesa->state);
- /* Run the config file */
- _mesa_read_config_file(fxMesa->glCtx);
-
return 1;
}
-/* $Id: fxdrv.h,v 1.52 2001/09/23 16:50:01 brianp Exp $ */
+/* $Id: fxdrv.h,v 1.53 2002/06/13 04:28:30 brianp Exp $ */
/*
* Mesa 3-D graphics library
#endif
#include "context.h"
+#include "imports.h"
#include "macros.h"
#include "matrix.h"
#include "mem.h"
-/* $Id: osmesa.c,v 1.79 2002/04/19 14:05:51 brianp Exp $ */
+/* $Id: osmesa.c,v 1.80 2002/06/13 04:28:30 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "colormac.h"
#include "depth.h"
#include "extensions.h"
+#include "imports.h"
#include "macros.h"
#include "matrix.h"
#include "mem.h"
const GLuint i4 = 1;
const GLubyte *i1 = (GLubyte *) &i4;
const GLint little_endian = *i1;
+ __GLimports imports;
rind = gind = bind = aind = 0;
if (format==OSMESA_COLOR_INDEX) {
return NULL;
}
+ _mesa_init_default_imports( &imports, (void *) osmesa );
if (!_mesa_initialize_context(&osmesa->gl_ctx,
osmesa->gl_visual,
sharelist ? &sharelist->gl_ctx
: (GLcontext *) NULL,
- (void *) osmesa, GL_TRUE )) {
+ &imports)) {
_mesa_destroy_visual( osmesa->gl_visual );
FREE(osmesa);
return NULL;
-/* $Id: svgamesa.c,v 1.17 2002/03/16 00:53:15 brianp Exp $ */
+/* $Id: svgamesa.c,v 1.18 2002/06/13 04:28:30 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "GL/svgamesa.h"
#include "context.h"
#include "extensions.h"
+#include "imports.h"
#include "matrix.h"
#include "mtypes.h"
#include "swrast/swrast.h"
GLfloat redscale, greenscale, bluescale, alphascale;
GLint index_bits;
GLint redbits, greenbits, bluebits, alphabits;
+ __GLimports imports;
+
/* determine if we're in RGB or color index mode */
if ((SVGABuffer.Depth==32) || (SVGABuffer.Depth==24)) {
rgb_flag = GL_TRUE;
1 /* samples */
);
+ _mesa_init_default_imports( &imports, (void *) ctx);
ctx->gl_ctx = _mesa_create_context( ctx->gl_vis,
NULL, /* share list context */
- (void *) ctx, GL_TRUE );
+ &imports );
_mesa_enable_sw_extensions(ctx->gl_ctx);
_mesa_enable_1_3_extensions(ctx->gl_ctx);
-/* $Id: wmesa.c,v 1.28 2002/04/23 18:39:09 kschultz Exp $ */
+/* $Id: wmesa.c,v 1.29 2002/06/13 04:28:30 brianp Exp $ */
/*
* Windows (Win32) device driver for Mesa 3.4
#include "dd.h"
#include "depth.h"
#include "extensions.h"
+#include "imports.h"
#include "macros.h"
#include "matrix.h"
#include "mem.h"
RECT CR;
WMesaContext c;
GLboolean true_color_flag;
+ __GLimports imports;
+
c = (struct wmesa_context * ) calloc(1,sizeof(struct wmesa_context));
if (!c)
return NULL;
return NULL;
}
+ _mesa_init_default_imports( &imports, (void *) c );
+
/* allocate a new Mesa context */
- c->gl_ctx = _mesa_create_context( c->gl_visual, NULL, c, GL_TRUE);
+ c->gl_ctx = _mesa_create_context( c->gl_visual, NULL, &imports );
if (!c->gl_ctx) {
_mesa_destroy_visual( c->gl_visual );
#include <GL\wmesa.h>\r
#include "context.h"\r
#include "dd.h"\r
+#include "imports.h"\r
#include "xform.h"\r
#include "vb.h"\r
#include "matrix.h"\r
//HDC DC;\r
RECT CR;\r
WMesaContext c;\r
+ __GLimports imports;\r
\r
c = (struct wmesa_context * ) calloc(1,sizeof(struct wmesa_context));\r
if (!c)\r
}\r
\r
/* allocate a new Mesa context */\r
- c->gl_ctx = _mesa_create_context( c->gl_visual, NULL,c);\r
+ _mesa_init_default_imports( &imports, (void *) c );\r
+ c->gl_ctx = _mesa_create_context( c->gl_visual, &imports );\r
\r
if (!c->gl_ctx) {\r
_mesa_destroy_visual( c->gl_visual );\r
-/* $Id: xm_api.c,v 1.36 2002/05/27 17:06:59 brianp Exp $ */
+/* $Id: xm_api.c,v 1.37 2002/06/13 04:28:30 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "context.h"
#include "extensions.h"
#include "glthread.h"
+#include "imports.h"
#include "matrix.h"
#include "mem.h"
#include "mmath.h"
*/
XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
{
+ static GLboolean firstTime = GL_TRUE;
XMesaContext c;
GLcontext *ctx;
- GLboolean direct = GL_TRUE; /* XXXX */
- /* NOT_DONE: should this be GL_FALSE??? */
- static GLboolean firstTime = GL_TRUE;
+ __GLimports imports;
if (firstTime) {
_glthread_INIT_MUTEX(_xmesa_lock);
return NULL;
}
+ _mesa_init_default_imports( &imports, (void *) c );
ctx = c->gl_ctx = _mesa_create_context( &v->mesa_visual,
share_list ? share_list->gl_ctx : (GLcontext *) NULL,
- (void *) c, direct );
+ &imports );
if (!c->gl_ctx) {
FREE(c);
return NULL;
*/
xmesa_init_pointers( ctx );
-
- /* Run the config file
- */
- _mesa_read_config_file( ctx );
-
-
return c;
}
buffers.c \\r
clip.c \\r
colortab.c \\r
- config.c \\r
context.c \\r
convolve.c \\r
debug.c \\r
-# $Id: Makefile.OSMesa16,v 1.6 2002/02/02 21:41:58 brianp Exp $
+# $Id: Makefile.OSMesa16,v 1.7 2002/06/13 04:28:29 brianp Exp $
# Mesa 3-D graphics library
# Version: 4.1
buffers.c \
clip.c \
colortab.c \
- config.c \
context.c \
convolve.c \
debug.c \
-# $Id: Makefile.X11,v 1.67 2002/04/09 14:58:03 keithw Exp $
+# $Id: Makefile.X11,v 1.68 2002/06/13 04:28:29 brianp Exp $
# Mesa 3-D graphics library
# Version: 4.1
buffers.c \
clip.c \
colortab.c \
- config.c \
context.c \
convolve.c \
debug.c \
buffers.c \
clip.c \
colortab.c \
- config.c \
context.c \
convolve.c \
debug.c \
buffers.c \
clip.c \
colortab.c \
- config.c \
context.c \
convolve.c \
debug.c \
-/* $Id: attrib.c,v 1.65 2002/06/07 16:01:03 brianp Exp $ */
+/* $Id: attrib.c,v 1.66 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- if (MESA_VERBOSE&VERBOSE_API)
- fprintf(stderr, "glPushAttrib %x\n", (int)mask);
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug("glPushAttrib %x\n", (int) mask);
if (ctx->AttribStackDepth >= MAX_ATTRIB_STACK_DEPTH) {
_mesa_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" );
while (attr) {
- if (MESA_VERBOSE&VERBOSE_API) {
- fprintf(stderr, "glPopAttrib %s\n",
- _mesa_lookup_enum_by_nr(attr->kind));
+ if (MESA_VERBOSE & VERBOSE_API) {
+ _mesa_debug("glPopAttrib %s\n", _mesa_lookup_enum_by_nr(attr->kind));
}
switch (attr->kind) {
-/* $Id: blend.c,v 1.34 2001/09/14 21:36:43 brianp Exp $ */
+/* $Id: blend.c,v 1.35 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "glBlendFunc %s %s\n",
+ _mesa_debug("glBlendFunc %s %s\n",
_mesa_lookup_enum_by_nr(sfactor),
_mesa_lookup_enum_by_nr(dfactor));
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "glBlendFuncSeparate %s %s %s %s\n",
+ _mesa_debug("glBlendFuncSeparate %s %s %s %s\n",
_mesa_lookup_enum_by_nr(sfactorRGB),
_mesa_lookup_enum_by_nr(dfactorRGB),
_mesa_lookup_enum_by_nr(sfactorA),
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "glBlendEquation %s\n",
+ _mesa_debug("glBlendEquation %s\n",
_mesa_lookup_enum_by_nr(mode));
switch (mode) {
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glColorMask %d %d %d %d\n", red, green, blue, alpha);
+ _mesa_debug("glColorMask %d %d %d %d\n", red, green, blue, alpha);
/* Shouldn't have any information about channel depth in core mesa
* -- should probably store these as the native booleans:
-/* $Id: buffers.c,v 1.34 2002/04/19 00:23:08 brianp Exp $ */
+/* $Id: buffers.c,v 1.35 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glClear 0x%x\n", mask);
+ _mesa_debug("glClear 0x%x\n", mask);
if (mask & ~(GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT |
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug("glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(mode));
switch (mode) {
case GL_AUX0:
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug("glReadBuffer %s\n", _mesa_lookup_enum_by_nr(mode));
switch (mode) {
case GL_AUX0:
GLcontext *ctx = _mesa_get_current_context();
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glResizeBuffersMESA\n");
+ _mesa_debug("glResizeBuffersMESA\n");
if (ctx) {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
}
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glScissor %d %d %d %d\n", x, y, width, height);
+ _mesa_debug("glScissor %d %d %d %d\n", x, y, width, height);
if (x == ctx->Scissor.X &&
y == ctx->Scissor.Y &&
-/* $Id: context.c,v 1.163 2002/05/27 17:04:52 brianp Exp $ */
+/* $Id: context.c,v 1.164 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "get.h"
#include "glthread.h"
#include "hash.h"
-#include "imports.h"
#include "light.h"
#include "macros.h"
#include "mem.h"
#endif
+static void
+free_shared_state( GLcontext *ctx, struct gl_shared_state *ss );
+
/**********************************************************************/
/***** OpenGL SI-style interface (new in Mesa 3.5) *****/
/**********************************************************************/
-static GLboolean
-_mesa_DestroyContext(__GLcontext *gc)
+/* Called by window system/device driver (via gc->exports.destroyCurrent())
+ * when the rendering context is to be destroyed.
+ */
+GLboolean
+_mesa_destroyContext(__GLcontext *gc)
{
if (gc) {
_mesa_free_context_data(gc);
return GL_TRUE;
}
+/* Called by window system/device driver (via gc->exports.loseCurrent())
+ * when the rendering context is made non-current.
+ */
+GLboolean
+_mesa_loseCurrent(__GLcontext *gc)
+{
+ /* XXX unbind context from thread */
+ return GL_TRUE;
+}
+
+/* Called by window system/device driver (via gc->exports.makeCurrent())
+ * when the rendering context is made current.
+ */
+GLboolean
+_mesa_makeCurrent(__GLcontext *gc)
+{
+ /* XXX bind context to thread */
+ return GL_TRUE;
+}
+
+/* Called by window system/device driver - yadda, yadda, yadda.
+ * See above comments.
+ */
+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;
+ }
+}
+
+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;
+ }
+}
+
+GLboolean
+_mesa_forceCurrent(__GLcontext *gc)
+{
+ return GL_TRUE;
+}
+
+GLboolean
+_mesa_notifyResize(__GLcontext *gc)
+{
+ GLint x, y;
+ GLuint width, height;
+ __GLdrawablePrivate *d = gc->imports.getDrawablePrivate(gc);
+ if (!d || !d->getDrawableSize)
+ return GL_FALSE;
+ d->getDrawableSize( d, &x, &y, &width, &height );
+ /* update viewport, resize software buffers, etc. */
+ return GL_TRUE;
+}
+
+void
+_mesa_notifyDestroy(__GLcontext *gc)
+{
+}
+
+/* Called by window system just before swapping buffers.
+ * We have to finish any pending rendering.
+ */
+void
+_mesa_notifySwapBuffers(__GLcontext *gc)
+{
+ FLUSH_VERTICES( gc, 0 );
+}
+
+struct __GLdispatchStateRec *
+_mesa_dispatchExec(__GLcontext *gc)
+{
+ return NULL;
+}
+
+void
+_mesa_beginDispatchOverride(__GLcontext *gc)
+{
+}
+
+void
+_mesa_endDispatchOverride(__GLcontext *gc)
+{
+}
+
+/* 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).
+ */
+static void
+_mesa_init_default_exports(__GLexports *exports)
+{
+ 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_notifyCestroy;
+ exports->notifySwapBuffers = _mesa_notifySwapBuffers;
+ exports->dispatchExec = _mesa_dispatchExec;
+ exports->beginDispatchOverride = _mesa_beginDispatchOverride;
+ exports->endDispatchOverride = _mesa_endDispatchOverride;
+}
+
+
/* exported OpenGL SI interface */
__GLcontext *
if (ctx == NULL) {
return NULL;
}
- ctx->Driver.CurrentExecPrimitive=0;
+ ctx->Driver.CurrentExecPrimitive=0; /* XXX why is this here??? */
ctx->imports = *imports;
_mesa_initialize_visual(&ctx->Visual,
modes->accumAlphaBits,
0);
- /* KW: was imports->wscx */
- _mesa_initialize_context(ctx, &ctx->Visual, NULL, imports->other, GL_FALSE);
-
- ctx->exports.destroyContext = _mesa_DestroyContext;
+ _mesa_initialize_context(ctx, &ctx->Visual, NULL, imports);
return ctx;
}
}
-/**********************************************************************/
-/***** Context and Thread management *****/
-/**********************************************************************/
-
-
-
/**********************************************************************/
/***** GL Visual allocation/destruction *****/
/**********************************************************************/
_mesa_initialize_context( GLcontext *ctx,
const GLvisual *visual,
GLcontext *share_list,
- void *driver_ctx,
- GLboolean direct )
+ const __GLimports *imports )
{
GLuint dispatchSize;
- (void) direct; /* not used */
+ ASSERT(imports);
+ ASSERT(imports->other); /* other points to the device driver's context */
/* misc one-time initializations */
one_time_init();
+ /* initialize the exports (Mesa functions called by the window system) */
+ _mesa_init_default_exports( &(ctx->exports) );
+
+#if 0
/**
** OpenGL SI stuff
**/
if (!ctx->imports.malloc) {
- _mesa_InitDefaultImports(&ctx->imports, driver_ctx, NULL);
+ _mesa_init_default_imports(&ctx->imports, driver_ctx);
}
/* exports are setup by the device driver */
+#endif
- ctx->DriverCtx = driver_ctx;
+ ctx->DriverCtx = imports->other;
ctx->Visual = *visual;
ctx->DrawBuffer = NULL;
ctx->ReadBuffer = NULL;
* Allocate and initialize a GLcontext structure.
* Input: visual - a GLvisual pointer (we copy the struct contents)
* sharelist - another context to share display lists with or NULL
- * driver_ctx - pointer to device driver's context state struct
+ * imports - points to a fully-initialized __GLimports object.
* Return: pointer to a new __GLcontextRec or NULL if error.
*/
GLcontext *
_mesa_create_context( const GLvisual *visual,
GLcontext *share_list,
- void *driver_ctx,
- GLboolean direct )
+ const __GLimports *imports )
{
GLcontext *ctx = (GLcontext *) CALLOC( sizeof(GLcontext) );
if (!ctx) {
return NULL;
}
- ctx->Driver.CurrentExecPrimitive = 0;
- if (_mesa_initialize_context(ctx, visual, share_list, driver_ctx, direct)) {
+ ctx->Driver.CurrentExecPrimitive = 0; /* XXX why is this here??? */
+ if (_mesa_initialize_context(ctx, visual, share_list, imports)) {
return ctx;
}
else {
}
-/*
- * Set the current context, binding the given frame buffer to the context.
- */
-void
-_mesa_make_current( GLcontext *newCtx, GLframebuffer *buffer )
-{
- _mesa_make_current2( newCtx, buffer, buffer );
-}
-
static void print_info( void )
{
}
+/*
+ * Set the current context, binding the given frame buffer to the context.
+ */
+void
+_mesa_make_current( GLcontext *newCtx, GLframebuffer *buffer )
+{
+ _mesa_make_current2( newCtx, buffer, buffer );
+}
+
+
/*
* Bind the given context to the given draw-buffer and read-buffer
* and make it the current context for this thread.
}
+/*
+ * Call this to report debug information.
+ */
+#ifdef DEBUG
+void
+_mesa_debug( const char *fmtString, ... )
+{
+ va_list args;
+ va_start( args, fmtString );
+ (void) vfprintf( stderr, fmtString, args );
+ va_end( args );
+}
+#endif
+
void
_mesa_Finish( void )
-/* $Id: context.h,v 1.28 2001/12/14 02:50:01 brianp Exp $ */
+/* $Id: context.h,v 1.29 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
/*
- * Create/destroy a GLvisual. A GLvisual is like a GLX visual. It describes
- * the colorbuffer, depth buffer, stencil buffer and accum buffer which will
- * be used by the GL context and framebuffer.
+ * Create/destroy a GLvisual.
*/
extern GLvisual *
_mesa_create_visual( GLboolean rgbFlag,
/*
- * Create/destroy a GLframebuffer. A GLframebuffer is like a GLX drawable.
- * It bundles up the depth buffer, stencil buffer and accum buffers into a
- * single entity.
+ * Create/destroy a GLframebuffer.
*/
extern GLframebuffer *
_mesa_create_framebuffer( const GLvisual *visual,
/*
- * Create/destroy a GLcontext. A GLcontext is like a GLX context. It
- * contains the rendering state.
+ * Create/destroy a GLcontext.
*/
extern GLcontext *
_mesa_create_context( const GLvisual *visual,
GLcontext *share_list,
- void *driver_ctx,
- GLboolean direct);
+ const __GLimports *imports );
extern GLboolean
_mesa_initialize_context( GLcontext *ctx,
const GLvisual *visual,
GLcontext *share_list,
- void *driver_ctx,
- GLboolean direct );
+ const __GLimports *imports );
extern void
_mesa_free_context_data( GLcontext *ctx );
+/* 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_swapbuffers(GLcontext *ctx);
+_mesa_notifyDestroy(__GLcontext *gc);
+
+extern void
+_mesa_notifySwapBuffers(__GLcontext *gc);
+
+extern void
+_mesa_dispatchExec(__GLcontext *gc);
+
+extern void
+_mesa_beginDispatchOverride(__GLcontext *gc);
+
+extern void
+_mesa_endDispatchOverride(__GLcontext *gc);
+
+
+extern void
+_mesa_swapbuffers(GLcontext *ctx);
+
extern struct _glapi_table *
_mesa_get_dispatch(GLcontext *ctx);
extern void
_mesa_error( GLcontext *ctx, GLenum error, const char *s );
-
+#ifdef DEBUG
+extern void
+_mesa_debug( const char *fmtString, ... );
+#endif
extern void
_mesa_Finish( void );
_mesa_Flush( void );
-
-extern void
-_mesa_read_config_file(GLcontext *ctx);
-
-extern void
-_mesa_register_config_var(const char *name,
- void (*notify)( const char *, int ));
-
-
#endif
-/* $Id: depth.c,v 1.28 2001/03/29 16:50:32 brianp Exp $ */
+/* $Id: depth.c,v 1.29 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func));
+ _mesa_debug("glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func));
switch (func) {
case GL_LESS: /* (default) pass if incoming z < stored z */
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- fprintf(stderr, "glDepthMask %d\n", flag);
+ _mesa_debug("glDepthMask %d\n", flag);
/*
* GL_TRUE indicates depth buffer writing is enabled (default)
-/* $Id: dlist.c,v 1.88 2002/05/29 15:16:01 brianp Exp $ */
+/* $Id: dlist.c,v 1.89 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
if (ctx->Driver.BeginCallList)
ctx->Driver.BeginCallList( ctx, list );
-/* fprintf(stderr, "execute list %d\n", list); */
+/* _mesa_debug("execute list %d\n", list); */
/* mesa_print_display_list( list ); */
ctx->CallDepth++;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- fprintf(stderr, "glNewList %u %s\n", list, _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug("glNewList %u %s\n", list, _mesa_lookup_enum_by_nr(mode));
if (list==0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glNewList" );
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- fprintf(stderr, "glEndList\n");
+ _mesa_debug("glEndList\n");
/* Check that a list is under construction */
if (!ctx->CurrentListPtr) {
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "_mesa_CallList %d\n", list);
+ _mesa_debug("_mesa_CallList %d\n", list);
/* mesa_print_display_list( list ); */
GLboolean save_compile_flag;
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "_mesa_CallLists %d\n", n);
+ _mesa_debug("_mesa_CallLists %d\n", n);
/* Save the CompileFlag status, turn it off, execute display list,
* and restore the CompileFlag.
-/* $Id: enable.c,v 1.63 2002/05/27 17:04:53 brianp Exp $ */
+/* $Id: enable.c,v 1.64 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
{
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "%s %s (newstate is %x)\n",
- state ? "glEnable" : "glDisable",
- _mesa_lookup_enum_by_nr(cap),
- ctx->NewState);
+ _mesa_debug("%s %s (newstate is %x)\n",
+ state ? "glEnable" : "glDisable",
+ _mesa_lookup_enum_by_nr(cap),
+ ctx->NewState);
switch (cap) {
case GL_ALPHA_TEST:
-/* $Id: feedback.c,v 1.24 2001/03/29 17:08:26 keithw Exp $ */
+/* $Id: feedback.c,v 1.25 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glRenderMode %s\n", _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug("glRenderMode %s\n", _mesa_lookup_enum_by_nr(mode));
FLUSH_VERTICES(ctx, _NEW_RENDERMODE);
-/* $Id: get.c,v 1.79 2002/05/27 17:04:53 brianp Exp $ */
+/* $Id: get.c,v 1.80 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glGetBooleanv %s\n", _mesa_lookup_enum_by_nr(pname));
+ _mesa_debug("glGetBooleanv %s\n", _mesa_lookup_enum_by_nr(pname));
if (ctx->Driver.GetBooleanv
&& (*ctx->Driver.GetBooleanv)(ctx, pname, params))
FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glGetDoublev %s\n", _mesa_lookup_enum_by_nr(pname));
+ _mesa_debug("glGetDoublev %s\n", _mesa_lookup_enum_by_nr(pname));
if (ctx->Driver.GetDoublev && (*ctx->Driver.GetDoublev)(ctx, pname, params))
return;
FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glGetFloatv %s\n", _mesa_lookup_enum_by_nr(pname));
+ _mesa_debug("glGetFloatv %s\n", _mesa_lookup_enum_by_nr(pname));
if (ctx->Driver.GetFloatv && (*ctx->Driver.GetFloatv)(ctx, pname, params))
return;
FLUSH_VERTICES(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glGetIntegerv %s\n", _mesa_lookup_enum_by_nr(pname));
+ _mesa_debug("glGetIntegerv %s\n", _mesa_lookup_enum_by_nr(pname));
if (ctx->Driver.GetIntegerv
&& (*ctx->Driver.GetIntegerv)(ctx, pname, params))
return;
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname));
+ _mesa_debug("glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname));
if (ctx->Driver.GetPointerv
&& (*ctx->Driver.GetPointerv)(ctx, pname, params))
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e));
+ _mesa_debug("glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e));
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
return e;
-/* $Id: glheader.h,v 1.26 2002/06/12 00:52:50 brianp Exp $ */
+/* $Id: glheader.h,v 1.27 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
#include "conf.h"
#endif
+#ifdef DEBUG
+#include <stdarg.h> /* for _mesa_debug() only */
+#endif
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
-/* $Id: hint.c,v 1.10 2001/05/21 16:41:03 brianp Exp $ */
+/* $Id: hint.c,v 1.11 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
_mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode )
{
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glHint %s %d\n", _mesa_lookup_enum_by_nr(target), mode);
+ _mesa_debug("glHint %s %d\n", _mesa_lookup_enum_by_nr(target), mode);
if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) {
_mesa_error(ctx, GL_INVALID_ENUM, "glHint(mode)");
-/* $Id: imports.c,v 1.10 2001/07/16 15:54:23 brianp Exp $ */
+/* $Id: imports.c,v 1.11 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* will call these functions in order to do memory allocation, simple I/O,
* etc.
*
- * Some drivers will need to implement these functions themselves but
- * many (most?) Mesa drivers will be fine using these.
+ * Some drivers will want to provide a specialed __GLimport object, but
+ * most Mesa drivers will be able to call _mesa_init_default_imports()
+ * and go with that.
*
* A server-side GL renderer will likely not use these functions since
* the renderer should use the XFree86-wrapped system calls.
static int CAPI
_mesa_sprintf(__GLcontext *gc, char *str, const char *fmt, ...)
{
- /* XXX fix this */
- return sprintf(str, fmt);
+ int r;
+ va_list args;
+ va_start( args, fmt );
+ r = vsprintf( str, fmt, args );
+ va_end( args );
+ return r;
}
static void * CAPI
static int CAPI
_mesa_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...)
{
- /* XXX fix this */
- return fprintf((FILE *) stream, fmt);
+ int r;
+ va_list args;
+ va_start( args, fmt );
+ r = vfprintf( (FILE *) stream, fmt, args );
+ va_end( args );
+ return r;
}
/* XXX this really is driver-specific and can't be here */
void
-_mesa_InitDefaultImports(__GLimports *imports, void *driverCtx, void *other)
+_mesa_init_default_imports(__GLimports *imports, void *driverCtx)
{
imports->malloc = _mesa_Malloc;
imports->calloc = _mesa_Calloc;
imports->fclose = _mesa_fclose;
imports->fprintf = _mesa_fprintf;
imports->getDrawablePrivate = _mesa_GetDrawablePrivate;
-/* imports->wscx = driverCtx; */
imports->other = driverCtx;
}
-/* $Id: imports.h,v 1.2 2001/03/12 00:48:38 gareth Exp $ */
+/* $Id: imports.h,v 1.3 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
extern void
-_mesa_InitDefaultImports(__GLimports *imports, void *driverCtx, void *other);
+_mesa_init_default_imports(__GLimports *imports, void *driverCtx);
#endif
-/* $Id: light.c,v 1.49 2002/02/13 00:53:19 keithw Exp $ */
+/* $Id: light.c,v 1.50 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode));
+ _mesa_debug("glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode));
if (mode != GL_FLAT && mode != GL_SMOOTH) {
_mesa_error( ctx, GL_INVALID_ENUM, "glShadeModel" );
bitmask &= ~ctx->Light.ColorMaterialBitmask;
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
- fprintf(stderr, "_mesa_update_material, mask 0x%x\n", bitmask);
+ _mesa_debug("_mesa_update_material, mask 0x%x\n", bitmask);
if (!bitmask)
return;
if (0)
{
struct gl_material *mat = &ctx->Light.Material[0];
- fprintf(stderr, "update_mat emission : %f %f %f\n",
+ _mesa_debug("update_mat emission : %f %f %f\n",
mat->Emission[0],
mat->Emission[1],
mat->Emission[2]);
- fprintf(stderr, "update_mat specular : %f %f %f\n",
+ _mesa_debug("update_mat specular : %f %f %f\n",
mat->Specular[0],
mat->Specular[1],
mat->Specular[2]);
- fprintf(stderr, "update_mat diffuse : %f %f %f\n",
+ _mesa_debug("update_mat diffuse : %f %f %f\n",
mat->Diffuse[0],
mat->Diffuse[1],
mat->Diffuse[2]);
- fprintf(stderr, "update_mat ambient : %f %f %f\n",
+ _mesa_debug("update_mat ambient : %f %f %f\n",
mat->Ambient[0],
mat->Ambient[1],
mat->Ambient[2]);
GLuint bitmask = ctx->Light.ColorMaterialBitmask;
if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
- fprintf(stderr, "_mesa_update_color_material, mask 0x%x\n", bitmask);
+ _mesa_debug("_mesa_update_color_material, mask 0x%x\n", bitmask);
/* update emissive colors */
if (bitmask & FRONT_EMISSION_BIT) {
if (0)
{
struct gl_material *mat = &ctx->Light.Material[0];
- fprintf(stderr, "update_color_mat emission : %f %f %f\n",
+ _mesa_debug("update_color_mat emission : %f %f %f\n",
mat->Emission[0],
mat->Emission[1],
mat->Emission[2]);
- fprintf(stderr, "update_color_mat specular : %f %f %f\n",
+ _mesa_debug("update_color_mat specular : %f %f %f\n",
mat->Specular[0],
mat->Specular[1],
mat->Specular[2]);
- fprintf(stderr, "update_color_mat diffuse : %f %f %f\n",
+ _mesa_debug("update_color_mat diffuse : %f %f %f\n",
mat->Diffuse[0],
mat->Diffuse[1],
mat->Diffuse[2]);
- fprintf(stderr, "update_color_mat ambient : %f %f %f\n",
+ _mesa_debug("update_color_mat ambient : %f %f %f\n",
mat->Ambient[0],
mat->Ambient[1],
mat->Ambient[2]);
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- fprintf(stderr, "glColorMaterial %s %s\n",
+ _mesa_debug("glColorMaterial %s %s\n",
_mesa_lookup_enum_by_nr(face),
_mesa_lookup_enum_by_nr(mode));
-/* $Id: matrix.c,v 1.40 2002/04/22 20:00:16 alanh Exp $ */
+/* $Id: matrix.c,v 1.41 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
* Version: 4.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- fprintf(stderr, "glPushMatrix %s\n",
+ _mesa_debug("glPushMatrix %s\n",
_mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
if (stack->Depth + 1 >= stack->MaxDepth) {
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- fprintf(stderr, "glPopMatrix %s\n",
+ _mesa_debug("glPopMatrix %s\n",
_mesa_lookup_enum_by_nr(ctx->Transform.MatrixMode));
if (stack->Depth == 0) {
}
if (MESA_VERBOSE & VERBOSE_API)
- fprintf(stderr, "glViewport %d %d %d %d\n", x, y, width, height);
+ _mesa_debug("glViewport %d %d %d %d\n", x, y, width, height);
/* clamp width, and height to implementation dependent range */
width = CLAMP( width, 1, MAX_WIDTH );
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (MESA_VERBOSE&VERBOSE_API)
- fprintf(stderr, "glDepthRange %f %f\n", nearval, farval);
+ _mesa_debug("glDepthRange %f %f\n", nearval, farval);
n = (GLfloat) CLAMP( nearval, 0.0, 1.0 );
f = (GLfloat) CLAMP( farval, 0.0, 1.0 );
-/* $Id: mtypes.h,v 1.77 2002/06/06 16:31:24 brianp Exp $ */
+/* $Id: mtypes.h,v 1.78 2002/06/13 04:28:29 brianp Exp $ */
/*
* Mesa 3-D graphics library
* GL_LUMINANCE_ALPHA, GL_RGB, GL_RGBA,
* GL_COLOR_INDEX or GL_DEPTH_COMPONENT.
*/
- GLenum Type; /* Internal type as GL enum value */
+ GLenum Type; /* Internal type as GL enum value - UNUSED?? */
GLubyte RedBits; /* Bits per texel component */
GLubyte GreenBits;
/**
* This is the central context data structure for Mesa. Almost all
* OpenGL state is contained in this structure.
+ * Think of this as a base class from which device drivers will derive
+ * sub classes.
*/
struct __GLcontextRec {
/**