From 0d9bba6e43ab45c8eb758b4e29f4ed085a9398c9 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Sun, 5 Aug 2012 09:57:01 -0700 Subject: glsl: Make use of new _mesa_glsl_parse_state::check_version() function. Previous to this patch, we were not very consistent about the errors we generate when a shader tried to use a feature that is prohibited in the current GLSL version. Some error messages failed to mention the GLSL version currently in use (or did so inaccurately), and some error messages failed to mention the first GLSL version in which the given feature is allowed. This patch reworks all of the error checks to use the check_version() function, which produces error messages in a standard form (approximately "$FEATURE forbidden in $CURRENT_GLSL_VERSION ($REQUIRED_GLSL_VERSION required)."). Reviewed-by: Ian Romanick Reviewed-by: Kenneth Graunke Acked-by: Carl Worth --- src/glsl/glsl_parser_extras.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/glsl/glsl_parser_extras.h') diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 597b49e..17f63c0 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -125,6 +125,17 @@ struct _mesa_glsl_parse_state { unsigned required_glsl_es_version, YYLTYPE *locp, const char *fmt, ...) PRINTFLIKE(5, 6); + bool check_precision_qualifiers_allowed(YYLTYPE *locp) + { + return check_version(130, 100, locp, + "precision qualifiers are forbidden"); + } + + bool check_bitwise_operations_allowed(YYLTYPE *locp) + { + return check_version(130, 0, locp, "bit-wise operations are forbidden"); + } + struct gl_context *const ctx; void *scanner; exec_list translation_unit; -- cgit v1.1