[Mesa-dev] [PATCH 2/9] mesa: add _mesa_shader_error()

nobled nobled at dreamwidth.org
Fri Apr 13 08:51:42 PDT 2012


---
 src/mesa/main/errors.c |   19 +++++++++++++++++++
 src/mesa/main/errors.h |    4 ++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index fcf873f..f03ebd3 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -1062,4 +1062,23 @@ _mesa_debug( const struct gl_context *ctx,
const char *fmtString, ... )
    (void) fmtString;
 }

+
+void
+_mesa_shader_error( struct gl_context *ctx, gl_shader_error err,
+                    const char *msg, int len)
+{
+ const GLenum source = GL_DEBUG_SOURCE_SHADER_COMPILER_ARB,
+              type = GL_DEBUG_TYPE_ERROR_ARB,
+              severity = GL_DEBUG_SEVERITY_HIGH_ARB;
+
+   if (len < 0)
+      len = strlen(msg);
+
+   /* Truncate the message if necessary. */
+   if (len >= MAX_DEBUG_MESSAGE_LENGTH)
+      len = MAX_DEBUG_MESSAGE_LENGTH - 1;
+
+   _mesa_log_msg(ctx, source, type, err, severity, len, msg);
+}
+
 /*@}*/
diff --git a/src/mesa/main/errors.h b/src/mesa/main/errors.h
index ed1c6fc..93cccaa 100644
--- a/src/mesa/main/errors.h
+++ b/src/mesa/main/errors.h
@@ -38,6 +38,7 @@

 #include "compiler.h"
 #include "glheader.h"
+#include "mtypes.h"


 #ifdef __cplusplus
@@ -68,6 +69,9 @@ _mesa_error( struct gl_context *ctx, GLenum error,
const char *fmtString, ... )
 extern void
 _mesa_debug( const struct gl_context *ctx, const char *fmtString, ...
) PRINTFLIKE(2, 3);

+extern void
+_mesa_shader_error( struct gl_context *ctx, gl_shader_error err,
const char *msg, int len);
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.7.4.1


More information about the mesa-dev mailing list