[Mesa-dev] [PATCH 08/28] glsl: parse component layout qualifier

Anuj Phogat anuj.phogat at gmail.com
Wed Jan 6 11:48:16 PST 2016


On Mon, Dec 28, 2015 at 9:00 PM, Timothy Arceri
<timothy.arceri at collabora.com> wrote:
> ---
>  src/glsl/ast.h          | 14 ++++++++++++++
>  src/glsl/ast_type.cpp   |  3 +++
>  src/glsl/glsl_parser.yy | 11 +++++++++++
>  3 files changed, 28 insertions(+)
>
> diff --git a/src/glsl/ast.h b/src/glsl/ast.h
> index f8ab0b7..e22deed 100644
> --- a/src/glsl/ast.h
> +++ b/src/glsl/ast.h
> @@ -490,6 +490,12 @@ struct ast_type_qualifier {
>           */
>          unsigned explicit_index:1;
>
> +        /**
> +         * Flag set if GL_ARB_enhanced_layouts "component" layout
> +         * qualifier is used.
> +         */
> +        unsigned explicit_component:1;
> +
>           /**
>            * Flag set if GL_ARB_shading_language_420pack "binding" layout
>            * qualifier is used.
> @@ -595,6 +601,14 @@ struct ast_type_qualifier {
>      */
>     ast_expression *index;
>
> +   /**
> +    * Component specified via GL_ARB_enhaced_layouts
> +    *
> +    * \note
> +    * This field is only valid if \c explicit_component is set.
> +    */
> +   ast_expression *component;
> +
>     /** Maximum output vertices in GLSL 1.50 geometry shaders. */
>     ast_layout_expression *max_vertices;
>
> diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
> index 8643b7b..7330a34 100644
> --- a/src/glsl/ast_type.cpp
> +++ b/src/glsl/ast_type.cpp
> @@ -273,6 +273,9 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
>     if (q.flags.q.explicit_index)
>        this->index = q.index;
>
> +  if (q.flags.q.explicit_component)
> +      this->component = q.component;
> +
>     if (q.flags.q.explicit_binding)
>        this->binding = q.binding;
>
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index 51796a6..6b634f2 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -1476,6 +1476,17 @@ layout_qualifier_id:
>           $$.location = $3;
>        }
>
> +      if (match_layout_qualifier("component", $1, state) == 0) {
> +         if (!state->has_enhanced_layouts()) {
> +            _mesa_glsl_error(& @1, state,
> +                             "component qualifier requires "
> +                             "GLSL 4.40 or ARB_enhanced_layouts");
> +         } else {
> +            $$.flags.q.explicit_component = 1;
> +            $$.component = $3;
> +         }
> +      }
> +
>        if (match_layout_qualifier("index", $1, state) == 0) {
>           if (state->es_shader && !state->EXT_blend_func_extended_enable) {
>              _mesa_glsl_error(& @3, state, "index layout qualifier requires EXT_blend_func_extended");
> --
> 2.4.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list