From: Ian Romanick Date: Wed, 7 Apr 2010 23:57:56 +0000 (-0700) Subject: Clean up error reporting in _mesa_glsl_process_extension X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=887a8b07deffa578b7d6540257a0c5f8c4d5d97c;p=mesa.git Clean up error reporting in _mesa_glsl_process_extension --- diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index 8beea55573a..6cd69c8b882 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -101,7 +101,6 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, extension_require, extension_warn } ext_mode; - bool error = false; if (strcmp(behavior, "warn") == 0) { ext_mode = extension_warn; @@ -118,6 +117,8 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, return false; } + bool unsupported = false; + if (strcmp(name, "all") == 0) { if ((ext_mode == extension_enable) || (ext_mode == extension_require)) { _mesa_glsl_error(name_locp, state, "Cannot %s all extensions", @@ -126,13 +127,19 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp, return false; } } else { + unsupported = true; + } + + if (unsupported) { + static const char *const fmt = "extension `%s' unsupported in %s shader"; + if (ext_mode == extension_require) { - _mesa_glsl_error(name_locp, state, "Unknown extension `%s'", - name); + _mesa_glsl_error(name_locp, state, fmt, + name, _mesa_glsl_shader_target_name(state->target)); return false; } else { - _mesa_glsl_warning(name_locp, state, "Unknown extension `%s'", - name); + _mesa_glsl_warning(name_locp, state, fmt, + name, _mesa_glsl_shader_target_name(state->target)); } }