glsl: Allow memory qualifiers on shader storage buffer blocks
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Fri, 8 May 2015 07:41:58 +0000 (09:41 +0200)
committerSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Fri, 25 Sep 2015 06:39:23 +0000 (08:39 +0200)
v2:
  - Memory qualifiers on shader storage buffer objects do not come in the form
    of layout qualifiers, they are block-level qualifiers.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
src/glsl/glsl_parser.yy

index 4cb018a58625695002903d0cb9ac7178bd4c6aa3..f0abeb03215c3ffd02ebd1cdc767e759a0e78333 100644 (file)
@@ -2628,6 +2628,20 @@ interface_block:
       }
       $$ = block;
    }
+   | memory_qualifier interface_block
+   {
+      ast_interface_block *block = (ast_interface_block *)$2;
+
+      if (!block->layout.flags.q.buffer) {
+            _mesa_glsl_error(& @1, state,
+                             "memory qualifiers can only be used in the "
+                             "declaration of shader storage blocks");
+      }
+      if (!block->layout.merge_qualifier(& @1, state, $1)) {
+         YYERROR;
+      }
+      $$ = block;
+   }
    ;
 
 basic_interface_block: