[Mesa-dev] [PATCH 05/26] glsl: Add GLSL version query functions.

Kenneth Graunke kenneth at whitecape.org
Fri Nov 30 15:12:45 PST 2012


On 11/30/2012 10:07 AM, Ian Romanick wrote:
> From: Paul Berry <stereotype441 at gmail.com>
>
> With the advent of GLSL 3.00 ES, the version checks we perform in the
> GLSL compiler (to determine which language features are present) will
> become more complicated.  To reduce the complexity, this patch adds
> functions check_version() and is_version() to _mesa_glsl_parse_state.
> These functions take two version numbers: a desktop GLSL version and a
> GLSL ES version, and return a boolean indicating whether the GLSL
> version being compiled is at least the required version.  So, for
> example, is_version(130, 300) returns true if the GLSL version being
> compiled is at least desktop GLSL 1.30 or GLSL 3.00.
>
> The check_version() function additionally produces an error message if
> the version check fails, informing the user of which GLSL version(s)
> support the given feature.
>
> [v2, idr]: Add PRINTFLIKE annotation to the new method.  The numbering of th
> parameters is correct because GCC is silly.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>   src/glsl/glsl_parser_extras.cpp | 51 +++++++++++++++++++++++++++++++++++++++++
>   src/glsl/glsl_parser_extras.h   | 45 ++++++++++++++++++++++++++++--------
>   2 files changed, 86 insertions(+), 10 deletions(-)
>
> diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
> index 3e19203..14589b0 100644
> --- a/src/glsl/glsl_parser_extras.cpp
> +++ b/src/glsl/glsl_parser_extras.cpp
[snip]
> @@ -90,6 +100,31 @@ struct _mesa_glsl_parse_state {
>                                            this->language_version);
>      }
>
> +   /**
> +    * Determine whether the current GLSL version is sufficiently high to
> +    * support a certain feature.
> +    *
> +    * \param required_glsl_version is the desktop GLSL version that is
> +    * required to support the feature, or 0 if no version of desktop GLSL
> +    * supports the feature.
> +    *
> +    * \param required_glsl_es_version is the GLSL ES version that is required
> +    * to support the feature, or 0 if no version of desktop GLSL suports the

Comment should be: ..."or 0 if no version of GLSL ES supports the"


More information about the mesa-dev mailing list