[Mesa-dev] [PATCH 5/9] glsl: allow multiple layout-qualifier in single declaration if enhanced layouts

Timothy Arceri timothy.arceri at collabora.com
Mon Oct 24 02:19:42 UTC 2016


Again I think this is just because the spec is written against the 4.3
spec. I don't think this extension is intended to enable this feature.


On Sat, 2016-10-22 at 23:09 +0300, Andres Gomez wrote:
> From the ARB_enhanced_layouts spec:
> 
>     "Additions to Chapter 4 "Variables and Types" of the OpenGL
> Shading Language
> 
>         Section 4.4 "Layout Qualifiers"
> 
>         The existing last paragraph already says:
> 
>             "More than one layout qualifier may appear in a single
> declaration. If
>             the same layout-qualifier-name occurs in multiple layout
> qualifiers
>             for the same declaration, the last one overrides the
> former ones."
> 
>         Expand it to say:
> 
>             "More than one layout qualifier may appear in a single
> declaration.
>             Additionally, the same layout-qualifier-name can occur
> multiple times
>             within a layout qualifier or across multiple layout
> qualifiers in the
>             same declaration. When the same layout-qualifier-name
> occurs
>             multiple times, in a single declaration, the last
> occurrence overrides
>             the former occurrence(s).  Further, if such a layout-
> qualifier-name
>             will effect subsequent declarations or other observable
> behavior, it
>             is only the last occurrence that will have any effect,
> behaving as if
>             the earlier occurrence(s) within the declaration are not
> present.
>             This is also true for overriding layout-qualifier-names,
> where one
>             overrides the other (e.g., row_major vs. column_major);
> only the last
>             occurrence has any effect.""
> 
> Signed-off-by: Andres Gomez <agomez at igalia.com>
> ---
>  src/compiler/glsl/ast_type.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/compiler/glsl/ast_type.cpp
> b/src/compiler/glsl/ast_type.cpp
> index 48ee27e..02f96ea 100644
> --- a/src/compiler/glsl/ast_type.cpp
> +++ b/src/compiler/glsl/ast_type.cpp
> @@ -201,7 +201,8 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
>        return false;
>     }
>  
> -   if (is_multiple_layouts_merge && !state->has_420pack_or_es31()) {
> +   if (is_multiple_layouts_merge
> +       && !state->has_420pack_or_es31() && !state-
> >has_enhanced_layouts()) {
>        _mesa_glsl_error(loc, state,
>                         "duplicate layout(...) qualifiers");
>        return false;


More information about the mesa-dev mailing list