diff options
author | Ian Romanick <[email protected]> | 2010-04-07 14:47:46 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-04-07 16:49:25 -0700 |
commit | 56b8b214107a0320c7277cd832480998057f8413 (patch) | |
tree | 73e22e2979b33263c21664e37753a1b192d17fdc /glsl_parser_extras.cpp | |
parent | e701761cc84a136c2e1b3cf341bc0edb90492278 (diff) |
Add _mesa_glsl_warning to emit warnings to the shader log
Diffstat (limited to 'glsl_parser_extras.cpp')
-rw-r--r-- | glsl_parser_extras.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index 1eac1890afe..de67e849dfa 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -71,6 +71,25 @@ _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, } +void +_mesa_glsl_warning(const YYLTYPE *locp, const _mesa_glsl_parse_state *state, + const char *fmt, ...) +{ + char buf[1024]; + int len; + va_list ap; + + len = snprintf(buf, sizeof(buf), "%u:%u(%u): warning: ", + locp->source, locp->first_line, locp->first_column); + + va_start(ap, fmt); + vsnprintf(buf + len, sizeof(buf) - len, fmt, ap); + va_end(ap); + + printf("%s\n", buf); +} + + bool _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, const char *behavior, YYLTYPE *behavior_locp, |