From: Brian Paul Date: Tue, 25 Nov 2003 15:58:22 +0000 (+0000) Subject: Remove unnecessary usage of __FUNCTION__. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b65bc4f87b356cf6228151cd2f341432e80dc6b8;p=mesa.git Remove unnecessary usage of __FUNCTION__. #define MESA_FUNCTION to __FUNCTION__ if MESA_DEBUG is defined. --- diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index f6228739dd7..e60720fff52 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -389,83 +389,83 @@ void _mesa_noop_TexCoord4fv( const GLfloat *v ) void _mesa_noop_VertexAttrib1fNV( GLuint index, GLfloat x ) { GET_CURRENT_CONTEXT(ctx); - if (index < 16) { + if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, 0, 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1f" ); } void _mesa_noop_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < 16) { + if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], 0, 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib1fv" ); } void _mesa_noop_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) { GET_CURRENT_CONTEXT(ctx); - if (index < 16) { + if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2f" ); } void _mesa_noop_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < 16) { + if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], 0, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib2fv" ); } void _mesa_noop_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - if (index < 16) { + if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3f" ); } void _mesa_noop_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < 16) { + if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], 1); } else - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib3fv" ); } void _mesa_noop_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); - if (index < 16) { + if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], x, y, z, w); } else - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4f" ); } void _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < 16) { + if (index < VERT_ATTRIB_MAX) { ASSIGN_4V(ctx->Current.Attrib[index], v[0], v[1], v[2], v[3]); } else - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib4fv" ); } /* Material @@ -575,7 +575,7 @@ void _mesa_noop_Begin( GLenum mode ) void _mesa_noop_End( void ) { GET_CURRENT_CONTEXT(ctx); - _mesa_error( ctx, GL_INVALID_OPERATION, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); } diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 663cfc84500..2687dc596a9 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -278,7 +278,7 @@ _mesa_Flush( void ); #define FLUSH_VERTICES(ctx, newstate) \ do { \ if (MESA_VERBOSE & VERBOSE_STATE) \ - _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", __FUNCTION__); \ + _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\ if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \ ctx->NewState |= newstate; \ @@ -297,7 +297,7 @@ do { \ #define FLUSH_CURRENT(ctx, newstate) \ do { \ if (MESA_VERBOSE & VERBOSE_STATE) \ - _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", __FUNCTION__); \ + _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION); \ if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \ ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \ ctx->NewState |= newstate; \ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 012667a2abe..d451cc8985e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2263,9 +2263,11 @@ extern const char *_mesa_prim_name[GL_POLYGON+4]; #ifdef MESA_DEBUG extern int MESA_VERBOSE; extern int MESA_DEBUG_FLAGS; +# define MESA_FUNCTION __FUNCTION__ #else # define MESA_VERBOSE 0 # define MESA_DEBUG_FLAGS 0 +# define MESA_FUNCTION "a function" # ifndef NDEBUG # define NDEBUG # endif diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c index 63a59e77d1b..0a7e31e2ad7 100644 --- a/src/mesa/tnl/t_save_api.c +++ b/src/mesa/tnl/t_save_api.c @@ -474,8 +474,8 @@ static void _save_upgrade_vertex( GLcontext *ctx, if (tnl->save.currentsz[attr] == 0) { assert(oldsz == 0); tnl->save.dangling_attr_ref = attr; - _mesa_debug(0, "%s: dangling reference attr %d\n", - __FUNCTION__, attr); + _mesa_debug(0, "_save_upgrade_vertex: dangling reference attr %d\n", + attr); #if 0 /* The current strategy is to punt these degenerate cases @@ -730,7 +730,7 @@ do { \ static void enum_error( void ) { GET_CURRENT_CONTEXT( ctx ); - _mesa_compile_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_compile_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" ); } static void _save_Vertex2f( GLfloat x, GLfloat y ) @@ -1041,7 +1041,7 @@ static void _save_Materialfv( GLenum face, GLenum pname, MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); break; default: - _mesa_compile_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_compile_error( ctx, GL_INVALID_ENUM, "glMaterialfv" ); return; } } @@ -1094,7 +1094,7 @@ static void _save_Indexfv( const GLfloat *f ) do { \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ \ - fprintf(stderr, "fallback %s inside begin/end\n", __FUNCTION__); \ + /*fprintf(stderr, "fallback %s inside begin/end\n", __FUNCTION__);*/ \ \ if (tnl->save.initial_counter != tnl->save.counter || \ tnl->save.prim_count) \ @@ -1151,7 +1151,6 @@ static void _save_EvalPoint2( GLint i, GLint j ) static void _save_CallList( GLuint l ) { GET_CURRENT_CONTEXT(ctx); - fprintf(stderr, "%s\n", __FUNCTION__); FALLBACK(ctx); ctx->Save->CallList( l ); } @@ -1159,7 +1158,6 @@ static void _save_CallList( GLuint l ) static void _save_CallLists( GLsizei n, GLenum type, const GLvoid *v ) { GET_CURRENT_CONTEXT(ctx); - fprintf(stderr, "%s\n", __FUNCTION__); FALLBACK(ctx); ctx->Save->CallLists( n, type, v ); } @@ -1223,7 +1221,7 @@ static void _save_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); - _mesa_compile_error( ctx, GL_INVALID_OPERATION, __FUNCTION__); + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawElements" ); } @@ -1233,38 +1231,38 @@ static void _save_DrawRangeElements(GLenum mode, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); - _mesa_compile_error( ctx, GL_INVALID_OPERATION, __FUNCTION__); + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawRangeElements" ); } static void _save_DrawArrays(GLenum mode, GLint start, GLsizei count) { GET_CURRENT_CONTEXT(ctx); - _mesa_compile_error( ctx, GL_INVALID_OPERATION, __FUNCTION__); + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glDrawArrays" ); } static void _save_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) { GET_CURRENT_CONTEXT(ctx); - _mesa_compile_error( ctx, GL_INVALID_OPERATION, __FUNCTION__); + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glRectf" ); } static void _save_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) { GET_CURRENT_CONTEXT(ctx); - _mesa_compile_error( ctx, GL_INVALID_OPERATION, __FUNCTION__); + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glEvalMesh1" ); } static void _save_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) { GET_CURRENT_CONTEXT(ctx); - _mesa_compile_error( ctx, GL_INVALID_OPERATION, __FUNCTION__); + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glEvalMesh2" ); } static void _save_Begin( GLenum mode ) { GET_CURRENT_CONTEXT( ctx ); - _mesa_compile_error( ctx, GL_INVALID_OPERATION, "Recursive begin" ); + _mesa_compile_error( ctx, GL_INVALID_OPERATION, "Recursive glBegin" ); } diff --git a/src/mesa/tnl/t_save_playback.c b/src/mesa/tnl/t_save_playback.c index e30735af068..4669e4b32c9 100644 --- a/src/mesa/tnl/t_save_playback.c +++ b/src/mesa/tnl/t_save_playback.c @@ -1,4 +1,3 @@ - /* * Mesa 3-D graphics library * Version: 5.1 @@ -188,7 +187,8 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data ) /* Degenerate case: list references current data and would * require fixup. Take the easier option & loop it back. */ - _mesa_debug( 0, "%s: loopback dangling attr ref\n", __FUNCTION__); + _mesa_debug(ctx, + "tnl_playback_vertex_list: loopback dangling attr ref\n"); _tnl_loopback_vertex_list( ctx, data ); return; } diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index 21ec1c9a7b2..d834a1407a2 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -495,7 +495,7 @@ do { \ static void enum_error( void ) { GET_CURRENT_CONTEXT( ctx ); - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_ENUM, "glVertexAttrib" ); } static void _tnl_Vertex2f( GLfloat x, GLfloat y ) @@ -790,7 +790,7 @@ static void _tnl_Materialfv( GLenum face, GLenum pname, break; default: - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__); + _mesa_error( ctx, GL_INVALID_ENUM, "glMaterialfv" ); return; } @@ -818,7 +818,7 @@ static void _tnl_Materialfv( GLenum face, GLenum pname, MAT( _TNL_ATTRIB_MAT_FRONT_DIFFUSE, 4, face, params ); break; default: - _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_ENUM, "glMaterialfv" ); return; } } @@ -990,7 +990,7 @@ static void _tnl_Begin( GLenum mode ) ctx->Driver.CurrentExecPrimitive = mode; } else - _mesa_error( ctx, GL_INVALID_OPERATION, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_OPERATION, "glBegin" ); } @@ -1023,7 +1023,7 @@ static void _tnl_End( void ) } else - _mesa_error( ctx, GL_INVALID_OPERATION, __FUNCTION__ ); + _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); } diff --git a/src/mesa/tnl/t_vtx_exec.c b/src/mesa/tnl/t_vtx_exec.c index 744d44ea60c..5215e1d6fb3 100644 --- a/src/mesa/tnl/t_vtx_exec.c +++ b/src/mesa/tnl/t_vtx_exec.c @@ -28,20 +28,21 @@ #include "glheader.h" #include "api_eval.h" #include "context.h" +#include "enums.h" #include "state.h" #include "macros.h" #include "math/m_eval.h" #include "t_vtx_api.h" #include "t_pipeline.h" + static void _tnl_print_vtx( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint count = tnl->vtx.initial_counter - tnl->vtx.counter; GLuint i; - _mesa_debug(0, "%s: %u vertices %d primitives, %d vertsize\n", - __FUNCTION__, + _mesa_debug(ctx, "_tnl_print_vtx: %u vertices %d primitives, %d vertsize\n", count, tnl->vtx.prim_count, tnl->vtx.vertex_size); @@ -112,8 +113,8 @@ static void _tnl_vb_bind_vtx( GLcontext *ctx ) GLuint count = tnl->vtx.initial_counter - tnl->vtx.counter; GLuint attr, i; - if (0) fprintf(stderr, "%s: %d verts %d vertsize\n", - __FUNCTION__, count, tnl->vtx.vertex_size); + if (0) fprintf(stderr, "_tnl_vb_bind_vtx(): %d verts %d vertsize\n", + count, tnl->vtx.vertex_size); /* Setup constant data in the VB. @@ -178,9 +179,6 @@ static void _tnl_vb_bind_vtx( GLcontext *ctx ) } - - - /* * NOTE: Need to have calculated primitives by this point -- do it on the fly. * NOTE: Old 'parity' issue is gone. @@ -255,10 +253,6 @@ static GLuint _tnl_copy_vertices( GLcontext *ctx ) } - - - - /** * Execute the buffer and save copied verts. */ @@ -293,8 +287,3 @@ void _tnl_flush_vtx( GLcontext *ctx ) tnl->vtx.counter = tnl->vtx.initial_counter; tnl->vtx.vbptr = tnl->vtx.buffer; } - - - - -