diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2002-06-29 19:48:15 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2002-06-29 19:48:15 +0000 |
commit | 4e9676fb13f60ecdbc247b120031f18cd3febcb0 (patch) | |
tree | 9f310d4b547592b025b5a7063aaf2b629bef6676 /src/mesa | |
parent | f1ad551604122dd2679dbd31ae6b2fa1197e9848 (diff) |
Applied Matt Sealey's patch to remove/isolate all stdio.h function calls.
Instead of mstdio.[ch], use imports.[ch] to isolate these functions.
Diffstat (limited to 'src/mesa')
39 files changed, 606 insertions, 592 deletions
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index d50a37bd9ff..78f05534274 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -1,4 +1,4 @@ -/* $Id: glapi.c,v 1.62 2002/05/29 15:23:16 brianp Exp $ */ +/* $Id: glapi.c,v 1.63 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -37,11 +37,12 @@ * flexible enough to be reused in several places: XFree86, DRI- * based libGL.so, and perhaps the SGI SI. * - * There are no dependencies on Mesa in this code. + * NOTE: There are no dependencies on Mesa in this code. * * Versions (API changes): * 2000/02/23 - original version for Mesa 3.3 and XFree86 4.0 * 2001/01/16 - added dispatch override feature for Mesa 3.5 + * 2002/06/28 - added _glapi_set_warning_func(), Mesa 4.1. */ @@ -55,20 +56,37 @@ /***** BEGIN NO-OP DISPATCH *****/ static GLboolean WarnFlag = GL_FALSE; +static _glapi_warning_func warning_func; + +/* + * Enable/disable printing of warning messages. + */ void _glapi_noop_enable_warnings(GLboolean enable) { WarnFlag = enable; } +/* + * Register a callback function for reporting errors. + */ +void +_glapi_set_warning_func( _glapi_warning_func func ) +{ + warning_func = func; +} + static GLboolean warn(void) { - if (WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) + if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) + && warning_func) { return GL_TRUE; - else + } + else { return GL_FALSE; + } } @@ -76,21 +94,19 @@ warn(void) #define KEYWORD2 #define NAME(func) NoOp##func -#define F stderr +#define F NULL -#define DISPATCH(func, args, msg) \ - if (warn()) { \ - fprintf(stderr, "GL User Error: calling "); \ - fprintf msg; \ - fprintf(stderr, " without a current context\n"); \ +#define DISPATCH(func, args, msg) \ + if (warn()) { \ + warning_func(NULL, "GL User Error: called without context:"); \ + warning_func msg; \ } -#define RETURN_DISPATCH(func, args, msg) \ - if (warn()) { \ - fprintf(stderr, "GL User Error: calling "); \ - fprintf msg; \ - fprintf(stderr, " without a current context\n"); \ - } \ +#define RETURN_DISPATCH(func, args, msg) \ + if (warn()) { \ + warning_func(NULL, "GL User Error: called without context:"); \ + warning_func msg; \ + } \ return 0 #define DISPATCH_TABLE_NAME __glapi_noop_table @@ -101,7 +117,7 @@ warn(void) static int NoOpUnused(void) { if (warn()) { - fprintf(stderr, "GL User Error: calling extension function without a current context\n"); + warning_func(NULL, "GL User Error: calling extension function without a current context\n"); } return 0; } @@ -442,7 +458,7 @@ _glapi_get_dispatch_table_size(void) const char * _glapi_get_version(void) { - return "20010116"; /* YYYYMMDD */ + return "20020628"; /* YYYYMMDD */ } diff --git a/src/mesa/glapi/glapi.h b/src/mesa/glapi/glapi.h index 3b022e436e1..be62118b57f 100644 --- a/src/mesa/glapi/glapi.h +++ b/src/mesa/glapi/glapi.h @@ -1,4 +1,4 @@ -/* $Id: glapi.h,v 1.19 2001/03/28 17:20:20 brianp Exp $ */ +/* $Id: glapi.h,v 1.20 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -33,6 +33,8 @@ struct _glapi_table; +typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...); + extern void *_glapi_Context; @@ -42,6 +44,8 @@ extern struct _glapi_table *_glapi_Dispatch; extern void _glapi_noop_enable_warnings(GLboolean enable); +extern void +_glapi_set_warning_func(_glapi_warning_func func); extern void _glapi_check_multithread(void); diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index d4c745fab2f..417954369ae 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -1,4 +1,4 @@ -/* $Id: colortab.c,v 1.43 2002/06/08 12:39:18 brianp Exp $ */ +/* $Id: colortab.c,v 1.44 2002/06/29 19:48:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -322,9 +322,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, table->Format = (GLenum) 0; } else { - char msg[100]; - sprintf(msg, "glColorTable(width=%d)", width); - _mesa_error(ctx, GL_INVALID_VALUE, msg); + _mesa_error(ctx, GL_INVALID_VALUE, "glColorTable(width=%d)", width); } return; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index bead62cdf3d..9a141d9db20 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.173 2002/06/23 02:53:22 brianp Exp $ */ +/* $Id: context.c,v 1.174 2002/06/29 19:48:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -579,13 +579,14 @@ one_time_init( GLcontext *ctx ) #endif if (ctx->imports.getenv(ctx, "MESA_DEBUG")) { _glapi_noop_enable_warnings(GL_TRUE); + _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning ); } else { _glapi_noop_enable_warnings(GL_FALSE); } #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) - fprintf(stderr, "Mesa DEBUG build %s %s\n", __DATE__, __TIME__); + _mesa_debug(ctx, "Mesa DEBUG build %s %s\n", __DATE__, __TIME__); #endif alreadyCalled = GL_TRUE; @@ -1480,7 +1481,7 @@ init_attrib_groups( GLcontext *ctx ) ctx->NoDither = ctx->imports.getenv(ctx, "MESA_NO_DITHER") ? GL_TRUE : GL_FALSE; if (ctx->NoDither) { if (ctx->imports.getenv(ctx, "MESA_DEBUG")) { - fprintf(stderr, "MESA_NO_DITHER set - dithering disabled\n"); + _mesa_debug(ctx, "MESA_NO_DITHER set - dithering disabled\n"); } ctx->Color.DitherFlag = GL_FALSE; } @@ -2089,28 +2090,28 @@ _mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) static void print_info( void ) { - fprintf(stderr, "Mesa GL_VERSION = %s\n", + _mesa_debug(NULL, "Mesa GL_VERSION = %s\n", (char *) _mesa_GetString(GL_VERSION)); - fprintf(stderr, "Mesa GL_RENDERER = %s\n", + _mesa_debug(NULL, "Mesa GL_RENDERER = %s\n", (char *) _mesa_GetString(GL_RENDERER)); - fprintf(stderr, "Mesa GL_VENDOR = %s\n", + _mesa_debug(NULL, "Mesa GL_VENDOR = %s\n", (char *) _mesa_GetString(GL_VENDOR)); - fprintf(stderr, "Mesa GL_EXTENSIONS = %s\n", + _mesa_debug(NULL, "Mesa GL_EXTENSIONS = %s\n", (char *) _mesa_GetString(GL_EXTENSIONS)); #if defined(THREADS) - fprintf(stderr, "Mesa thread-safe: YES\n"); + _mesa_debug(NULL, "Mesa thread-safe: YES\n"); #else - fprintf(stderr, "Mesa thread-safe: NO\n"); + _mesa_debug(NULL, "Mesa thread-safe: NO\n"); #endif #if defined(USE_X86_ASM) - fprintf(stderr, "Mesa x86-optimized: YES\n"); + _mesa_debug(NULL, "Mesa x86-optimized: YES\n"); #else - fprintf(stderr, "Mesa x86-optimized: NO\n"); + _mesa_debug(NULL, "Mesa x86-optimized: NO\n"); #endif #if defined(USE_SPARC_ASM) - fprintf(stderr, "Mesa sparc-optimized: YES\n"); + _mesa_debug(NULL, "Mesa sparc-optimized: YES\n"); #else - fprintf(stderr, "Mesa sparc-optimized: NO\n"); + _mesa_debug(NULL, "Mesa sparc-optimized: NO\n"); #endif } @@ -2270,112 +2271,12 @@ _mesa_get_dispatch(GLcontext *ctx) /* - * This function is called when the Mesa user has stumbled into a code - * path which may not be implemented fully or correctly. - */ -void _mesa_problem( const GLcontext *ctx, const char *s ) -{ - if (ctx) { - ctx->imports.fprintf((GLcontext *) ctx, stderr, "Mesa implementation error: %s\n", s); -#ifdef XF86DRI - ctx->imports.fprintf((GLcontext *) ctx, stderr, "Please report to the DRI bug database at dri.sourceforge.net\n"); -#else - ctx->imports.fprintf((GLcontext *) ctx, stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" ); -#endif - } - else { - /* what can we do if we don't have a context???? */ - fprintf( stderr, "Mesa implementation error: %s\n", s ); -#ifdef XF86DRI - fprintf( stderr, "Please report to the DRI bug database at dri.sourceforge.net\n"); -#else - fprintf( stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" ); -#endif - } -} - - - -/* - * This is called to inform the user that he or she has tried to do - * something illogical or if there's likely a bug in their program - * (like enabled depth testing without a depth buffer). - */ -void -_mesa_warning( const GLcontext *ctx, const char *s ) -{ - (*ctx->imports.warning)((__GLcontext *) ctx, (char *) s); -} - - - -/* - * This is Mesa's error handler. Normally, all that's done is the updating - * of the current error value. If Mesa is compiled with -DDEBUG or if the - * environment variable "MESA_DEBUG" is defined then a real error message - * is printed to stderr. - * Input: ctx - the GL context - * error - the error value - * where - usually the name of function where error was detected + * Record the given error code and call the driver's Error function if defined. + * This is called via _mesa_error(). */ void -_mesa_error( GLcontext *ctx, GLenum error, const char *where ) +_mesa_record_error( GLcontext *ctx, GLenum error ) { - const char *debugEnv; - GLboolean debug; - - if (ctx) - debugEnv = ctx->imports.getenv(ctx, "MESA_DEBUG"); - else - /* what can we do??? */ - debugEnv = ""; - -#ifdef DEBUG - if (debugEnv && strstr(debugEnv, "silent")) - debug = GL_FALSE; - else - debug = GL_TRUE; -#else - if (debugEnv) - debug = GL_TRUE; - else - debug = GL_FALSE; -#endif - - if (debug) { - const char *errstr; - switch (error) { - case GL_NO_ERROR: - errstr = "GL_NO_ERROR"; - break; - case GL_INVALID_VALUE: - errstr = "GL_INVALID_VALUE"; - break; - case GL_INVALID_ENUM: - errstr = "GL_INVALID_ENUM"; - break; - case GL_INVALID_OPERATION: - errstr = "GL_INVALID_OPERATION"; - break; - case GL_STACK_OVERFLOW: - errstr = "GL_STACK_OVERFLOW"; - break; - case GL_STACK_UNDERFLOW: - errstr = "GL_STACK_UNDERFLOW"; - break; - case GL_OUT_OF_MEMORY: - errstr = "GL_OUT_OF_MEMORY"; - break; - case GL_TABLE_TOO_LARGE: - errstr = "GL_TABLE_TOO_LARGE"; - break; - default: - errstr = "unknown"; - break; - } - fprintf(stderr, "Mesa user error: %s in %s\n", errstr, where); - } - if (!ctx) return; @@ -2390,37 +2291,6 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *where ) } -/* - * Call this to report debug information. Uses stderr. - */ -void -_mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) -{ - char s[1000]; - va_list args; - va_start( args, fmtString ); - vsprintf(s, fmtString, args); - (void) ctx->imports.fprintf( (__GLcontext *) ctx, stderr, s ); - va_end( args ); -} - - -/* - * A wrapper for printf. Uses stdout. - */ -void -_mesa_printf( const GLcontext *ctx, const char *fmtString, ... ) -{ - char s[1000]; - va_list args; - va_start( args, fmtString ); - vsprintf(s, fmtString, args); - (void) ctx->imports.fprintf( (__GLcontext *) ctx, stdout, s ); - va_end( args ); -} - - - void _mesa_Finish( void ) { diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 8e9524fec58..2b359d0968e 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -1,4 +1,4 @@ -/* $Id: context.h,v 1.32 2002/06/15 02:38:15 brianp Exp $ */ +/* $Id: context.h,v 1.33 2002/06/29 19:48:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,6 +31,7 @@ #include "glapi.h" #include "mtypes.h" +#include "imports.h" /* @@ -229,20 +230,7 @@ _mesa_get_dispatch(GLcontext *ctx); */ extern void -_mesa_problem( const GLcontext *ctx, const char *s ); - -extern void -_mesa_warning( const GLcontext *ctx, const char *s ); - -extern void -_mesa_error( GLcontext *ctx, GLenum error, const char *s ); - -extern void -_mesa_debug( const GLcontext *ctx, const char *fmtString, ... ); - -extern void -_mesa_printf( const GLcontext *ctx, const char *fmtString, ... ); - +_mesa_record_error( GLcontext *ctx, GLenum error ); extern void diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 7a3a88edf2a..039f7a01a7b 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -1,4 +1,4 @@ -/* $Id: debug.c,v 1.12 2001/03/29 21:16:25 keithw Exp $ */ +/* $Id: debug.c,v 1.13 2002/06/29 19:48:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,11 +25,12 @@ */ #include "mtypes.h" +#include "context.h" #include "debug.h" void _mesa_print_state( const char *msg, GLuint state ) { - fprintf(stderr, + _mesa_debug(NULL, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", msg, state, @@ -63,7 +64,7 @@ void _mesa_print_state( const char *msg, GLuint state ) void _mesa_print_tri_caps( const char *name, GLuint flags ) { - fprintf(stderr, + _mesa_debug(NULL, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", name, flags, diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index 0ed24afd30a..463bdb70d04 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -1,4 +1,4 @@ -/* $Id: dispatch.c,v 1.26 2001/12/15 16:42:59 brianp Exp $ */ +/* $Id: dispatch.c,v 1.27 2002/06/29 19:48:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -62,7 +62,7 @@ #endif -#if 0 /* Use this to log GL calls to stdout */ +#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ #define F stdout #define DISPATCH(FUNC, ARGS, MESSAGE) \ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 3523db550a2..1409f0ee420 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.90 2002/06/15 02:38:15 brianp Exp $ */ +/* $Id: dlist.c,v 1.91 2002/06/29 19:48:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -4817,7 +4817,7 @@ execute_list( GLcontext *ctx, GLuint list ) default: { char msg[1000]; - sprintf(msg, "Error in execute_list: opcode=%d", (int) opcode); + _mesa_sprintf( ctx, msg, "Error in execute_list: opcode=%d", (int) opcode); _mesa_problem( ctx, msg ); } done = GL_TRUE; diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index aef516690ae..140358b463a 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.67 2002/06/18 16:53:46 brianp Exp $ */ +/* $Id: enable.c,v 1.68 2002/06/29 19:48:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -44,9 +44,8 @@ #define CHECK_EXTENSION(EXTNAME, CAP) \ if (!ctx->Extensions.EXTNAME) { \ - char s[100]; \ - sprintf(s, "gl%sClientState(0x%x)", state ? "Enable" : "Disable", CAP);\ - _mesa_error(ctx, GL_INVALID_ENUM, s); \ + _mesa_error(ctx, GL_INVALID_ENUM, "gl%sClientState(0x%x)", \ + state ? "Enable" : "Disable", CAP); \ return; \ } @@ -117,11 +116,8 @@ client_state( GLcontext *ctx, GLenum cap, GLboolean state ) } break; default: - { - char s[100]; - sprintf(s, "glEnable/DisableClientState(0x%x)", cap); - _mesa_error( ctx, GL_INVALID_ENUM, s); - } + _mesa_error( ctx, GL_INVALID_ENUM, + "glEnable/DisableClientState(0x%x)", cap); return; } @@ -166,9 +162,8 @@ _mesa_DisableClientState( GLenum cap ) #undef CHECK_EXTENSION #define CHECK_EXTENSION(EXTNAME, CAP) \ if (!ctx->Extensions.EXTNAME) { \ - char s[100]; \ - sprintf(s, "gl%s(0x%x)", state ? "Enable" : "Disable", CAP); \ - _mesa_error(ctx, GL_INVALID_ENUM, s); \ + _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(0x%x)", \ + state ? "Enable" : "Disable", CAP); \ return; \ } @@ -895,11 +890,8 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) break; default: - { - char s[100]; - sprintf(s, "%s(0x%x)", state ? "glEnable" : "glDisable", cap); - _mesa_error(ctx, GL_INVALID_ENUM, s); - } + _mesa_error(ctx, GL_INVALID_ENUM, + "%s(0x%x)", state ? "glEnable" : "glDisable", cap); return; } @@ -1272,11 +1264,7 @@ _mesa_IsEnabled( GLenum cap ) } default: - { - char s[100]; - sprintf(s, "glIsEnabled(0x%x)", (int) cap); - _mesa_error( ctx, GL_INVALID_ENUM, s ); - } + _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap); return GL_FALSE; } } diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index 9d5a567742a..93abf2ab5f8 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -1,4 +1,4 @@ -/* $Id: enums.c,v 1.20 2001/06/08 20:10:55 brianp Exp $ */ +/* $Id: enums.c,v 1.21 2002/06/29 19:48:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -33,6 +33,7 @@ #else #include "glheader.h" #include "enums.h" +#include "imports.h" #include "mem.h" #endif @@ -928,7 +929,7 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } else { /* this isn't re-entrant safe, no big deal here */ - sprintf(token_tmp, "0x%x", nr); + _mesa_sprintf(NULL, token_tmp, "0x%x", nr); return token_tmp; } } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 73e924e6b39..a99a5fb6c90 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.83 2002/06/18 16:53:46 brianp Exp $ */ +/* $Id: get.c,v 1.84 2002/06/29 19:48:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -63,33 +63,29 @@ #define CHECK_EXTENSION_B(EXTNAME, PNAME) \ if (!ctx->Extensions.EXTNAME) { \ - char s[100]; \ - sprintf(s, "glGetBooleanv(0x%x)", (int) PNAME); \ - _mesa_error(ctx, GL_INVALID_VALUE, s); \ + _mesa_error(ctx, GL_INVALID_VALUE, \ + "glGetBooleanv(0x%x)", (int) PNAME); \ return; \ } #define CHECK_EXTENSION_I(EXTNAME, PNAME) \ if (!ctx->Extensions.EXTNAME) { \ - char s[100]; \ - sprintf(s, "glGetIntegerv(0x%x)", (int) PNAME); \ - _mesa_error(ctx, GL_INVALID_VALUE, s); \ + _mesa_error(ctx, GL_INVALID_VALUE, \ + "glGetIntegerv(0x%x)", (int) PNAME); \ return; \ } #define CHECK_EXTENSION_F(EXTNAME, PNAME) \ if (!ctx->Extensions.EXTNAME) { \ - char s[100]; \ - sprintf(s, "glGetFloatv(0x%x)", (int) PNAME); \ - _mesa_error(ctx, GL_INVALID_VALUE, s); \ + _mesa_error(ctx, GL_INVALID_VALUE, \ + "glGetFloatv(0x%x)", (int) PNAME); \ return; \ } #define CHECK_EXTENSION_D(EXTNAME, PNAME) \ if (!ctx->Extensions.EXTNAME) { \ - char s[100]; \ - sprintf(s, "glGetDoublev(0x%x)", (int) PNAME); \ - _mesa_error(ctx, GL_INVALID_VALUE, s); \ + _mesa_error(ctx, GL_INVALID_VALUE, \ + "glGetDoublev(0x%x)", (int) PNAME); \ return; \ } @@ -1471,11 +1467,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; default: - { - char s[100]; - sprintf(s, "glGetBooleanv(pname=0x%x)", pname); - _mesa_error( ctx, GL_INVALID_ENUM, s ); - } + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); } } @@ -2829,11 +2821,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; default: - { - char s[100]; - sprintf(s, "glGetDoublev(pname=0x%x)", pname); - _mesa_error( ctx, GL_INVALID_ENUM, s ); - } + _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev(pname=0x%x)", pname); } } @@ -4163,11 +4151,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; default: - { - char s[100]; - sprintf(s, "glGetFloatv(0x%x)", pname); - _mesa_error(ctx, GL_INVALID_ENUM, s); - } + _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(0x%x)", pname); } } @@ -5542,11 +5526,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; default: - { - char s[100]; - sprintf(s, "glGetIntegerv(pname=0x%x)", pname); - _mesa_error( ctx, GL_INVALID_ENUM, s ); - } + _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); } } diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 03050e7fc69..e5b82d4d886 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -1,4 +1,4 @@ -/* $Id: hash.c,v 1.11 2001/11/02 00:57:04 brianp Exp $ */ +/* $Id: hash.c,v 1.12 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,6 +31,7 @@ #include "glheader.h" #include "glthread.h" #include "hash.h" +#include "context.h" #include "mem.h" #endif @@ -237,7 +238,7 @@ void _mesa_HashPrint(const struct _mesa_HashTable *table) for (i=0;i<TABLE_SIZE;i++) { const struct HashEntry *entry = table->Table[i]; while (entry) { - printf("%u %p\n", entry->Key, entry->Data); + _mesa_debug(NULL, "%u %p\n", entry->Key, entry->Data); entry = entry->Next; } } @@ -294,17 +295,19 @@ int main(int argc, char *argv[]) int a, b, c; struct HashTable *t; - printf("&a = %p\n", &a); - printf("&b = %p\n", &b); + _mesa_printf("&a = %p\n", &a); + _mesa_printf("&b = %p\n", &b); t = _mesa_NewHashTable(); _mesa_HashInsert(t, 501, &a); _mesa_HashInsert(t, 10, &c); _mesa_HashInsert(t, 0xfffffff8, &b); _mesa_HashPrint(t); - printf("Find 501: %p\n", _mesa_HashLookup(t,501)); - printf("Find 1313: %p\n", _mesa_HashLookup(t,1313)); - printf("Find block of 100: %d\n", _mesa_HashFindFreeKeyBlock(t, 100)); + + _mesa_printf("Find 501: %p\n", _mesa_HashLookup(t,501)); + _mesa_printf("Find 1313: %p\n", _mesa_HashLookup(t,1313)); + _mesa_printf("Find block of 100: %d\n", _mesa_HashFindFreeKeyBlock(t, 100)); + _mesa_DeleteHashTable(t); return 0; diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 40c02c246c1..dbe88a9724e 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -1,4 +1,4 @@ -/* $Id: imports.c,v 1.14 2002/06/18 08:35:25 joukj Exp $ */ +/* $Id: imports.c,v 1.15 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -26,31 +26,24 @@ /* - * Imports are functions which the device driver or window system or + * Imports are services which the device driver or window system or * operating system provides to the core renderer. The core renderer (Mesa) * will call these functions in order to do memory allocation, simple I/O, * etc. * - * 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. + * Some drivers will want to override/replace this file with something + * specialized, but most Mesa drivers will be able to call + *_mesa_init_default_imports() and go with what's here. * - * A server-side GL renderer will likely not use these functions since - * the renderer should use the XFree86-wrapped system calls. - */ - -/* - * XXX when we fully implement the __GLimports mechanism in Mesa, that - * should mean that we can remove <stdio.h>, <stdlib.h>, etc, from - * glheader.h. Strictly speaking, all system includes should be done - * from this file, and not glheader to ensure that core Mesa has no - * dependencies on external libraries. Someday... + * Eventually, I'd like to move most of the stuff in glheader.h and mem.[ch] + * into imports.[ch]. Then we'll really have one, single place where + * all OS-related dependencies are isolated. */ - #include "glheader.h" #include "mtypes.h" +#include "context.h" #include "imports.h" #include "mem.h" @@ -79,46 +72,49 @@ _mesa_Free(__GLcontext *gc, void *addr) FREE(addr); } + /* Must be before '#undef getenv' for inclusion in XFree86. */ static char * CAPI _mesa_getenv(__GLcontext *gc, const char *var) { (void) gc; +/* Whacko XFree86 macro: + */ +#ifdef getenv +#undef getenv +#endif return getenv(var); } + static void -_mesa_warning(__GLcontext *gc, char *str) +warning(__GLcontext *gc, char *str) { GLboolean debug; #ifdef DEBUG debug = GL_TRUE; #else -/* Whacko XFree86 macro: - */ -#ifdef getenv -#undef getenv -#endif - if (gc->imports.getenv(gc, "MESA_DEBUG")) { + if (_mesa_getenv(gc "MESA_DEBUG")) debug = GL_TRUE; - } - else { + else debug = GL_FALSE; - } #endif if (debug) { fprintf(stderr, "Mesa warning: %s\n", str); } } -static void + +void _mesa_fatal(__GLcontext *gc, char *str) { + (void) gc; fprintf(stderr, "%s\n", str); abort(); } + static int CAPI _mesa_atoi(__GLcontext *gc, const char *str) { @@ -126,7 +122,8 @@ _mesa_atoi(__GLcontext *gc, const char *str) return atoi(str); } -static int CAPI + +int CAPI _mesa_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) { int r; @@ -137,18 +134,21 @@ _mesa_sprintf(__GLcontext *gc, char *str, const char *fmt, ...) return r; } + static void * CAPI _mesa_fopen(__GLcontext *gc, const char *path, const char *mode) { return fopen(path, mode); } + static int CAPI _mesa_fclose(__GLcontext *gc, void *stream) { return fclose((FILE *) stream); } + static int CAPI _mesa_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) { @@ -160,6 +160,7 @@ _mesa_fprintf(__GLcontext *gc, void *stream, const char *fmt, ...) return r; } + /* XXX this really is driver-specific and can't be here */ static __GLdrawablePrivate * _mesa_GetDrawablePrivate(__GLcontext *gc) @@ -168,6 +169,160 @@ _mesa_GetDrawablePrivate(__GLcontext *gc) } + +void +_mesa_warning(__GLcontext *gc, const char *fmtString, ...) +{ + char str[1000]; + va_list args; + va_start( args, fmtString ); + (void) vsprintf( str, fmtString, args ); + va_end( args ); + warning(gc, str); +} + + +/* + * This function is called when the Mesa user has stumbled into a code + * path which may not be implemented fully or correctly. + */ +void +_mesa_problem( const GLcontext *ctx, const char *s ) +{ + if (ctx) { + ctx->imports.fprintf((GLcontext *) ctx, stderr, "Mesa implementation error: %s\n", s); +#ifdef XF86DRI + ctx->imports.fprintf((GLcontext *) ctx, stderr, "Please report to the DRI bug database at dri.sourceforge.net\n"); +#else + ctx->imports.fprintf((GLcontext *) ctx, stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" ); +#endif + } + else { + /* what can we do if we don't have a context???? */ + fprintf( stderr, "Mesa implementation error: %s\n", s ); +#ifdef XF86DRI + fprintf( stderr, "Please report to the DRI bug database at dri.sourceforge.net\n"); +#else + fprintf( stderr, "Please report to the Mesa bug database at www.mesa3d.org\n" ); +#endif + } +} + + +/* + * If in debug mode, print error message to stdout. + * Also, record the error code by calling _mesa_record_error(). + * Input: ctx - the GL context + * error - the error value + * fmtString - printf-style format string, followed by optional args + */ +void +_mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) +{ + const char *debugEnv; + GLboolean debug; + + debugEnv = _mesa_getenv(ctx, "MESA_DEBUG"); + +#ifdef DEBUG + if (debugEnv && strstr(debugEnv, "silent")) + debug = GL_FALSE; + else + debug = GL_TRUE; +#else + if (debugEnv) + debug = GL_TRUE; + else + debug = GL_FALSE; +#endif + + if (debug) { + va_list args; + char where[1000]; + const char *errstr; + + va_start( args, fmtString ); + vsprintf( where, fmtString, args ); + va_end( args ); + + switch (error) { + case GL_NO_ERROR: + errstr = "GL_NO_ERROR"; + break; + case GL_INVALID_VALUE: + errstr = "GL_INVALID_VALUE"; + break; + case GL_INVALID_ENUM: + errstr = "GL_INVALID_ENUM"; + break; + case GL_INVALID_OPERATION: + errstr = "GL_INVALID_OPERATION"; + break; + case GL_STACK_OVERFLOW: + errstr = "GL_STACK_OVERFLOW"; + break; + case GL_STACK_UNDERFLOW: + errstr = "GL_STACK_UNDERFLOW"; + break; + case GL_OUT_OF_MEMORY: + errstr = "GL_OUT_OF_MEMORY"; + break; + case GL_TABLE_TOO_LARGE: + errstr = "GL_TABLE_TOO_LARGE"; + break; + default: + errstr = "unknown"; + break; + } + _mesa_debug(ctx, "Mesa user error: %s in %s\n", errstr, where); + } + + _mesa_record_error(ctx, error); +} + + +/* + * Call this to report debug information. Uses stderr. + */ +void +_mesa_debug( const GLcontext *ctx, const char *fmtString, ... ) +{ + char s[1000]; + va_list args; + va_start(args, fmtString); + vsprintf(s, fmtString, args); + if (ctx) + (void) ctx->imports.fprintf( (__GLcontext *) ctx, stderr, s ); + else + fprintf( stderr, s ); + va_end(args); +} + + +/* + * A wrapper for printf. Uses stdout. + */ +void +_mesa_printf( const GLcontext *ctx, const char *fmtString, ... ) +{ + char s[1000]; + va_list args; + va_start( args, fmtString ); + vsprintf(s, fmtString, args); + if (ctx) + (void) ctx->imports.fprintf( (__GLcontext *) ctx, stdout, s ); + else + printf( s ); + va_end( args ); +} + + +/* + * Initialize a __GLimports object to point to the functions in + * this file. This is to be called from device drivers. + * Input: imports - the object to init + * driverCtx - pointer to device driver-specific data + */ void _mesa_init_default_imports(__GLimports *imports, void *driverCtx) { @@ -175,7 +330,7 @@ _mesa_init_default_imports(__GLimports *imports, void *driverCtx) imports->calloc = _mesa_Calloc; imports->realloc = _mesa_Realloc; imports->free = _mesa_Free; - imports->warning = _mesa_warning; + imports->warning = warning; imports->fatal = _mesa_fatal; imports->getenv = _mesa_getenv; imports->atoi = _mesa_atoi; diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 95bcf312a97..2a19ff81d1a 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -1,4 +1,4 @@ -/* $Id: imports.h,v 1.3 2002/06/13 04:28:29 brianp Exp $ */ +/* $Id: imports.h,v 1.4 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -32,6 +32,28 @@ #include "glheader.h" +extern int CAPI +_mesa_sprintf(__GLcontext *gc, char *str, const char *fmt, ...); + +extern void +_mesa_warning(__GLcontext *gc, const char *fmtString, ...); + +extern void +_mesa_fatal(__GLcontext *gc, char *str); + +extern void +_mesa_problem( const __GLcontext *ctx, const char *s ); + +extern void +_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ); + +extern void +_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ); + +extern void +_mesa_printf( const __GLcontext *ctx, const char *fmtString, ... ); + + extern void _mesa_init_default_imports(__GLimports *imports, void *driverCtx); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 366d477eb81..0b73a431b5a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.81 2002/06/18 16:53:46 brianp Exp $ */ +/* $Id: mtypes.h,v 1.82 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1845,7 +1845,7 @@ enum _debug { #define FLUSH_VERTICES(ctx, newstate) \ do { \ if (MESA_VERBOSE & VERBOSE_STATE) \ - fprintf(stderr, "FLUSH_VERTICES in %s\n", __FUNCTION__); \ + _mesa_debug(ctx, "FLUSH_VERTICES in %s\n", __FUNCTION__); \ if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \ ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \ ctx->NewState |= newstate; \ @@ -1854,7 +1854,7 @@ do { \ #define FLUSH_CURRENT(ctx, newstate) \ do { \ if (MESA_VERBOSE & VERBOSE_STATE) \ - fprintf(stderr, "FLUSH_CURRENT in %s\n", __FUNCTION__); \ + _mesa_debug(ctx, "FLUSH_CURRENT in %s\n", __FUNCTION__); \ if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \ ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \ ctx->NewState |= newstate; \ diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index ce145d800bc..65ad6d2a871 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1,4 +1,4 @@ -/* $Id: texformat.c,v 1.12 2002/06/15 02:38:16 brianp Exp $ */ +/* $Id: texformat.c,v 1.13 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -739,7 +739,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, default: _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); - printf("intformat = %d %x\n", internalFormat, internalFormat); + _mesa_debug(ctx, "intformat = %d %x\n", internalFormat, internalFormat); return NULL; } } diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 2ad0df9d6ba..2ff9d891219 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.109 2002/06/15 03:03:09 brianp Exp $ */ +/* $Id: teximage.c,v 1.110 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -55,8 +55,8 @@ */ -#ifdef DEBUG -static void PrintTexture(const struct gl_texture_image *img) +#if 0 +static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img) { #if CHAN_TYPE == GL_FLOAT _mesa_problem(NULL, "PrintTexture doesn't support float channels"); @@ -65,7 +65,7 @@ static void PrintTexture(const struct gl_texture_image *img) const GLchan *data = (const GLchan *) img->Data; if (!data) { - printf("No texture data\n"); + _mesa_printf(ctx, "No texture data\n"); return; } @@ -93,16 +93,16 @@ static void PrintTexture(const struct gl_texture_image *img) for (i = 0; i < img->Height; i++) { for (j = 0; j < img->Width; j++) { if (c==1) - printf("%02x ", data[0]); + _mesa_printf(ctx, "%02x ", data[0]); else if (c==2) - printf("%02x%02x ", data[0], data[1]); + _mesa_printf(ctx, "%02x%02x ", data[0], data[1]); else if (c==3) - printf("%02x%02x%02x ", data[0], data[1], data[2]); + _mesa_printf(ctx, "%02x%02x%02x ", data[0], data[1], data[2]); else if (c==4) - printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); + _mesa_printf(ctx, "%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); data += c; } - printf("\n"); + _mesa_printf(ctx, "\n"); } #endif } @@ -769,9 +769,8 @@ texture_error_check( GLcontext *ctx, GLenum target, /* Border */ if (border != 0 && border != 1) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(border=%d)", dimensions, border); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(border=%d)", dimensions, border); } return GL_TRUE; } @@ -785,9 +784,8 @@ texture_error_check( GLcontext *ctx, GLenum target, target == GL_PROXY_TEXTURE_RECTANGLE_NV) { if (width < 1 || width > ctx->Const.MaxTextureRectSize) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(width=%d)", dimensions, width); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(width=%d)", dimensions, width); } return GL_TRUE; } @@ -795,9 +793,8 @@ texture_error_check( GLcontext *ctx, GLenum target, else if (width < 2 * border || width > 2 + maxTextureSize || logbase2( width - 2 * border ) < 0) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(width=%d)", dimensions, width); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(width=%d)", dimensions, width); } return GL_TRUE; } @@ -807,9 +804,8 @@ texture_error_check( GLcontext *ctx, GLenum target, target == GL_PROXY_TEXTURE_RECTANGLE_NV) { if (height < 1 || height > ctx->Const.MaxTextureRectSize) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(height=%d)", dimensions, height); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(height=%d)", dimensions, height); } return GL_TRUE; } @@ -818,9 +814,8 @@ texture_error_check( GLcontext *ctx, GLenum target, if (height < 2 * border || height > 2 + maxTextureSize || logbase2( height - 2 * border ) < 0) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(height=%d)", dimensions, height); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(height=%d)", dimensions, height); } return GL_TRUE; } @@ -842,9 +837,8 @@ texture_error_check( GLcontext *ctx, GLenum target, if (depth < 2 * border || depth > 2 + maxTextureSize || logbase2( depth - 2 * border ) < 0) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage3D(depth=%d)", depth ); - _mesa_error( ctx, GL_INVALID_VALUE, message ); + _mesa_error( ctx, GL_INVALID_VALUE, + "glTexImage3D(depth=%d)", depth ); } return GL_TRUE; } @@ -855,18 +849,16 @@ texture_error_check( GLcontext *ctx, GLenum target, target == GL_PROXY_TEXTURE_RECTANGLE_NV) { if (level != 0) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage2D(level=%d)", level); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage2D(level=%d)", level); } return GL_TRUE; } } else if (level < 0 || level >= maxLevels) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(level=%d)", dimensions, level); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(level=%d)", dimensions, level); } return GL_TRUE; } @@ -883,10 +875,9 @@ texture_error_check( GLcontext *ctx, GLenum target, iformat = _mesa_base_tex_format( ctx, internalFormat ); if (iformat < 0) { if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(internalFormat=0x%x)", dimensions, - internalFormat); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%dD(internalFormat=0x%x)", + dimensions, internalFormat); } return GL_TRUE; } @@ -899,9 +890,8 @@ texture_error_check( GLcontext *ctx, GLenum target, * is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4. */ if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(format or type)", dimensions); - _mesa_error(ctx, GL_INVALID_OPERATION, message); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%dD(format or type)", dimensions); } return GL_TRUE; } @@ -970,28 +960,22 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, ASSERT(maxLevels > 0); if (level < 0 || level >= maxLevels) { - char message[100]; - sprintf(message, "glTexSubImage2D(level=%d)", level); - _mesa_error(ctx, GL_INVALID_ENUM, message); + _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage2D(level=%d)", level); return GL_TRUE; } if (width < 0) { - char message[100]; - sprintf(message, "glTexSubImage%dD(width=%d)", dimensions, width); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexSubImage%dD(width=%d)", dimensions, width); return GL_TRUE; } if (height < 0 && dimensions > 1) { - char message[100]; - sprintf(message, "glTexSubImage%dD(height=%d)", dimensions, height); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexSubImage%dD(height=%d)", dimensions, height); return GL_TRUE; } if (depth < 0 && dimensions > 2) { - char message[100]; - sprintf(message, "glTexSubImage%dD(depth=%d)", dimensions, depth); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%dD(depth=%d)", dimensions, depth); return GL_TRUE; } @@ -1034,9 +1018,8 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, compressed = is_compressed_format(ctx, destTex->IntFormat); if (!compressed && !_mesa_is_legal_format_and_type(format, type)) { - char message[100]; - sprintf(message, "glTexSubImage%dD(format or type)", dimensions); - _mesa_error(ctx, GL_INVALID_ENUM, message); + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexSubImage%dD(format or type)", dimensions); return GL_TRUE; } @@ -1113,18 +1096,16 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, /* Border */ if (border != 0 && border != 1) { - char message[100]; - sprintf(message, "glCopyTexImage%dD(border)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(border)", dimensions); return GL_TRUE; } /* Width */ if (width < 2 * border || width > 2 + maxTextureSize || logbase2( width - 2 * border ) < 0) { - char message[100]; - sprintf(message, "glCopyTexImage%dD(width=%d)", dimensions, width); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(width=%d)", dimensions, width); return GL_TRUE; } @@ -1132,9 +1113,8 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, if (dimensions >= 2) { if (height < 2 * border || height > 2 + maxTextureSize || logbase2( height - 2 * border ) < 0) { - char message[100]; - sprintf(message, "glCopyTexImage%dD(height=%d)", dimensions, height); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(height=%d)", dimensions, height); return GL_TRUE; } } @@ -1150,17 +1130,15 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, /* Level */ if (level < 0 || level >= maxLevels) { - char message[100]; - sprintf(message, "glCopyTexImage%dD(level=%d)", dimensions, level); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(level=%d)", dimensions, level); return GL_TRUE; } iformat = _mesa_base_tex_format(ctx, internalFormat); if (iformat < 0) { - char message[100]; - sprintf(message, "glCopyTexImage%dD(internalFormat)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexImage%dD(internalFormat)", dimensions); return GL_TRUE; } @@ -1216,72 +1194,62 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, ASSERT(maxLevels > 0); if (level < 0 || level >= maxLevels) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(level=%d)", dimensions, level); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(level=%d)", dimensions, level); return GL_TRUE; } if (width < 0) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(width=%d)", dimensions, width); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(width=%d)", dimensions, width); return GL_TRUE; } if (dimensions > 1 && height < 0) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(height=%d)", dimensions, height); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(height=%d)", dimensions, height); return GL_TRUE; } teximage = _mesa_select_tex_image(ctx, texUnit, target, level); if (!teximage) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(undefined texture)", dimensions); - _mesa_error(ctx, GL_INVALID_OPERATION, message); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCopyTexSubImage%dD(undefined texture)", dimensions); return GL_TRUE; } if (xoffset < -((GLint)teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(xoffset=%d)", dimensions, xoffset); return GL_TRUE; } if (xoffset + width > (GLint) (teximage->Width + teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(xoffset+width)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(xoffset+width)", dimensions); return GL_TRUE; } if (dimensions > 1) { if (yoffset < -((GLint)teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(yoffset=%d)", dimensions, yoffset); return GL_TRUE; } /* NOTE: we're adding the border here, not subtracting! */ if (yoffset + height > (GLint) (teximage->Height + teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(yoffset+height)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(yoffset+height)", dimensions); return GL_TRUE; } } if (dimensions > 2) { if (zoffset < -((GLint)teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(zoffset)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(zoffset)", dimensions); return GL_TRUE; } if (zoffset > (GLint) (teximage->Depth + teximage->Border)) { - char message[100]; - sprintf(message, "glCopyTexSubImage%dD(zoffset+depth)", dimensions); - _mesa_error(ctx, GL_INVALID_VALUE, message); + _mesa_error(ctx, GL_INVALID_VALUE, + "glCopyTexSubImage%dD(zoffset+depth)", dimensions); return GL_TRUE; } } diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 7d4b402d28e..909492cd499 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1,4 +1,4 @@ -/* $Id: texobj.c,v 1.56 2002/06/17 23:36:31 brianp Exp $ */ +/* $Id: texobj.c,v 1.57 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -219,7 +219,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, static void incomplete(const struct gl_texture_object *t, const char *why) { - printf("Texture Obj %d incomplete because: %s\n", t->Name, why); + _mesa_printf("Texture Obj %d incomplete because: %s\n", t->Name, why); } #else #define incomplete(a, b) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 8f4f3631ea7..e0d3a4ae20d 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.76 2002/06/17 23:36:31 brianp Exp $ */ +/* $Id: texstate.c,v 1.77 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -131,11 +131,7 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) ASSERT_OUTSIDE_BEGIN_END(ctx); #define TE_ERROR(errCode, msg, value) \ - { \ - char s[100]; \ - sprintf(s, msg, _mesa_lookup_enum_by_nr(value)); \ - _mesa_error(ctx, errCode, s); \ - } + _mesa_error(ctx, errCode, msg, _mesa_lookup_enum_by_nr(value)); if (target == GL_TEXTURE_ENV) { switch (pname) { @@ -1347,11 +1343,8 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) break; default: - { - char s[100]; - sprintf(s, "glTexParameter(pname=0x%x)", pname); - _mesa_error( ctx, GL_INVALID_ENUM, s); - } + _mesa_error(ctx, GL_INVALID_ENUM, + "glTexParameter(pname=0x%x)", pname); return; } @@ -1454,7 +1447,12 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, case GL_PROXY_TEXTURE_3D: maxLevels = ctx->Const.Max3DTextureLevels; break; - case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: case GL_PROXY_TEXTURE_CUBE_MAP_ARB: maxLevels = ctx->Const.MaxCubeTextureLevels; break; @@ -1463,7 +1461,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, maxLevels = 1; break; default: - _mesa_problem(ctx, "bad target in _mesa_GetTexLevelParameter"); + _mesa_printf(ctx, "bad target in _mesa_GetTexLevelParameter (0x%x)", target); return; } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 7d37bcb00fd..674de7af52c 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1,4 +1,4 @@ -/* $Id: texstore.c,v 1.37 2002/06/15 03:03:09 brianp Exp $ */ +/* $Id: texstore.c,v 1.38 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1470,7 +1470,7 @@ make_3d_mipmap(const struct gl_texture_format *format, GLint border, */ /* - printf("mip3d %d x %d x %d -> %d x %d x %d\n", + _mesa_printf("mip3d %d x %d x %d -> %d x %d x %d\n", srcWidth, srcHeight, srcDepth, dstWidth, dstHeight, dstDepth); */ diff --git a/src/mesa/main/texutil_tmp.h b/src/mesa/main/texutil_tmp.h index 3d2ecd9fd02..7a70a55d024 100644 --- a/src/mesa/main/texutil_tmp.h +++ b/src/mesa/main/texutil_tmp.h @@ -1,4 +1,4 @@ -/* $Id: texutil_tmp.h,v 1.9 2002/02/21 15:12:31 brianp Exp $ */ +/* $Id: texutil_tmp.h,v 1.10 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -27,11 +27,15 @@ * Gareth Hughes <gareth@valinux.com> */ + + /* * NOTE: All 3D teximage code is untested and most definitely broken... */ + + #define DST_TEXEL_BYTES (4 / DST_TEXELS_PER_DWORD) #define DST_ROW_BYTES (convert->width * DST_TEXEL_BYTES) #define DST_ROW_STRIDE (convert->dstImageWidth * DST_TEXEL_BYTES) @@ -51,7 +55,7 @@ TAG(texsubimage2d)( struct gl_texture_convert *convert ) convert->xoffset) * DST_TEXEL_BYTES); #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif #ifdef CONVERT_DIRECT @@ -87,7 +91,7 @@ TAG(texsubimage3d)( struct gl_texture_convert *convert ) convert->yoffset) * convert->width + convert->xoffset) * DST_TEXEL_BYTES); #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif #ifdef CONVERT_DIRECT @@ -130,11 +134,11 @@ TAG(texsubimage2d_stride)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _mesa_debug( NULL, __FUNCTION__ ":\n" ); + _mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", convert->xoffset, convert->yoffset, convert->width, convert->height, convert->dstImageWidth ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( row = 0 ; row < convert->height ; row++ ) { @@ -164,11 +168,11 @@ TAG(texsubimage3d_stride)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _mesa_debug( NULL, __FUNCTION__ ":\n" ); + _mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", convert->xoffset, convert->yoffset, convert->width, convert->height, convert->dstImageWidth ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( img = 0 ; img < convert->depth ; img++ ) { @@ -203,7 +207,7 @@ TAG(texsubimage2d_unpack)( struct gl_texture_convert *convert ) GLint row, col; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif if (convert->width & (DST_TEXELS_PER_DWORD - 1)) { @@ -265,7 +269,7 @@ TAG(texsubimage3d_unpack)( struct gl_texture_convert *convert ) GLint row, col, img; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ "\n" ); + _mesa_debug( NULL, __FUNCTION__ "\n" ); #endif if (convert->width & (DST_TEXELS_PER_DWORD - 1)) { @@ -343,11 +347,11 @@ TAG(texsubimage2d_stride_unpack)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _mesa_debug( NULL, __FUNCTION__ ":\n" ); + _mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", convert->xoffset, convert->yoffset, convert->width, convert->height, convert->dstImageWidth ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( row = 0 ; row < convert->height ; row++ ) { @@ -396,11 +400,11 @@ TAG(texsubimage3d_stride_unpack)( struct gl_texture_convert *convert ) adjust = convert->dstImageWidth - convert->width; #if DEBUG_TEXUTIL - fprintf( stderr, __FUNCTION__ ":\n" ); - fprintf( stderr, " x=%d y=%d w=%d h=%d s=%d\n", + _mesa_debug( NULL, __FUNCTION__ ":\n" ); + _mesa_debug( NULL, " x=%d y=%d w=%d h=%d s=%d\n", convert->xoffset, convert->yoffset, convert->width, convert->height, convert->dstImageWidth ); - fprintf( stderr, " adjust=%d\n", adjust ); + _mesa_debug( NULL, " adjust=%d\n", adjust ); #endif for ( img = 0 ; img < convert->depth ; img++ ) { diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 14b8e8381aa..44e387f92c5 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -1,4 +1,4 @@ -/* $Id: vtxfmt.c,v 1.11 2002/04/09 16:56:50 keithw Exp $ */ +/* $Id: vtxfmt.c,v 1.12 2002/06/29 19:48:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -61,7 +61,7 @@ tnl->SwapCount++; \ \ if ( 0 ) \ - fprintf( stderr, " swapping gl" #FUNC"...\n" ); \ + _mesa_debug(ctx, " swapping gl" #FUNC"...\n" ); \ \ /* Install the tnl function pointer. */ \ ctx->Exec->FUNC = tnl->Current->FUNC; \ diff --git a/src/mesa/math/m_debug_clip.c b/src/mesa/math/m_debug_clip.c index b6557665a65..40230605b4c 100644 --- a/src/mesa/math/m_debug_clip.c +++ b/src/mesa/math/m_debug_clip.c @@ -1,4 +1,4 @@ -/* $Id: m_debug_clip.c,v 1.1 2001/05/21 16:33:41 gareth Exp $ */ +/* $Id: m_debug_clip.c,v 1.2 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -48,10 +48,12 @@ static char *cnames[2] = { "_mesa_clip_tab", "_mesa_clip_np_tab" }; +#ifdef RUN_DEBUG_BENCHMARK static char *cstrings[2] = { "clip, perspective divide", "clip, no divide" }; +#endif /* ============================================================= @@ -253,20 +255,20 @@ static int test_cliptest_function( clip_func func, int np, } if ( dco != rco ) { - printf( "\n-----------------------------\n" ); - printf( "dco = 0x%02x rco = 0x%02x\n", dco, rco ); + _mesa_printf(NULL, "\n-----------------------------\n" ); + _mesa_printf(NULL, "dco = 0x%02x rco = 0x%02x\n", dco, rco ); return 0; } if ( dca != rca ) { - printf( "\n-----------------------------\n" ); - printf( "dca = 0x%02x rca = 0x%02x\n", dca, rca ); + _mesa_printf(NULL, "\n-----------------------------\n" ); + _mesa_printf(NULL, "dca = 0x%02x rca = 0x%02x\n", dca, rca ); return 0; } for ( i = 0 ; i < TEST_COUNT ; i++ ) { if ( dm[i] != rm[i] ) { - printf( "\n-----------------------------\n" ); - printf( "(i = %i)\n", i ); - printf( "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] ); + _mesa_printf(NULL, "\n-----------------------------\n" ); + _mesa_printf(NULL, "(i = %i)\n", i ); + _mesa_printf(NULL, "dm = 0x%02x rm = 0x%02x\n", dm[i], rm[i] ); return 0; } } @@ -280,19 +282,19 @@ static int test_cliptest_function( clip_func func, int np, for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 4 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - printf( "\n-----------------------------\n" ); - printf( "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n", + _mesa_printf(NULL, "\n-----------------------------\n" ); + _mesa_printf(NULL, "(i = %i, j = %i) dm = 0x%02x rm = 0x%02x\n", i, j, dm[i], rm[i] ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][0], r[i][0], r[i][0]-d[i][0], MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][1], r[i][1], r[i][1]-d[i][1], MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][2], r[i][2], r[i][2]-d[i][2], MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][3], r[i][3], r[i][3]-d[i][3], MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); return 0; @@ -318,19 +320,19 @@ void _math_test_all_cliptest_functions( char *description ) if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); - printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + _mesa_printf(NULL, "counter overhead: %ld cycles\n\n", counter_overhead ); } - printf( "cliptest results after hooking in %s functions:\n", description ); + _mesa_printf(NULL, "cliptest results after hooking in %s functions:\n", description ); } #endif #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( "\n\t" ); + _mesa_printf(NULL, "\n\t" ); for ( psize = 2 ; psize <= 4 ; psize++ ) { - printf( " p%d\t", psize ); + _mesa_printf(NULL, " p%d\t", psize ); } - printf( "\n--------------------------------------------------------\n\t" ); + _mesa_printf(NULL, "\n--------------------------------------------------------\n\t" ); } #endif @@ -341,23 +343,23 @@ void _math_test_all_cliptest_functions( char *description ) if ( test_cliptest_function( func, np, psize, cycles ) == 0 ) { char buf[100]; - sprintf( buf, "%s[%d] failed test (%s)", + _mesa_sprintf(NULL, buf, "%s[%d] failed test (%s)", cnames[np], psize, description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " %li\t", benchmark_tab[np][psize-1] ); + _mesa_printf(NULL, " %li\t", benchmark_tab[np][psize-1] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " | [%s]\n\t", cstrings[np] ); + _mesa_printf(NULL, " | [%s]\n\t", cstrings[np] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( "\n" ); + _mesa_printf(NULL, "\n" ); #endif } diff --git a/src/mesa/math/m_debug_norm.c b/src/mesa/math/m_debug_norm.c index 392e7c6bfd4..ec56244e984 100644 --- a/src/mesa/math/m_debug_norm.c +++ b/src/mesa/math/m_debug_norm.c @@ -1,4 +1,4 @@ -/* $Id: m_debug_norm.c,v 1.8 2002/01/05 20:51:12 brianp Exp $ */ +/* $Id: m_debug_norm.c,v 1.9 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -181,6 +181,15 @@ static void ref_norm_transform_normalize( const GLmatrix *mat, * Normal transformation tests */ +static void init_matrix( GLfloat *m ) +{ + m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; + m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; + m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; + m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; +} + + static int test_norm_function( normal_func func, int mtype, long *cycles ) { GLvector4f source[1], dest[1], dest2[1], ref[1], ref2[1]; @@ -282,15 +291,15 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 3 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - printf( "-----------------------------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "-----------------------------\n" ); + _mesa_printf(NULL, "(i = %i, j = %i)\n", i, j ); + _mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", d[i][0], r[i][0], r[i][0]/d[i][0], MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", d[i][1], r[i][1], r[i][1]/d[i][1], MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", d[i][2], r[i][2], r[i][2]/d[i][2], MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); return 0; @@ -298,15 +307,15 @@ static int test_norm_function( normal_func func, int mtype, long *cycles ) if ( norm_normalize_types[mtype] != 0 ) { if ( significand_match( d2[i][j], r2[i][j] ) < REQUIRED_PRECISION ) { - printf( "------------------- precalculated length case ------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "------------------- precalculated length case ------\n" ); + _mesa_printf(NULL, "(i = %i, j = %i)\n", i, j ); + _mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][0], r2[i][0], r2[i][0]/d2[i][0], MAX_PRECISION - significand_match( d2[i][0], r2[i][0] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][1], r2[i][1], r2[i][1]/d2[i][1], MAX_PRECISION - significand_match( d2[i][1], r2[i][1] ) ); - printf( "%f \t %f \t [ratio = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [ratio = %e - %i bit missed]\n", d2[i][2], r2[i][2], r2[i][2]/d2[i][2], MAX_PRECISION - significand_match( d2[i][2], r2[i][2] ) ); return 0; @@ -334,11 +343,11 @@ void _math_test_all_normal_transform_functions( char *description ) if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); - printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + _mesa_printf(NULL, "counter overhead: %ld cycles\n\n", counter_overhead ); } - printf( "normal transform results after hooking in %s functions:\n", + _mesa_printf(NULL, "normal transform results after hooking in %s functions:\n", description ); - printf( "\n-------------------------------------------------------\n" ); + _mesa_printf(NULL, "\n-------------------------------------------------------\n" ); } #endif @@ -348,21 +357,21 @@ void _math_test_all_normal_transform_functions( char *description ) if ( test_norm_function( func, mtype, cycles ) == 0 ) { char buf[100]; - sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)", + _mesa_sprintf(NULL, buf, "_mesa_normal_tab[0][%s] failed test (%s)", norm_strings[mtype], description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( " %li\t", benchmark_tab[mtype] ); - printf( " | [%s]\n", norm_strings[mtype] ); + _mesa_printf(NULL, " %li\t", benchmark_tab[mtype] ); + _mesa_printf(NULL, " | [%s]\n", norm_strings[mtype] ); } #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( "\n" ); + _mesa_printf(NULL, "\n" ); fflush( stdout ); } #endif diff --git a/src/mesa/math/m_debug_util.h b/src/mesa/math/m_debug_util.h index efedda973bb..f96a6b89379 100644 --- a/src/mesa/math/m_debug_util.h +++ b/src/mesa/math/m_debug_util.h @@ -1,4 +1,4 @@ -/* $Id: m_debug_util.h,v 1.4 2001/05/23 14:27:03 brianp Exp $ */ +/* $Id: m_debug_util.h,v 1.5 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -263,15 +263,6 @@ static int significand_match( GLfloat a, GLfloat b ) enum { NIL = 0, ONE = 1, NEG = -1, VAR = 2 }; -static void init_matrix( GLfloat *m ) -{ - m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; - m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; - m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; - m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; -} - - /* Ensure our arrays are correctly aligned. */ #if defined(__GNUC__) diff --git a/src/mesa/math/m_debug_xform.c b/src/mesa/math/m_debug_xform.c index 9cbb95c125b..fb79a313d8e 100644 --- a/src/mesa/math/m_debug_xform.c +++ b/src/mesa/math/m_debug_xform.c @@ -1,4 +1,4 @@ -/* $Id: m_debug_xform.c,v 1.8 2001/03/30 14:44:43 gareth Exp $ */ +/* $Id: m_debug_xform.c,v 1.9 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -150,6 +150,14 @@ static void ref_transform( GLvector4f *dst, * Vertex transformation tests */ +static void init_matrix( GLfloat *m ) +{ + m[0] = 63.0; m[4] = 43.0; m[ 8] = 29.0; m[12] = 43.0; + m[1] = 55.0; m[5] = 17.0; m[ 9] = 31.0; m[13] = 7.0; + m[2] = 44.0; m[6] = 9.0; m[10] = 7.0; m[14] = 3.0; + m[3] = 11.0; m[7] = 23.0; m[11] = 91.0; m[15] = 9.0; +} + static GLfloat s[TEST_COUNT][4] ALIGN16; static GLfloat d[TEST_COUNT][4] ALIGN16; static GLfloat r[TEST_COUNT][4] ALIGN16; @@ -242,18 +250,18 @@ static int test_transform_function( transform_func func, int psize, for ( i = 0 ; i < TEST_COUNT ; i++ ) { for ( j = 0 ; j < 4 ; j++ ) { if ( significand_match( d[i][j], r[i][j] ) < REQUIRED_PRECISION ) { - printf( "-----------------------------\n" ); - printf( "(i = %i, j = %i)\n", i, j ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf(NULL, "-----------------------------\n" ); + _mesa_printf(NULL, "(i = %i, j = %i)\n", i, j ); + _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][0], r[i][0], r[i][0]-d[i][0], MAX_PRECISION - significand_match( d[i][0], r[i][0] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][1], r[i][1], r[i][1]-d[i][1], MAX_PRECISION - significand_match( d[i][1], r[i][1] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][2], r[i][2], r[i][2]-d[i][2], MAX_PRECISION - significand_match( d[i][2], r[i][2] ) ); - printf( "%f \t %f \t [diff = %e - %i bit missed]\n", + _mesa_printf(NULL, "%f \t %f \t [diff = %e - %i bit missed]\n", d[i][3], r[i][3], r[i][3]-d[i][3], MAX_PRECISION - significand_match( d[i][3], r[i][3] ) ); return 0; @@ -280,19 +288,19 @@ void _math_test_all_transform_functions( char *description ) if ( mesa_profile ) { if ( !counter_overhead ) { INIT_COUNTER(); - printf( "counter overhead: %ld cycles\n\n", counter_overhead ); + _mesa_printf(NULL, "counter overhead: %ld cycles\n\n", counter_overhead ); } - printf( "transform results after hooking in %s functions:\n", description ); + _mesa_printf(NULL, "transform results after hooking in %s functions:\n", description ); } #endif #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) { - printf( "\n" ); + _mesa_printf(NULL, "\n" ); for ( psize = 1 ; psize <= 4 ; psize++ ) { - printf( " p%d\t", psize ); + _mesa_printf(NULL, " p%d\t", psize ); } - printf( "\n--------------------------------------------------------\n" ); + _mesa_printf(NULL, "\n--------------------------------------------------------\n" ); } #endif @@ -303,23 +311,23 @@ void _math_test_all_transform_functions( char *description ) if ( test_transform_function( func, psize, mtype, cycles ) == 0 ) { char buf[100]; - sprintf( buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", + _mesa_sprintf(NULL, buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)", psize, mstrings[mtype], description ); _mesa_problem( NULL, buf ); } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " %li\t", benchmark_tab[psize-1][mtype] ); + _mesa_printf(NULL, " %li\t", benchmark_tab[psize-1][mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( " | [%s]\n", mstrings[mtype] ); + _mesa_printf(NULL, " | [%s]\n", mstrings[mtype] ); #endif } #ifdef RUN_DEBUG_BENCHMARK if ( mesa_profile ) - printf( "\n" ); + _mesa_printf(NULL, "\n" ); #endif } diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index 8ce62d68cd0..2a69336b4db 100644 --- a/src/mesa/math/m_matrix.c +++ b/src/mesa/math/m_matrix.c @@ -1,4 +1,4 @@ -/* $Id: m_matrix.c,v 1.11 2002/03/29 17:18:08 brianp Exp $ */ +/* $Id: m_matrix.c,v 1.12 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -37,6 +37,7 @@ #include <math.h> #include "glheader.h" +#include "imports.h" #include "macros.h" #include "mem.h" #include "mmath.h" @@ -136,25 +137,25 @@ static void print_matrix_floats( const GLfloat m[16] ) { int i; for (i=0;i<4;i++) { - fprintf(stderr,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); + _mesa_debug(NULL,"\t%f %f %f %f\n", m[i], m[4+i], m[8+i], m[12+i] ); } } void _math_matrix_print( const GLmatrix *m ) { - fprintf(stderr, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); + _mesa_debug(NULL, "Matrix type: %s, flags: %x\n", types[m->type], m->flags); print_matrix_floats(m->m); - fprintf(stderr, "Inverse: \n"); + _mesa_debug(NULL, "Inverse: \n"); if (m->inv) { GLfloat prod[16]; print_matrix_floats(m->inv); matmul4(prod, m->m, m->inv); - fprintf(stderr, "Mat * Inverse:\n"); + _mesa_debug(NULL, "Mat * Inverse:\n"); print_matrix_floats(prod); } else { - fprintf(stderr, " - not available\n"); + _mesa_debug(NULL, " - not available\n"); } } @@ -468,6 +469,8 @@ static GLboolean invert_matrix_2d_no_rot( GLmatrix *mat ) } +#if 0 +/* broken */ static GLboolean invert_matrix_perspective( GLmatrix *mat ) { const GLfloat *in = mat->m; @@ -492,6 +495,7 @@ static GLboolean invert_matrix_perspective( GLmatrix *mat ) return GL_TRUE; } +#endif typedef GLboolean (*inv_mat_func)( GLmatrix *mat ); diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index 0195faf7e4e..b94afdd126b 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -1,4 +1,4 @@ -/* $Id: m_vector.c,v 1.6 2001/03/12 00:48:41 gareth Exp $ */ +/* $Id: m_vector.c,v 1.7 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -30,6 +30,7 @@ #include "glheader.h" +#include "imports.h" #include "macros.h" #include "mem.h" @@ -367,36 +368,36 @@ void _mesa_vector4f_print( GLvector4f *v, GLubyte *cullmask, GLboolean culling ) GLfloat *d = (GLfloat *)v->data; GLuint j, i = 0, count; - printf("data-start\n"); + _mesa_printf(NULL, "data-start\n"); for ( ; d != v->start ; STRIDE_F(d, v->stride), i++) - printf( t, i, d[0], d[1], d[2], d[3]); + _mesa_printf(NULL, t, i, d[0], d[1], d[2], d[3]); - printf("start-count(%u)\n", v->count); + _mesa_printf(NULL, "start-count(%u)\n", v->count); count = i + v->count; if (culling) { for ( ; i < count ; STRIDE_F(d, v->stride), i++) if (cullmask[i]) - printf( t, i, d[0], d[1], d[2], d[3]); + _mesa_printf(NULL, t, i, d[0], d[1], d[2], d[3]); } else { for ( ; i < count ; STRIDE_F(d, v->stride), i++) - printf( t, i, d[0], d[1], d[2], d[3]); + _mesa_printf(NULL, t, i, d[0], d[1], d[2], d[3]); } for (j = v->size ; j < 4; j++) { if ((v->flags & (1<<j)) == 0) { - printf("checking col %u is clean as advertised ", j); + _mesa_printf(NULL, "checking col %u is clean as advertised ", j); for (i = 0, d = (GLfloat *) v->data ; i < count && d[j] == c[j] ; i++, STRIDE_F(d, v->stride)) {}; if (i == count) - printf(" --> ok\n"); + _mesa_printf(NULL, " --> ok\n"); else - printf(" --> Failed at %u ******\n", i); + _mesa_printf(NULL, " --> Failed at %u ******\n", i); } } } @@ -410,20 +411,20 @@ void _mesa_vector3f_print( GLvector3f *v, GLubyte *cullmask, GLboolean culling ) GLfloat *d = (GLfloat *)v->data; GLuint i = 0, count; - printf("data-start\n"); + _mesa_printf(NULL, "data-start\n"); for ( ; d != v->start ; STRIDE_F(d,v->stride), i++) - printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); + _mesa_printf(NULL, "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); - printf("start-count(%u)\n", v->count); + _mesa_printf(NULL, "start-count(%u)\n", v->count); count = i + v->count; if (culling) { for ( ; i < count ; STRIDE_F(d,v->stride), i++) if (cullmask[i]) - printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); + _mesa_printf(NULL, "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); } else { for ( ; i < count ; STRIDE_F(d,v->stride), i++) - printf( "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); + _mesa_printf(NULL, "%u:\t%f, %f, %f\n", i, d[0], d[1], d[2]); } } diff --git a/src/mesa/swrast_setup/ss_vb.c b/src/mesa/swrast_setup/ss_vb.c index fce1d489a0c..69fa10b3eb2 100644 --- a/src/mesa/swrast_setup/ss_vb.c +++ b/src/mesa/swrast_setup/ss_vb.c @@ -1,4 +1,4 @@ -/* $Id: ss_vb.c,v 1.19 2002/06/15 03:03:12 brianp Exp $ */ +/* $Id: ss_vb.c,v 1.20 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -361,6 +361,7 @@ static void init_standard( void ) /* debug only */ +#if 0 static void printSetupFlags(const GLcontext *ctx, char *msg, GLuint flags ) { @@ -375,7 +376,7 @@ printSetupFlags(const GLcontext *ctx, char *msg, GLuint flags ) (flags & FOG) ? "fog, " : "", (flags & POINT) ? "point, " : ""); } - +#endif void _swsetup_choose_rastersetup_func(GLcontext *ctx) diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c index 9be6c947937..e2b37ccfb46 100644 --- a/src/mesa/tnl/t_array_api.c +++ b/src/mesa/tnl/t_array_api.c @@ -1,4 +1,4 @@ -/* $Id: t_array_api.c,v 1.26 2002/04/19 00:45:50 brianp Exp $ */ +/* $Id: t_array_api.c,v 1.27 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -80,7 +80,7 @@ static void _tnl_draw_range_elements( GLcontext *ctx, GLenum mode, TNLcontext *tnl = TNL_CONTEXT(ctx); FLUSH_CURRENT( ctx, 0 ); - /* fprintf(stderr, "%s\n", __FUNCTION__); */ + /* _mesa_debug(ctx, "%s\n", __FUNCTION__); */ if (tnl->pipeline.build_state_changes) _tnl_validate_pipeline( ctx ); @@ -116,7 +116,7 @@ _tnl_DrawArrays(GLenum mode, GLint start, GLsizei count) GLuint thresh = (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) ? 30 : 10; if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "_tnl_DrawArrays %d %d\n", start, count); + _mesa_debug(NULL, "_tnl_DrawArrays %d %d\n", start, count); /* Check arguments, etc. */ @@ -252,7 +252,7 @@ _tnl_DrawRangeElements(GLenum mode, GLuint *ui_indices; if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "_tnl_DrawRangeElements %d %d %d\n", start, end, count); + _mesa_debug(NULL, "_tnl_DrawRangeElements %d %d %d\n", start, end, count); /* Check arguments, etc. */ @@ -319,7 +319,7 @@ _tnl_DrawElements(GLenum mode, GLsizei count, GLenum type, GLuint *ui_indices; if (MESA_VERBOSE & VERBOSE_API) - fprintf(stderr, "_tnl_DrawElements %d\n", count); + _mesa_debug(NULL, "_tnl_DrawElements %d\n", count); /* Check arguments, etc. */ diff --git a/src/mesa/tnl/t_array_import.c b/src/mesa/tnl/t_array_import.c index 082ae4ad3ca..b949bc639a7 100644 --- a/src/mesa/tnl/t_array_import.c +++ b/src/mesa/tnl/t_array_import.c @@ -1,4 +1,4 @@ -/* $Id: t_array_import.c,v 1.24 2002/04/21 20:37:04 brianp Exp $ */ +/* $Id: t_array_import.c,v 1.25 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -340,7 +340,7 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count ) GLuint inputs = tnl->pipeline.inputs; struct vertex_arrays *tmp = &tnl->array_inputs; -/* fprintf(stderr, "%s %d..%d // %d..%d\n", __FUNCTION__, */ +/* _mesa_debug(ctx, "%s %d..%d // %d..%d\n", __FUNCTION__, */ /* start, count, ctx->Array.LockFirst, ctx->Array.LockCount); */ /* _tnl_print_vert_flags(" inputs", inputs); */ /* _tnl_print_vert_flags(" _Enabled", ctx->Array._Enabled); */ diff --git a/src/mesa/tnl/t_imm_debug.c b/src/mesa/tnl/t_imm_debug.c index ea57548505d..5def0d73a7b 100644 --- a/src/mesa/tnl/t_imm_debug.c +++ b/src/mesa/tnl/t_imm_debug.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_debug.c,v 1.7 2002/01/22 14:35:16 brianp Exp $ */ +/* $Id: t_imm_debug.c,v 1.8 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,12 +25,13 @@ */ #include "mtypes.h" +#include "context.h" #include "t_context.h" #include "t_imm_debug.h" void _tnl_print_vert_flags( const char *name, GLuint flags ) { - fprintf(stderr, + _mesa_debug(NULL, "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", name, flags, @@ -70,7 +71,7 @@ void _tnl_print_cassette( struct immediate *IM ) GLuint state = IM->BeginState; GLuint req = ~0; - fprintf(stderr, "Cassette id %d, %u rows.\n", IM->id, + _mesa_debug(NULL, "Cassette id %d, %u rows.\n", IM->id, IM->Count - IM->CopyStart); _tnl_print_vert_flags("Contains at least one", orflag); @@ -79,7 +80,7 @@ void _tnl_print_cassette( struct immediate *IM ) { _tnl_print_vert_flags("Contains a full complement of", andflag); - fprintf(stderr, "Final begin/end state %s/%s, errors %s/%s\n", + _mesa_debug(NULL, "Final begin/end state %s/%s, errors %s/%s\n", (state & VERT_BEGIN_0) ? "in" : "out", (state & VERT_BEGIN_1) ? "in" : "out", (state & VERT_ERROR_0) ? "y" : "n", @@ -88,24 +89,24 @@ void _tnl_print_cassette( struct immediate *IM ) } for (i = IM->CopyStart ; i <= IM->Count ; i++) { - fprintf(stderr, "%u: ", i); + _mesa_debug(NULL, "%u: ", i); if (req & VERT_BITS_OBJ_234) { if (flags[i] & VERT_BIT_EVAL_C1) - fprintf(stderr, "EvalCoord %f ", + _mesa_debug(NULL, "EvalCoord %f ", IM->Attrib[VERT_ATTRIB_POS][i][0]); else if (flags[i] & VERT_BIT_EVAL_P1) - fprintf(stderr, "EvalPoint %.0f ", + _mesa_debug(NULL, "EvalPoint %.0f ", IM->Attrib[VERT_ATTRIB_POS][i][0]); else if (flags[i] & VERT_BIT_EVAL_C2) - fprintf(stderr, "EvalCoord %f %f ", + _mesa_debug(NULL, "EvalCoord %f %f ", IM->Attrib[VERT_ATTRIB_POS][i][0], IM->Attrib[VERT_ATTRIB_POS][i][1]); else if (flags[i] & VERT_BIT_EVAL_P2) - fprintf(stderr, "EvalPoint %.0f %.0f ", + _mesa_debug(NULL, "EvalPoint %.0f %.0f ", IM->Attrib[VERT_ATTRIB_POS][i][0], IM->Attrib[VERT_ATTRIB_POS][i][1]); else if (i < IM->Count && (flags[i] & VERT_BITS_OBJ_234)) { - fprintf(stderr, "Obj %f %f %f %f", + _mesa_debug(NULL, "Obj %f %f %f %f", IM->Attrib[VERT_ATTRIB_POS][i][0], IM->Attrib[VERT_ATTRIB_POS][i][1], IM->Attrib[VERT_ATTRIB_POS][i][2], @@ -114,10 +115,10 @@ void _tnl_print_cassette( struct immediate *IM ) } if (req & flags[i] & VERT_BIT_ELT) - fprintf(stderr, " Elt %u\t", IM->Elt[i]); + _mesa_debug(NULL, " Elt %u\t", IM->Elt[i]); if (req & flags[i] & VERT_BIT_NORMAL) - fprintf(stderr, " Norm %f %f %f ", + _mesa_debug(NULL, " Norm %f %f %f ", IM->Attrib[VERT_ATTRIB_NORMAL][i][0], IM->Attrib[VERT_ATTRIB_NORMAL][i][1], IM->Attrib[VERT_ATTRIB_NORMAL][i][2]); @@ -126,7 +127,7 @@ void _tnl_print_cassette( struct immediate *IM ) GLuint j; for (j = 0 ; j < MAX_TEXTURE_UNITS ; j++) { if (req & flags[i] & VERT_BIT_TEX(j)) { - fprintf(stderr, "TC%d %f %f %f %f", j, + _mesa_debug(NULL, "TC%d %f %f %f %f", j, IM->Attrib[VERT_ATTRIB_TEX0 + j][i][0], IM->Attrib[VERT_ATTRIB_TEX0 + j][i][1], IM->Attrib[VERT_ATTRIB_TEX0 + j][i][2], @@ -136,45 +137,45 @@ void _tnl_print_cassette( struct immediate *IM ) } if (req & flags[i] & VERT_BIT_COLOR0) - fprintf(stderr, " Rgba %f %f %f %f ", + _mesa_debug(NULL, " Rgba %f %f %f %f ", IM->Attrib[VERT_ATTRIB_COLOR0][i][0], IM->Attrib[VERT_ATTRIB_COLOR0][i][1], IM->Attrib[VERT_ATTRIB_COLOR0][i][2], IM->Attrib[VERT_ATTRIB_COLOR0][i][3]); if (req & flags[i] & VERT_BIT_COLOR1) - fprintf(stderr, " Spec %f %f %f ", + _mesa_debug(NULL, " Spec %f %f %f ", IM->Attrib[VERT_ATTRIB_COLOR1][i][0], IM->Attrib[VERT_ATTRIB_COLOR1][i][1], IM->Attrib[VERT_ATTRIB_COLOR1][i][2]); if (req & flags[i] & VERT_BIT_FOG) - fprintf(stderr, " Fog %f ", IM->Attrib[VERT_ATTRIB_FOG][i][0]); + _mesa_debug(NULL, " Fog %f ", IM->Attrib[VERT_ATTRIB_FOG][i][0]); if (req & flags[i] & VERT_BIT_INDEX) - fprintf(stderr, " Index %u ", IM->Index[i]); + _mesa_debug(NULL, " Index %u ", IM->Index[i]); if (req & flags[i] & VERT_BIT_EDGEFLAG) - fprintf(stderr, " Edgeflag %d ", IM->EdgeFlag[i]); + _mesa_debug(NULL, " Edgeflag %d ", IM->EdgeFlag[i]); if (req & flags[i] & VERT_BIT_MATERIAL) - fprintf(stderr, " Material "); + _mesa_debug(NULL, " Material "); /* The order of these two is not easily knowable, but this is * the usually correct way to look at them. */ if (req & flags[i] & VERT_BIT_END) - fprintf(stderr, " END "); + _mesa_debug(NULL, " END "); if (req & flags[i] & VERT_BIT_BEGIN) - fprintf(stderr, " BEGIN(%s) (%s%s%s%s)", + _mesa_debug(NULL, " BEGIN(%s) (%s%s%s%s)", _mesa_prim_name[IM->Primitive[i] & PRIM_MODE_MASK], (IM->Primitive[i] & PRIM_LAST) ? "LAST," : "", (IM->Primitive[i] & PRIM_BEGIN) ? "BEGIN," : "", (IM->Primitive[i] & PRIM_END) ? "END," : "", (IM->Primitive[i] & PRIM_PARITY) ? "PARITY," : ""); - fprintf(stderr, "\n"); + _mesa_debug(NULL, "\n"); } } diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c index d46f0a5baf7..007a2130a5e 100644 --- a/src/mesa/tnl/t_imm_fixup.c +++ b/src/mesa/tnl/t_imm_fixup.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_fixup.c,v 1.36 2002/04/19 12:32:14 brianp Exp $ */ +/* $Id: t_imm_fixup.c,v 1.37 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -78,7 +78,7 @@ _tnl_fixup_3f( float data[][3], GLuint flag[], GLuint start, GLuint match ) for (;;) { if ((flag[++i] & match) == 0) { -/* fprintf(stderr, "_tnl_fixup_3f copy to %p values %f %f %f\n", */ +/* _mesa_debug(NULL, "_tnl_fixup_3f copy to %p values %f %f %f\n", */ /* data[i], */ /* data[i-1][0], */ /* data[i-1][1], */ @@ -153,7 +153,7 @@ fixup_first_3f( GLfloat data[][3], GLuint flag[], GLuint match, GLuint i = start-1; match |= VERT_BIT_END_VB; -/* fprintf(stderr, "fixup_first_3f default: %f %f %f start: %d\n", */ +/* _mesa_debug(NULL, "fixup_first_3f default: %f %f %f start: %d\n", */ /* dflt[0], dflt[1], dflt[2], start); */ while ((flag[++i]&match) == 0) @@ -260,7 +260,7 @@ void _tnl_fixup_input( GLcontext *ctx, struct immediate *IM ) IM->CopyTexSize = IM->TexSize; -/* fprintf(stderr, "Fixup input, Start: %u Count: %u LastData: %u\n", */ +/* _mesa_debug(ctx, "Fixup input, Start: %u Count: %u LastData: %u\n", */ /* IM->Start, IM->Count, IM->LastData); */ /* _tnl_print_vert_flags("Orflag", orflag); */ /* _tnl_print_vert_flags("Andflag", andflag); */ @@ -397,7 +397,7 @@ copy_material( struct immediate *next, struct immediate *prev, GLuint dst, GLuint src ) { -/* fprintf(stderr, "%s\n", __FUNCTION__); */ +/* _mesa_debug(NULL, "%s\n", __FUNCTION__); */ if (next->Material == 0) { next->Material = (struct gl_material (*)[2]) @@ -466,7 +466,7 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next ) next->Flag[dst] = VERT_BIT_ELT; elts[i+offset] = dst; } -/* fprintf(stderr, "ADDING VERT_BIT_ELT!\n"); */ +/* _mesa_debug(ctx, "ADDING VERT_BIT_ELT!\n"); */ next->CopyOrFlag |= VERT_BIT_ELT; next->CopyAndFlag &= VERT_BIT_ELT; } @@ -509,7 +509,7 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next ) inputs->Obj.data[isrc] ); if (copy & VERT_BIT_NORMAL) { -/* fprintf(stderr, "copy vert norm %d to %d (%p): %f %f %f\n", */ +/* _mesa_debug(ctx, "copy vert norm %d to %d (%p): %f %f %f\n", */ /* isrc, dst, */ /* next->Normal[dst], */ /* inputs->Normal.data[isrc][0], */ @@ -578,7 +578,7 @@ void _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM ) GLuint fixup; GLuint start = IM->Start; -/* fprintf(stderr, "%s\n", __FUNCTION__); */ +/* _mesa_debug(ctx, "%s\n", __FUNCTION__); */ IM->Evaluated = 0; IM->CopyOrFlag = IM->OrFlag; @@ -768,7 +768,7 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM ) GLuint pintro = intro[prim]; GLuint ovf = 0; -/* fprintf(stderr, "_tnl_get_exec_copy_verts %s\n", */ +/* _mesa_debug(ctx, "_tnl_get_exec_copy_verts %s\n", */ /* _mesa_lookup_enum_by_nr(prim)); */ if (tnl->ExecCopySource) diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c index 361a2fa4421..687f286f986 100644 --- a/src/mesa/tnl/t_vb_render.c +++ b/src/mesa/tnl/t_vb_render.c @@ -1,4 +1,4 @@ -/* $Id: t_vb_render.c,v 1.30 2002/06/15 03:03:12 brianp Exp $ */ +/* $Id: t_vb_render.c,v 1.31 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -327,7 +327,7 @@ static GLboolean run_render( GLcontext *ctx, ASSERT((flags & PRIM_MODE_MASK) <= GL_POLYGON+1); if (MESA_VERBOSE & VERBOSE_PRIMS) - fprintf(stderr, "MESA prim %s %d..%d\n", + _mesa_debug(NULL, "MESA prim %s %d..%d\n", _mesa_lookup_enum_by_nr(flags & PRIM_MODE_MASK), i, i+length); diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c index f04d36c41ac..81751508bfb 100644 --- a/src/mesa/tnl/t_vb_texgen.c +++ b/src/mesa/tnl/t_vb_texgen.c @@ -1,4 +1,4 @@ -/* $Id: t_vb_texgen.c,v 1.12 2002/01/22 14:35:17 brianp Exp $ */ +/* $Id: t_vb_texgen.c,v 1.13 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -322,7 +322,7 @@ static void texgen_sphere_map( GLcontext *ctx, GLfloat (*f)[3] = store->tmp_f; GLfloat *m = store->tmp_m; -/* fprintf(stderr, "%s normstride %d eyestride %d\n", */ +/* _mesa_debug(NULL, "%s normstride %d eyestride %d\n", */ /* __FUNCTION__, VB->NormalPtr->stride, */ /* VB->EyePtr->stride); */ diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index b957f336691..4076051c87c 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -619,13 +619,13 @@ static void choose_##FN ARGS1 \ if (dfn == 0) \ dfn = tnl->codegen.FN( &vb, key ); \ else if (MESA_VERBOSE & DEBUG_CODEGEN) \ - fprintf(stderr, "%s -- cached codegen\n", __FUNCTION__ ); \ + _mesa_debug(NULL, "%s -- cached codegen\n", __FUNCTION__ ); \ \ if (dfn) \ tnl->context->Exec->FN = (FNTYPE)(dfn->code); \ else { \ if (MESA_VERBOSE & DEBUG_CODEGEN) \ - fprintf(stderr, "%s -- generic version\n", __FUNCTION__ ); \ + _mesa_debug(NULL, "%s -- generic version\n", __FUNCTION__ ); \ tnl->context->Exec->FN = tnl_##FN; \ } \ \ diff --git a/src/mesa/tnl/t_vtx_exec.c b/src/mesa/tnl/t_vtx_exec.c index b9eb5bde8db..f0e316ce3e1 100644 --- a/src/mesa/tnl/t_vtx_exec.c +++ b/src/mesa/tnl/t_vtx_exec.c @@ -144,7 +144,7 @@ static void flush_prims( TNLcontext *tnl ) static void start_prim( TNLcontext *tnl, GLuint mode ) { if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "%s %d\n", __FUNCTION__, + _mesa_debug(NULL, "%s %d\n", __FUNCTION__, tnl->initial_counter - tnl->counter); tnl->primlist[tnl->nrprims].start = tnl->initial_counter - tnl->counter; @@ -154,7 +154,7 @@ static void start_prim( TNLcontext *tnl, GLuint mode ) static void note_last_prim( TNLcontext *tnl, GLuint flags ) { if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "%s %d\n", __FUNCTION__, + _mesa_debug(NULL, "%s %d\n", __FUNCTION__, tnl->initial_counter - tnl->counter); if (tnl->prim[0] != GL_POLYGON+1) { @@ -176,7 +176,7 @@ static void copy_vertex( TNLcontext *tnl, GLuint n, GLfloat *dst ) tnl->vertex_size * 4); if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "copy_vertex %d\n", + _mesa_debug(NULL, "copy_vertex %d\n", tnl->primlist[tnl->nrprims].start + n); for (i = 0 ; i < tnl->vertex_size; i++) { @@ -190,7 +190,7 @@ static GLuint copy_wrapped_verts( TNLcontext *tnl, GLfloat (*tmp)[15] ) GLuint nr = (tnl->initial_counter - tnl->counter) - tnl->primlist[tnl->nrprims].start; if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "%s %d verts\n", __FUNCTION__, nr); + _mesa_debug(NULL, "%s %d verts\n", __FUNCTION__, nr); switch( tnl->prim[0] ) { @@ -257,7 +257,7 @@ static void wrap_buffer( void ) GLuint i, nrverts; if (MESA_VERBOSE & (DEBUG_VFMT|DEBUG_PRIMS)) - fprintf(stderr, "%s %d\n", __FUNCTION__, + _mesa_debug(NULL, "%s %d\n", __FUNCTION__, tnl->initial_counter - tnl->counter); /* Don't deal with parity. *** WONT WORK FOR COMPILE @@ -274,7 +274,7 @@ static void wrap_buffer( void ) nrverts = copy_dma_verts( tnl, tmp ); if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "%d vertices to copy\n", nrverts); + _mesa_debug(NULL, "%d vertices to copy\n", nrverts); /* Finish the prim at this point: @@ -302,10 +302,10 @@ static void wrap_buffer( void ) for (i = 0 ; i < nrverts; i++) { if (MESA_VERBOSE & DEBUG_VERTS) { int j; - fprintf(stderr, "re-emit vertex %d to %p\n", i, tnl->dmaptr); + _mesa_debug(NULL, "re-emit vertex %d to %p\n", i, tnl->dmaptr); if (MESA_VERBOSE & DEBUG_VERBOSE) for (j = 0 ; j < tnl->vertex_size; j++) - fprintf(stderr, "\t%08x/%f\n", *(int*)&tmp[i][j], tmp[i][j]); + _mesa_debug(NULL, "\t%08x/%f\n", *(int*)&tmp[i][j], tmp[i][j]); } memcpy( tnl->dmaptr, tmp[i], tnl->vertex_size * 4 ); @@ -371,7 +371,7 @@ static GLboolean check_vtx_fmt( GLcontext *ctx ) if (tnl->installed_vertex_format != tnl->vertex_format) { if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "reinstall on vertex_format change\n"); + _mesa_debug(NULL, "reinstall on vertex_format change\n"); _mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); tnl->installed_vertex_format = tnl->vertex_format; } @@ -392,7 +392,7 @@ void _tnl_InvalidateVtxfmt( GLcontext *ctx ) static void _tnl_ValidateVtxfmt( GLcontext *ctx ) { if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "%s\n", __FUNCTION__); + _mesa_debug(NULL, "%s\n", __FUNCTION__); if (ctx->Driver.NeedFlush) ctx->Driver.FlushVertices( ctx, ctx->Driver.NeedFlush ); @@ -402,18 +402,18 @@ static void _tnl_ValidateVtxfmt( GLcontext *ctx ) if (check_vtx_fmt( ctx )) { if (!tnl->installed) { if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "reinstall (new install)\n"); + _mesa_debug(NULL, "reinstall (new install)\n"); _mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); ctx->Driver.FlushVertices = _tnl_FlushVertices; tnl->installed = GL_TRUE; } else - fprintf(stderr, "%s: already installed", __FUNCTION__); + _mesa_debug(NULL, "%s: already installed", __FUNCTION__); } else { if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "%s: failed\n", __FUNCTION__); + _mesa_debug(NULL, "%s: failed\n", __FUNCTION__); if (tnl->installed) { if (tnl->tnl->dma.flush) @@ -436,7 +436,7 @@ static void _tnl_Begin( GLenum mode ) TNLcontext *tnl = tnl->tnl; if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "%s\n", __FUNCTION__); + _mesa_debug(NULL, "%s\n", __FUNCTION__); if (mode > GL_POLYGON) { _mesa_error( ctx, GL_INVALID_ENUM, "glBegin" ); @@ -456,7 +456,7 @@ static void _tnl_Begin( GLenum mode ) if (tnl->dma.flush && tnl->counter < 12) { if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "%s: flush almost-empty buffers\n", __FUNCTION__); + _mesa_debug(NULL, "%s: flush almost-empty buffers\n", __FUNCTION__); flush_prims( tnl ); } @@ -492,7 +492,7 @@ static void _tnl_End( void ) GLcontext *ctx = tnl->context; if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "%s\n", __FUNCTION__); + _mesa_debug(NULL, "%s\n", __FUNCTION__); if (tnl->prim[0] == GL_POLYGON+1) { _mesa_error( ctx, GL_INVALID_OPERATION, "glEnd" ); @@ -507,14 +507,14 @@ static void _tnl_End( void ) static void _tnl_FlushVertices( GLcontext *ctx, GLuint flags ) { if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "%s\n", __FUNCTION__); + _mesa_debug(NULL, "%s\n", __FUNCTION__); assert(tnl->installed); if (flags & FLUSH_UPDATE_CURRENT) { _tnl_copy_to_current( ctx ); if (MESA_VERBOSE & DEBUG_VFMT) - fprintf(stderr, "reinstall on update_current\n"); + _mesa_debug(NULL, "reinstall on update_current\n"); _mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt ); ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT; } diff --git a/src/mesa/tnl/t_vtx_x86.c b/src/mesa/tnl/t_vtx_x86.c index 05cad629023..4e4596a4e67 100644 --- a/src/mesa/tnl/t_vtx_x86.c +++ b/src/mesa/tnl/t_vtx_x86.c @@ -46,7 +46,7 @@ struct dynfn *tnl_makeX86Vertex2f( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (RADEON_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); switch (tnl->vertex_size) { default: { @@ -104,7 +104,7 @@ struct dynfn *tnl_makeX86Vertex3f( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (RADEON_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); switch (tnl->vertex_size) { case 4: { @@ -232,7 +232,7 @@ struct dynfn *tnl_makeX86Vertex3fv( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); switch (tnl->vertex_size) { case 6: { @@ -391,7 +391,7 @@ struct dynfn *tnl_makeX86Attr4fv( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); insert_at_head( &tnl->dfn_cache.Normal3fv, dfn ); dfn->key = key; @@ -419,7 +419,7 @@ struct dynfn *tnl_makeX86Attr4f( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); insert_at_head( &tnl->dfn_cache.Normal3f, dfn ); dfn->key = key; @@ -447,7 +447,7 @@ struct dynfn *tnl_makeX86Attr3fv( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); insert_at_head( &tnl->dfn_cache.Normal3fv, dfn ); dfn->key = key; @@ -473,7 +473,7 @@ struct dynfn *tnl_makeX86Attr3f( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); insert_at_head( &tnl->dfn_cache.Normal3f, dfn ); dfn->key = key; @@ -490,7 +490,7 @@ struct dynfn *tnl_makeX86Attr4ubv( TNLcontext *tnl, int key ) dfn->key = key; if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); if (key & TNL_CP_VC_FRMT_PKCOLOR) { static char temp[] = { @@ -547,7 +547,7 @@ struct dynfn *tnl_makeX86Attr4ubv( TNLcontext *tnl, int key ) struct dynfn *tnl_makeX86Attr4ub( TNLcontext *tnl, int key ) { if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); if (key & TNL_CP_VC_FRMT_PKCOLOR) { /* XXX push/pop */ @@ -598,7 +598,7 @@ struct dynfn *tnl_makeX86Attr2fv( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn ); dfn->key = key; @@ -622,7 +622,7 @@ struct dynfn *tnl_makeX86Attr2f( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn ); dfn->key = key; @@ -646,7 +646,7 @@ struct dynfn *tnl_makeX86Attr1fv( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); insert_at_head( &tnl->dfn_cache.TexCoord2fv, dfn ); dfn->key = key; @@ -668,7 +668,7 @@ struct dynfn *tnl_makeX86Attr1f( TNLcontext *tnl, int key ) struct dynfn *dfn = MALLOC_STRUCT( dynfn ); if (TNL_DEBUG & DEBUG_CODEGEN) - fprintf(stderr, "%s 0x%08x\n", __FUNCTION__, key ); + _mesa_debug(NULL, "%s 0x%08x\n", __FUNCTION__, key ); insert_at_head( &tnl->dfn_cache.TexCoord2f, dfn ); dfn->key = key; diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index 30d70d233c4..bcffb6a01be 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -1,4 +1,4 @@ -/* $Id: common_x86.c,v 1.17 2002/04/09 14:58:03 keithw Exp $ */ +/* $Id: common_x86.c,v 1.18 2002/06/29 19:48:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -225,6 +225,7 @@ static void check_os_sse_support( void ) void _mesa_init_all_x86_transform_asm( void ) { + (void) message; /* silence warning */ #ifdef USE_X86_ASM _mesa_x86_cpu_features = _mesa_identify_x86_cpu_features(); |