glsl: allow duplicate layout-qualifier-names
authorTimothy Arceri <timothy.arceri@collabora.com>
Fri, 15 Jan 2016 00:01:25 +0000 (11:01 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Tue, 19 Jan 2016 21:06:29 +0000 (08:06 +1100)
This is added by ARB_enhanced_layouts although it doesn't fit
into any of the six main changes so we enable this independently.

From the ARB_enhanced_layouts spec:

   "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"

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/glsl/ast_type.cpp

index 1f675b28ae8e72aae70f81450123cb58b6afa102..4e750161b480839f754b6ffe024f14a91a2a959d 100644 (file)
@@ -157,7 +157,8 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
       allowed_duplicates_mask.flags.i |=
          stream_layout_mask.flags.i;
 
-   if ((this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) {
+   if (!state->has_enhanced_layouts() &&
+       (this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) {
       _mesa_glsl_error(loc, state,
                       "duplicate layout qualifiers used");
       return false;