Instead of mstdio.[ch], use imports.[ch] to isolate these functions.
-/* $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
* 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.
*/
/***** 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;
+ }
}
#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
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;
}
const char *
_glapi_get_version(void)
{
- return "20010116"; /* YYYYMMDD */
+ return "20020628"; /* YYYYMMDD */
}
-/* $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
struct _glapi_table;
+typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...);
+
extern void *_glapi_Context;
extern void
_glapi_noop_enable_warnings(GLboolean enable);
+extern void
+_glapi_set_warning_func(_glapi_warning_func func);
extern void
_glapi_check_multithread(void);
-/* $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
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;
}
-/* $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
#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;
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;
}
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
}
/*
- * 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;
}
-/*
- * 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 )
{
-/* $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
#include "glapi.h"
#include "mtypes.h"
+#include "imports.h"
/*
*/
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
-/* $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
*/
#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,
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,
-/* $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
#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) \
-/* $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
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;
-/* $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
#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; \
}
}
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;
}
#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; \
}
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;
}
}
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;
}
}
-/* $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
#else
#include "glheader.h"
#include "enums.h"
+#include "imports.h"
#include "mem.h"
#endif
}
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;
}
}
-/* $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
#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; \
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
-/* $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
#include "glheader.h"
#include "glthread.h"
#include "hash.h"
+#include "context.h"
#include "mem.h"
#endif
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;
}
}
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;
-/* $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
/*
- * 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"
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)
{
return atoi(str);
}
-static int CAPI
+
+int CAPI
_mesa_sprintf(__GLcontext *gc, char *str, const char *fmt, ...)
{
int r;
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, ...)
{
return r;
}
+
/* XXX this really is driver-specific and can't be here */
static __GLdrawablePrivate *
_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)
{
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;
-/* $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
#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);
-/* $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
#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; \
#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; \
-/* $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
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;
}
}
-/* $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
*/
-#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");
const GLchan *data = (const GLchan *) img->Data;
if (!data) {
- printf("No texture data\n");
+ _mesa_printf(ctx, "No texture data\n");
return;
}
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
}
/* 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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
* 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;
}
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;
}
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;
}
/* 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;
}
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;
}
}
/* 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;
}
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;
}
}
-/* $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
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)
-/* $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
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) {
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;
}
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;
maxLevels = 1;
break;
default:
- _mesa_problem(ctx, "bad target in _mesa_GetTexLevelParameter");
+ _mesa_printf(ctx, "bad target in _mesa_GetTexLevelParameter (0x%x)", target);
return;
}
-/* $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
*/
/*
- 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);
*/
-/* $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
* 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)
convert->xoffset) * DST_TEXEL_BYTES);
#if DEBUG_TEXUTIL
- fprintf( stderr, __FUNCTION__ "\n" );
+ _mesa_debug( NULL, __FUNCTION__ "\n" );
#endif
#ifdef CONVERT_DIRECT
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
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++ ) {
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++ ) {
GLint row, col;
#if DEBUG_TEXUTIL
- fprintf( stderr, __FUNCTION__ "\n" );
+ _mesa_debug( NULL, __FUNCTION__ "\n" );
#endif
if (convert->width & (DST_TEXELS_PER_DWORD - 1)) {
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)) {
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++ ) {
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++ ) {
-/* $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
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; \
-/* $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
"_mesa_clip_tab",
"_mesa_clip_np_tab"
};
+#ifdef RUN_DEBUG_BENCHMARK
static char *cstrings[2] = {
"clip, perspective divide",
"clip, no divide"
};
+#endif
/* =============================================================
}
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;
}
}
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;
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
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
}
-/* $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
* 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];
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;
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;
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
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
-/* $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
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__)
-/* $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
* 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;
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;
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
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
}
-/* $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
#include <math.h>
#include "glheader.h"
+#include "imports.h"
#include "macros.h"
#include "mem.h"
#include "mmath.h"
{
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");
}
}
}
+#if 0
+/* broken */
static GLboolean invert_matrix_perspective( GLmatrix *mat )
{
const GLfloat *in = mat->m;
return GL_TRUE;
}
+#endif
typedef GLboolean (*inv_mat_func)( GLmatrix *mat );
-/* $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
#include "glheader.h"
+#include "imports.h"
#include "macros.h"
#include "mem.h"
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);
}
}
}
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]);
}
}
-/* $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
/* debug only */
+#if 0
static void
printSetupFlags(const GLcontext *ctx, char *msg, GLuint flags )
{
(flags & FOG) ? "fog, " : "",
(flags & POINT) ? "point, " : "");
}
-
+#endif
void
_swsetup_choose_rastersetup_func(GLcontext *ctx)
-/* $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
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 );
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.
*/
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.
*/
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.
*/
-/* $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
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); */
-/* $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
*/
#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,
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);
{
_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",
}
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],
}
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]);
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],
}
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");
}
}
-/* $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
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], */
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)
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); */
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])
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;
}
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], */
GLuint fixup;
GLuint start = IM->Start;
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
+/* _mesa_debug(ctx, "%s\n", __FUNCTION__); */
IM->Evaluated = 0;
IM->CopyOrFlag = IM->OrFlag;
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)
-/* $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
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);
-/* $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
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); */
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; \
} \
\
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;
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) {
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++) {
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] )
{
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
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:
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 );
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;
}
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 );
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)
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" );
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 );
}
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" );
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;
}
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: {
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: {
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: {
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;
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;
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;
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;
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[] = {
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 */
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;
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;
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;
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;
-/* $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
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();