[Mesa-dev] [PATCH 2/4] glsl: parse align layout qualifier

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue Feb 9 14:08:18 UTC 2016


Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

On Tue, 2016-01-12 at 20:34 +1100, Timothy Arceri wrote:
> ---
>  src/glsl/ast.h          | 11 +++++++++++
>  src/glsl/ast_type.cpp   |  4 ++++
>  src/glsl/glsl_parser.yy | 11 +++++++++++
>  3 files changed, 26 insertions(+)
> 
> diff --git a/src/glsl/ast.h b/src/glsl/ast.h
> index e22deed..0b6871a 100644
> --- a/src/glsl/ast.h
> +++ b/src/glsl/ast.h
> @@ -479,6 +479,12 @@ struct ast_type_qualifier {
>  	 unsigned pixel_center_integer:1;
>  	 /*@}*/
>  
> +         /**
> +          * Flag set if GL_ARB_enhanced_layouts "align" layout
> qualifier is
> +          * used.
> +          */
> +         unsigned explicit_align:1;
> +
>  	 /**
>  	  * Flag set if GL_ARB_explicit_attrib_location "location"
> layout
>  	  * qualifier is used.
> @@ -583,6 +589,11 @@ struct ast_type_qualifier {
>     /** Precision of the type (highp/medium/lowp). */
>     unsigned precision:2;
>  
> +   /**
> +    * Alignment specified via GL_ARB_enhanced_layouts "align" layout
> qualifier
> +    */
> +   ast_expression *align;
> +
>     /** Geometry shader invocations for GL_ARB_gpu_shader5. */
>     ast_layout_expression *invocations;
>  
> diff --git a/src/glsl/ast_type.cpp b/src/glsl/ast_type.cpp
> index 6d6f88f..f4e51b8 100644
> --- a/src/glsl/ast_type.cpp
> +++ b/src/glsl/ast_type.cpp
> @@ -73,6 +73,7 @@ ast_type_qualifier::has_layout() const
>            || this->flags.q.column_major
>            || this->flags.q.row_major
>            || this->flags.q.packed
> +          || this->flags.q.explicit_align
>            || this->flags.q.explicit_component
>            || this->flags.q.explicit_location
>            || this->flags.q.explicit_index
> @@ -268,6 +269,9 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
>  
>     this->flags.i |= q.flags.i;
>  
> +   if (q.flags.q.explicit_align)
> +      this->align = q.align;
> +
>     if (q.flags.q.explicit_location)
>        this->location = q.location;
>  
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index b2b94f4..83bebe9 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -1464,6 +1464,17 @@ layout_qualifier_id:
>                            "GLSL 4.40 or ARB_enhanced_layouts");
>        }
>  
> +      if (match_layout_qualifier("align", $1, state) == 0) {
> +         if (!state->has_enhanced_layouts()) {
> +            _mesa_glsl_error(& @1, state,
> +                             "align qualifier requires "
> +                             "GLSL 4.40 or ARB_enhanced_layouts");
> +         } else {
> +            $$.flags.q.explicit_align = 1;
> +            $$.align = $3;
> +         }
> +      }
> +
>        if (match_layout_qualifier("location", $1, state) == 0) {
>           $$.flags.q.explicit_location = 1;
>  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160209/bb151103/attachment.sig>


More information about the mesa-dev mailing list