summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-02-22 15:57:25 -0800
committerEric Anholt <eric@anholt.net>2013-03-05 14:25:00 -0800
commitc72cf538173329f639c2b64ef091dbd4a71e0bf6 (patch)
tree193a70e5dac656ee98100e85bd738e8c2d7836f2
parentf0a191ca0ff197f0f0c00be0b4b94169ec81f71f (diff)
mesa: Report ARB_debug_output for both shader errors and warnings.
This ends up reusing the dynamic ID support, so a silly enum gets to go away. We don't assign good IDs to different messages yet, but at least that's tractable now. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
-rw-r--r--src/glsl/glsl_parser_extras.cpp15
-rw-r--r--src/glsl/standalone_scaffolding.cpp2
-rw-r--r--src/glsl/standalone_scaffolding.h2
-rw-r--r--src/mesa/main/errors.c6
-rw-r--r--src/mesa/main/errors.h3
5 files changed, 15 insertions, 13 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 9d7de3381fd..56082f7615b 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -308,9 +308,10 @@ _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target)
'id' is the implementation-defined ID of the given message. */
static void
_mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
- GLenum type, GLuint id, const char *fmt, va_list ap)
+ GLenum type, const char *fmt, va_list ap)
{
- bool error = (type == GL_DEBUG_TYPE_ERROR_ARB);
+ bool error = (type == MESA_DEBUG_TYPE_ERROR);
+ GLuint msg_id = 0;
assert(state->info_log != NULL);
@@ -326,9 +327,9 @@ _mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
const char *const msg = &state->info_log[msg_offset];
struct gl_context *ctx = state->ctx;
+
/* Report the error via GL_ARB_debug_output. */
- if (error)
- _mesa_shader_debug(ctx, type, id, msg, strlen(msg));
+ _mesa_shader_debug(ctx, type, &msg_id, msg, strlen(msg));
ralloc_strcat(&state->info_log, "\n");
}
@@ -338,12 +339,11 @@ _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state,
const char *fmt, ...)
{
va_list ap;
- GLenum type = GL_DEBUG_TYPE_ERROR_ARB;
state->error = true;
va_start(ap, fmt);
- _mesa_glsl_msg(locp, state, type, SHADER_ERROR_UNKNOWN, fmt, ap);
+ _mesa_glsl_msg(locp, state, MESA_DEBUG_TYPE_ERROR, fmt, ap);
va_end(ap);
}
@@ -353,10 +353,9 @@ _mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
const char *fmt, ...)
{
va_list ap;
- GLenum type = GL_DEBUG_TYPE_OTHER_ARB;
va_start(ap, fmt);
- _mesa_glsl_msg(locp, state, type, 0, fmt, ap);
+ _mesa_glsl_msg(locp, state, MESA_DEBUG_TYPE_OTHER, fmt, ap);
va_end(ap);
}
diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp
index 8c0091e842f..b5ef768bd77 100644
--- a/src/glsl/standalone_scaffolding.cpp
+++ b/src/glsl/standalone_scaffolding.cpp
@@ -60,7 +60,7 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
}
void
-_mesa_shader_debug(struct gl_context *, GLenum, GLuint,
+_mesa_shader_debug(struct gl_context *, GLenum, GLuint *id,
const char *, int)
{
}
diff --git a/src/glsl/standalone_scaffolding.h b/src/glsl/standalone_scaffolding.h
index 096b2f114c7..0a2cde8a348 100644
--- a/src/glsl/standalone_scaffolding.h
+++ b/src/glsl/standalone_scaffolding.h
@@ -44,7 +44,7 @@ extern "C" struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
extern "C" void
-_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint id,
+_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
const char *msg, int len);
/**
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 3c720bc5500..9dcf4ebee9e 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -1009,12 +1009,14 @@ _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... )
* \param len The length of 'msg'. If negative, 'msg' must be null-terminated.
*/
void
-_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint id,
+_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint *id,
const char *msg, int len )
{
enum mesa_debug_source source = MESA_DEBUG_SOURCE_SHADER_COMPILER;
enum mesa_debug_severity severity = MESA_DEBUG_SEVERITY_HIGH;
+ debug_get_id(id);
+
if (len < 0)
len = strlen(msg);
@@ -1022,7 +1024,7 @@ _mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint id,
if (len >= MAX_DEBUG_MESSAGE_LENGTH)
len = MAX_DEBUG_MESSAGE_LENGTH - 1;
- _mesa_log_msg(ctx, source, type, id, severity, len, msg);
+ _mesa_log_msg(ctx, source, type, *id, severity, len, msg);
}
/*@}*/
diff --git a/src/mesa/main/errors.h b/src/mesa/main/errors.h
index aa69931a815..7d8be5aca76 100644
--- a/src/mesa/main/errors.h
+++ b/src/mesa/main/errors.h
@@ -74,7 +74,8 @@ _mesa_gl_debug(struct gl_context *ctx,
const char *fmtString, ...) PRINTFLIKE(5, 6);
extern void
-_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint id, const char *msg, int len );
+_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
+ const char *msg, int len);
void GLAPIENTRY
_mesa_DebugMessageInsertARB(GLenum source, GLenum type, GLuint id,