From 306d3fcdbad523428501833405e47e9897896def Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 9 Apr 2002 16:56:50 +0000 Subject: bring in changes from dri tcl branch --- src/mesa/main/api_arrayelt.c | 6 ++--- src/mesa/main/api_noop.c | 52 ++++++++++++++++++++++++++++++------- src/mesa/main/api_noop.h | 30 ++++++++++++++------- src/mesa/main/context.c | 62 ++++++++++++++++++++++++++++++++++---------- src/mesa/main/dlist.c | 15 +++++++---- src/mesa/main/mtypes.h | 35 +++++++++++++++---------- src/mesa/main/state.c | 4 +-- src/mesa/main/vtxfmt.c | 11 ++------ 8 files changed, 151 insertions(+), 64 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 98be1699ea..a0b7f15599 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1,4 +1,4 @@ -/* $Id: api_arrayelt.c,v 1.6 2002/01/14 16:06:35 brianp Exp $ */ +/* $Id: api_arrayelt.c,v 1.7 2002/04/09 16:56:50 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -63,7 +63,7 @@ typedef struct { static void (*colorfuncs[2][8])( const void * ) = { { (array_func)glColor3bv, - (array_func)glColor3ub, + (array_func)glColor3ubv, (array_func)glColor3sv, (array_func)glColor3usv, (array_func)glColor3iv, @@ -72,7 +72,7 @@ static void (*colorfuncs[2][8])( const void * ) = { (array_func)glColor3dv }, { (array_func)glColor4bv, - (array_func)glColor4ub, + (array_func)glColor4ubv, (array_func)glColor4sv, (array_func)glColor4usv, (array_func)glColor4iv, diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index b603b74f5e..a44322749e 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -1,4 +1,4 @@ -/* $Id: api_noop.c,v 1.9 2001/12/14 02:50:01 brianp Exp $ */ +/* $Id: api_noop.c,v 1.10 2002/04/09 16:56:50 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -249,7 +249,7 @@ void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ) } } -void _mesa_noop_MultiTexCoord1fvARB( GLenum target, GLfloat *v ) +void _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -283,7 +283,7 @@ void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ) } } -void _mesa_noop_MultiTexCoord2fvARB( GLenum target, GLfloat *v ) +void _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -317,7 +317,7 @@ void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat } } -void _mesa_noop_MultiTexCoord3fvARB( GLenum target, GLfloat *v ) +void _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -352,7 +352,7 @@ void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, } } -void _mesa_noop_MultiTexCoord4fvARB( GLenum target, GLfloat *v ) +void _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLuint unit = target - GL_TEXTURE0_ARB; @@ -419,7 +419,7 @@ void _mesa_noop_TexCoord1f( GLfloat a ) dest[3] = 1; } -void _mesa_noop_TexCoord1fv( GLfloat *v ) +void _mesa_noop_TexCoord1fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -439,7 +439,7 @@ void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ) dest[3] = 1; } -void _mesa_noop_TexCoord2fv( GLfloat *v ) +void _mesa_noop_TexCoord2fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -459,7 +459,7 @@ void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ) dest[3] = 1; } -void _mesa_noop_TexCoord3fv( GLfloat *v ) +void _mesa_noop_TexCoord3fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -479,7 +479,7 @@ void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) COPY_FLOAT(dest[3], d); } -void _mesa_noop_TexCoord4fv( GLfloat *v ) +void _mesa_noop_TexCoord4fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); GLfloat *dest = ctx->Current.Attrib[VERT_ATTRIB_TEX0]; @@ -489,6 +489,40 @@ void _mesa_noop_TexCoord4fv( GLfloat *v ) COPY_FLOAT(dest[3], v[3]); } +/* Useful outside begin/end? + */ +void _mesa_noop_Vertex2fv( const GLfloat *v ) +{ + (void) v; +} + +void _mesa_noop_Vertex3fv( const GLfloat *v ) +{ + (void) v; +} + +void _mesa_noop_Vertex4fv( const GLfloat *v ) +{ + (void) v; +} + +void _mesa_noop_Vertex2f( GLfloat a, GLfloat b ) +{ + (void) a; (void) b; +} + +void _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ) +{ + (void) a; (void) b; (void) c; +} + +void _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ) +{ + (void) a; (void) b; (void) c; (void) d; +} + + + void _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { diff --git a/src/mesa/main/api_noop.h b/src/mesa/main/api_noop.h index 14fb9fcc2b..de099bbe0a 100644 --- a/src/mesa/main/api_noop.h +++ b/src/mesa/main/api_noop.h @@ -1,4 +1,4 @@ -/* $Id: api_noop.h,v 1.4 2001/12/14 02:50:01 brianp Exp $ */ +/* $Id: api_noop.h,v 1.5 2002/04/09 16:56:50 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -75,22 +75,22 @@ extern void _mesa_noop_Color3fv( const GLfloat *v ); extern void _mesa_noop_MultiTexCoord1fARB( GLenum target, GLfloat a ); -extern void _mesa_noop_MultiTexCoord1fvARB( GLenum target, GLfloat *v ); +extern void _mesa_noop_MultiTexCoord1fvARB( GLenum target, const GLfloat *v ); extern void _mesa_noop_MultiTexCoord2fARB( GLenum target, GLfloat a, GLfloat b ); -extern void _mesa_noop_MultiTexCoord2fvARB( GLenum target, GLfloat *v ); +extern void _mesa_noop_MultiTexCoord2fvARB( GLenum target, const GLfloat *v ); extern void _mesa_noop_MultiTexCoord3fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c); -extern void _mesa_noop_MultiTexCoord3fvARB( GLenum target, GLfloat *v ); +extern void _mesa_noop_MultiTexCoord3fvARB( GLenum target, const GLfloat *v ); extern void _mesa_noop_MultiTexCoord4fARB( GLenum target, GLfloat a, GLfloat b, GLfloat c, GLfloat d ); -extern void _mesa_noop_MultiTexCoord4fvARB( GLenum target, GLfloat *v ); +extern void _mesa_noop_MultiTexCoord4fvARB( GLenum target, const GLfloat *v ); extern void _mesa_noop_SecondaryColor3ubEXT( GLubyte a, GLubyte b, GLubyte c ); @@ -102,19 +102,31 @@ extern void _mesa_noop_SecondaryColor3fvEXT( const GLfloat *v ); extern void _mesa_noop_TexCoord1f( GLfloat a ); -extern void _mesa_noop_TexCoord1fv( GLfloat *v ); +extern void _mesa_noop_TexCoord1fv( const GLfloat *v ); extern void _mesa_noop_TexCoord2f( GLfloat a, GLfloat b ); -extern void _mesa_noop_TexCoord2fv( GLfloat *v ); +extern void _mesa_noop_TexCoord2fv( const GLfloat *v ); extern void _mesa_noop_TexCoord3f( GLfloat a, GLfloat b, GLfloat c ); -extern void _mesa_noop_TexCoord3fv( GLfloat *v ); +extern void _mesa_noop_TexCoord3fv( const GLfloat *v ); extern void _mesa_noop_TexCoord4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); -extern void _mesa_noop_TexCoord4fv( GLfloat *v ); +extern void _mesa_noop_TexCoord4fv( const GLfloat *v ); + +extern void _mesa_noop_Vertex2fv( const GLfloat *v ); + +extern void _mesa_noop_Vertex3fv( const GLfloat *v ); + +extern void _mesa_noop_Vertex4fv( const GLfloat *v ); + +extern void _mesa_noop_Vertex2f( GLfloat a, GLfloat b ); + +extern void _mesa_noop_Vertex3f( GLfloat a, GLfloat b, GLfloat c ); + +extern void _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLfloat d ); extern void _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 969b320a44..154164d165 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.159 2002/04/09 14:58:03 keithw Exp $ */ +/* $Id: context.c,v 1.160 2002/04/09 16:56:50 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -70,22 +70,11 @@ #endif #ifndef MESA_VERBOSE -int MESA_VERBOSE = 0 -/* | VERBOSE_PIPELINE */ -/* | VERBOSE_IMMEDIATE */ -/* | VERBOSE_VARRAY */ -/* | VERBOSE_TEXTURE */ -/* | VERBOSE_API */ -/* | VERBOSE_DRIVER */ -/* | VERBOSE_STATE */ -/* | VERBOSE_DISPLAY_LIST */ -; +int MESA_VERBOSE = 0; #endif #ifndef MESA_DEBUG_FLAGS -int MESA_DEBUG_FLAGS = 0 -/* | DEBUG_ALWAYS_FLUSH */ -; +int MESA_DEBUG_FLAGS = 0; #endif @@ -1434,6 +1423,44 @@ alloc_proxy_textures( GLcontext *ctx ) } +static void add_debug_flags( const char *debug ) +{ +#ifdef MESA_DEBUG + if (strstr(debug, "varray")) + MESA_VERBOSE |= VERBOSE_VARRAY; + + if (strstr(debug, "tex")) + MESA_VERBOSE |= VERBOSE_TEXTURE; + + if (strstr(debug, "imm")) + MESA_VERBOSE |= VERBOSE_IMMEDIATE; + + if (strstr(debug, "pipe")) + MESA_VERBOSE |= VERBOSE_PIPELINE; + + if (strstr(debug, "driver")) + MESA_VERBOSE |= VERBOSE_DRIVER; + + if (strstr(debug, "state")) + MESA_VERBOSE |= VERBOSE_STATE; + + if (strstr(debug, "api")) + MESA_VERBOSE |= VERBOSE_API; + + if (strstr(debug, "list")) + MESA_VERBOSE |= VERBOSE_DISPLAY_LIST; + + if (strstr(debug, "lighting")) + MESA_VERBOSE |= VERBOSE_LIGHTING; + + /* Debug flag: + */ + if (strstr(debug, "flush")) + MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH; +#endif +} + + /* * Initialize a GLcontext struct. This includes allocating all the * other structs and arrays which hang off of the context by pointers. @@ -1597,6 +1624,13 @@ _mesa_initialize_context( GLcontext *ctx, trInitDispatch(ctx->TraceDispatch); #endif + + if (getenv("MESA_DEBUG")) + add_debug_flags(getenv("MESA_DEBUG")); + + if (getenv("MESA_VERBOSE")) + add_debug_flags(getenv("MESA_VERBOSE")); + return GL_TRUE; } diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index e2224a1046..99d477e7a4 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.85 2002/04/02 16:15:17 brianp Exp $ */ +/* $Id: dlist.c,v 1.86 2002/04/09 16:56:50 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -5065,12 +5065,11 @@ _mesa_EndList( void ) { GET_CURRENT_CONTEXT(ctx); FLUSH_CURRENT(ctx, 0); /* must be called before assert */ - ASSERT_OUTSIDE_BEGIN_END(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE&VERBOSE_API) fprintf(stderr, "glEndList\n"); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx ); /* ??? */ - /* Check that a list is under construction */ if (!ctx->CurrentListPtr) { _mesa_error( ctx, GL_INVALID_OPERATION, "glEndList" ); @@ -5097,7 +5096,6 @@ _mesa_EndList( void ) ctx->CurrentDispatch = ctx->Exec; _glapi_set_dispatch( ctx->CurrentDispatch ); - } @@ -5111,6 +5109,10 @@ _mesa_CallList( GLuint list ) /* VERY IMPORTANT: Save the CompileFlag status, turn it off, */ /* execute the display list, and restore the CompileFlag. */ + + if (MESA_VERBOSE & VERBOSE_API) + fprintf(stderr, "_mesa_CallList %d\n", list); + /* mesa_print_display_list( list ); */ save_compile_flag = ctx->CompileFlag; @@ -5141,6 +5143,9 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ) GLint i; GLboolean save_compile_flag; + if (MESA_VERBOSE & VERBOSE_API) + fprintf(stderr, "_mesa_CallLists %d\n", n); + /* Save the CompileFlag status, turn it off, execute display list, * and restore the CompileFlag. */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a815473830..4eec17874e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.69 2002/03/29 17:27:59 brianp Exp $ */ +/* $Id: mtypes.h,v 1.70 2002/04/09 16:56:50 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -1810,6 +1810,9 @@ struct __GLcontextRec { /* The string names for GL_POINT, GL_LINE_LOOP, etc */ extern const char *_mesa_prim_name[GL_POLYGON+4]; +#ifndef MESA_DEBUG +#define MESA_DEBUG +#endif #ifdef MESA_DEBUG extern int MESA_VERBOSE; @@ -1831,8 +1834,10 @@ enum _verbose { VERBOSE_DRIVER = 0x0010, VERBOSE_STATE = 0x0020, VERBOSE_API = 0x0040, - VERBOSE_DISPLAY_LIST = 0x0200, - VERBOSE_LIGHTING = 0x0400 + VERBOSE_DISPLAY_LIST = 0x0100, + VERBOSE_LIGHTING = 0x0200, + VERBOSE_PRIMS = 0x0400, + VERBOSE_VERTS = 0x0800 }; @@ -1848,18 +1853,22 @@ enum _debug { /* Eventually let the driver specify what statechanges require a flush: */ -#define FLUSH_VERTICES(ctx, newstate) \ -do { \ - if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ - ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \ - ctx->NewState |= newstate; \ +#define FLUSH_VERTICES(ctx, newstate) \ +do { \ + if (MESA_VERBOSE & VERBOSE_STATE) \ + fprintf(stderr, "FLUSH_VERTICES in %s\n", __FUNCTION__); \ + if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ + ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \ + ctx->NewState |= newstate; \ } while (0) -#define FLUSH_CURRENT(ctx, newstate) \ -do { \ - if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \ - ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \ - ctx->NewState |= newstate; \ +#define FLUSH_CURRENT(ctx, newstate) \ +do { \ + if (MESA_VERBOSE & VERBOSE_STATE) \ + fprintf(stderr, "FLUSH_CURRENT in %s\n", __FUNCTION__); \ + if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \ + ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \ + ctx->NewState |= newstate; \ } while (0) #define ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, retval) \ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index e705f14d4d..c1657125f8 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.80 2002/04/02 16:15:17 brianp Exp $ */ +/* $Id: state.c,v 1.81 2002/04/09 16:56:50 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -910,7 +910,7 @@ void _mesa_update_state( GLcontext *ctx ) const GLuint oldneedeyecoords = ctx->_NeedEyeCoords; if (MESA_VERBOSE & VERBOSE_STATE) - _mesa_print_state("", new_state); + _mesa_print_state("_mesa_update_state", new_state); if (new_state & _NEW_MODELVIEW) _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 599dce1bf2..14b8e8381a 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -1,4 +1,4 @@ -/* $Id: vtxfmt.c,v 1.10 2001/12/15 02:14:43 brianp Exp $ */ +/* $Id: vtxfmt.c,v 1.11 2002/04/09 16:56:50 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -50,14 +50,6 @@ { \ GET_CURRENT_CONTEXT(ctx); \ struct gl_tnl_module *tnl = &(ctx->TnlModule); \ - const GLuint new_state = ctx->NewState; \ - \ - if ( new_state ) \ - _mesa_update_state( ctx ); \ - \ - /* Validate the current tnl module. */ \ - if ( new_state & ctx->Driver.NeedValidate ) \ - ctx->Driver.ValidateTnlModule( ctx, new_state ); \ \ ASSERT( tnl->Current ); \ ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \ @@ -149,6 +141,7 @@ static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt ) void _mesa_init_exec_vtxfmt( GLcontext *ctx ) { install_vtxfmt( ctx->Exec, &neutral_vtxfmt ); + ctx->TnlModule.SwapCount = 0; } -- cgit v1.2.3