summaryrefslogtreecommitdiffstats
path: root/src/glsl/glsl_parser_extras.cpp
diff options
context:
space:
mode:
authorDylan Noblesmith <[email protected]>2012-04-02 16:26:05 +0000
committerDylan Noblesmith <[email protected]>2012-05-02 16:12:23 +0000
commitd5a10dba6464d6cc40b3abcd6b704fb087e1056c (patch)
treecfece3d957024d8510fe9f674a5d9bfffaf604a6 /src/glsl/glsl_parser_extras.cpp
parent8c99906cf5c8825ada0699f61926864e568ca69a (diff)
glsl: report errors via GL_ARB_debug_output
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/glsl/glsl_parser_extras.cpp')
-rw-r--r--src/glsl/glsl_parser_extras.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 4f26205b616..6f1c86b43ff 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -146,12 +146,23 @@ _mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
bool error = (type == GL_DEBUG_TYPE_ERROR_ARB);
assert(state->info_log != NULL);
+
+ /* Get the offset that the new message will be written to. */
+ int msg_offset = strlen(state->info_log);
+
ralloc_asprintf_append(&state->info_log, "%u:%u(%u): %s: ",
locp->source,
locp->first_line,
locp->first_column,
error ? "error" : "warning");
ralloc_vasprintf_append(&state->info_log, fmt, ap);
+
+ 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));
+
ralloc_strcat(&state->info_log, "\n");
}