summaryrefslogtreecommitdiff
path: root/src/mesa/main/imports.c
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-07-15 13:29:58 +0100
committerKeith Whitwell <keithw@vmware.com>2009-07-15 13:31:51 +0100
commitfdeb77899052302053459b8a840a747346e30468 (patch)
tree333a25e0f5a8376041e96fc96a19d82121b52bdd /src/mesa/main/imports.c
parent59de430de70c38a2fbe30208190f725a2901613c (diff)
mesa: recognize and eliminate repeated error messages
Diffstat (limited to 'src/mesa/main/imports.c')
-rw-r--r--src/mesa/main/imports.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 3916c62eda..1722579e82 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -1021,6 +1021,22 @@ output_if_debug(const char *prefixString, const char *outputString,
}
}
+static const char *error_string( GLenum error );
+
+static void flush_delayed_errors( GLcontext *ctx )
+{
+ char s2[MAXSTRING];
+
+ if (ctx->ErrorDebugCount) {
+ _mesa_snprintf(s2, MAXSTRING, "%d similar %s errors",
+ ctx->ErrorDebugCount,
+ error_string(ctx->ErrorValue));
+
+ output_if_debug("Mesa: ", s2, GL_TRUE);
+
+ ctx->ErrorDebugCount = 0;
+ }
+}
/**
* Report a warning (a recoverable error condition) to stderr if
@@ -1034,10 +1050,12 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... )
{
char str[MAXSTRING];
va_list args;
- (void) ctx;
va_start( args, fmtString );
(void) vsnprintf( str, MAXSTRING, fmtString, args );
va_end( args );
+
+ if (ctx)
+ flush_delayed_errors( ctx );
output_if_debug("Mesa warning", str, GL_TRUE);
}
@@ -1126,16 +1144,26 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
#endif
}
- if (debug) {
- {
+ if (debug) {
+ if (ctx->ErrorValue == error &&
+ ctx->ErrorDebugFmtString == fmtString) {
+ ctx->ErrorDebugCount++;
+ }
+ else {
char s[MAXSTRING], s2[MAXSTRING];
va_list args;
+
+ flush_delayed_errors( ctx );
+
va_start(args, fmtString);
vsnprintf(s, MAXSTRING, fmtString, args);
va_end(args);
_mesa_snprintf(s2, MAXSTRING, "%s in %s", error_string(error), s);
output_if_debug("Mesa: User error", s2, GL_TRUE);
+
+ ctx->ErrorDebugFmtString = fmtString;
+ ctx->ErrorDebugCount = 0;
}
}