summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-07-14 16:28:08 +0100
committerKeith Whitwell <[email protected]>2009-07-15 13:31:51 +0100
commit59de430de70c38a2fbe30208190f725a2901613c (patch)
tree5b88d4bc07e41fd8366a5bfaaa0d3251ec9abde8 /src/mesa/main
parentdf5f7a676182dc9d1d8c9c995a009b49bac971e8 (diff)
mesa: split out errorstring switch from _mesa_error
Move a chunk of code out of _mesa_error()
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/imports.c62
1 files changed, 26 insertions, 36 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index c35dcf5bd24..3916c62eda3 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -1065,6 +1065,31 @@ _mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
fprintf(stderr, "Please report at bugzilla.freedesktop.org\n");
}
+static const char *error_string( GLenum error )
+{
+ switch (error) {
+ case GL_NO_ERROR:
+ return "GL_NO_ERROR";
+ case GL_INVALID_VALUE:
+ return "GL_INVALID_VALUE";
+ case GL_INVALID_ENUM:
+ return "GL_INVALID_ENUM";
+ case GL_INVALID_OPERATION:
+ return "GL_INVALID_OPERATION";
+ case GL_STACK_OVERFLOW:
+ return "GL_STACK_OVERFLOW";
+ case GL_STACK_UNDERFLOW:
+ return "GL_STACK_UNDERFLOW";
+ case GL_OUT_OF_MEMORY:
+ return "GL_OUT_OF_MEMORY";
+ case GL_TABLE_TOO_LARGE:
+ return "GL_TABLE_TOO_LARGE";
+ case GL_INVALID_FRAMEBUFFER_OPERATION_EXT:
+ return "GL_INVALID_FRAMEBUFFER_OPERATION";
+ default:
+ return "unknown";
+ }
+}
/**
* Record an OpenGL state error. These usually occur when the user
@@ -1102,41 +1127,6 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
}
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;
- case GL_INVALID_FRAMEBUFFER_OPERATION_EXT:
- errstr = "GL_INVALID_FRAMEBUFFER_OPERATION";
- break;
- default:
- errstr = "unknown";
- break;
- }
-
{
char s[MAXSTRING], s2[MAXSTRING];
va_list args;
@@ -1144,7 +1134,7 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
vsnprintf(s, MAXSTRING, fmtString, args);
va_end(args);
- _mesa_snprintf(s2, MAXSTRING, "%s in %s", errstr, s);
+ _mesa_snprintf(s2, MAXSTRING, "%s in %s", error_string(error), s);
output_if_debug("Mesa: User error", s2, GL_TRUE);
}
}