#include "imports.h"
#include "context.h"
#include "debug_output.h"
-#include "dispatch.h"
-#include "hash.h"
-#include "mtypes.h"
-#include "version.h"
-#include "util/hash_table.h"
-#include "util/simple_list.h"
static FILE *LogFile = NULL;
char s[MAX_DEBUG_MESSAGE_LENGTH];
if (ctx->ErrorDebugCount) {
- _mesa_snprintf(s, MAX_DEBUG_MESSAGE_LENGTH, "%d similar %s errors",
+ _mesa_snprintf(s, MAX_DEBUG_MESSAGE_LENGTH, "%d similar %s errors",
ctx->ErrorDebugCount,
_mesa_enum_to_string(ctx->ErrorValue));
{
char str[MAX_DEBUG_MESSAGE_LENGTH];
va_list args;
- va_start( args, fmtString );
+ va_start( args, fmtString );
(void) _mesa_vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args );
va_end( args );
-
+
if (ctx)
flush_delayed_errors( ctx );
if (numCalls < 50) {
numCalls++;
- va_start( args, fmtString );
+ va_start( args, fmtString );
_mesa_vsnprintf( str, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args );
va_end( args );
- fprintf(stderr, "Mesa %s implementation error: %s\n",
- PACKAGE_VERSION, str);
+ fprintf(stderr, "Mesa " PACKAGE_VERSION " implementation error: %s\n",
+ str);
fprintf(stderr, "Please report at " PACKAGE_BUGREPORT "\n");
}
}
void
-_mesa_gl_vdebug(struct gl_context *ctx,
- GLuint *id,
- enum mesa_debug_source source,
- enum mesa_debug_type type,
- enum mesa_debug_severity severity,
- const char *fmtString,
- va_list args)
+_mesa_gl_vdebugf(struct gl_context *ctx,
+ GLuint *id,
+ enum mesa_debug_source source,
+ enum mesa_debug_type type,
+ enum mesa_debug_severity severity,
+ const char *fmtString,
+ va_list args)
{
char s[MAX_DEBUG_MESSAGE_LENGTH];
int len;
_mesa_debug_get_id(id);
len = _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
+ if (len >= MAX_DEBUG_MESSAGE_LENGTH)
+ /* message was truncated */
+ len = MAX_DEBUG_MESSAGE_LENGTH - 1;
_mesa_log_msg(ctx, source, type, *id, severity, len, s);
}
void
-_mesa_gl_debug(struct gl_context *ctx,
- GLuint *id,
- enum mesa_debug_source source,
- enum mesa_debug_type type,
- enum mesa_debug_severity severity,
- const char *fmtString, ...)
+_mesa_gl_debugf(struct gl_context *ctx,
+ GLuint *id,
+ enum mesa_debug_source source,
+ enum mesa_debug_type type,
+ enum mesa_debug_severity severity,
+ const char *fmtString, ...)
{
va_list args;
va_start(args, fmtString);
- _mesa_gl_vdebug(ctx, id, source, type, severity, fmtString, args);
+ _mesa_gl_vdebugf(ctx, id, source, type, severity, fmtString, args);
va_end(args);
}
* If debugging is enabled (either at compile-time via the DEBUG macro, or
* run-time via the MESA_DEBUG environment variable), report the error with
* _mesa_debug().
- *
+ *
* \param ctx the GL context.
* \param error the error value.
* \param fmtString printf() style format string, followed by optional args
do_output = should_output(ctx, error, fmtString);
- mtx_lock(&ctx->DebugMutex);
+ simple_mtx_lock(&ctx->DebugMutex);
if (ctx->Debug) {
do_log = _mesa_debug_is_message_enabled(ctx->Debug,
MESA_DEBUG_SOURCE_API,
else {
do_log = GL_FALSE;
}
- mtx_unlock(&ctx->DebugMutex);
+ simple_mtx_unlock(&ctx->DebugMutex);
if (do_output || do_log) {
char s[MAX_DEBUG_MESSAGE_LENGTH], s2[MAX_DEBUG_MESSAGE_LENGTH];
}
/* Set the GL context error state for glGetError. */
- _mesa_record_error(ctx, error);
+ if (ctx->ErrorValue == GL_NO_ERROR)
+ ctx->ErrorValue = error;
}
void
/**
* Report debug information. Print error message to stderr via fprintf().
* No-op if DEBUG mode not enabled.
- *
+ *
* \param ctx GL context.
* \param fmtString printf()-style format string, followed by optional args.
*/