From dd93035a4df9daaad8cb47f2cc412d5dd3a9e3c8 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 5 Oct 2010 16:14:18 -0700 Subject: [PATCH] glsl: Refactor 'layout' grammar to match GLSL 1.60 spec grammar --- src/glsl/glsl_parser.ypp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp index 0df1e480ce3..9d311093ba6 100644 --- a/src/glsl/glsl_parser.ypp +++ b/src/glsl/glsl_parser.ypp @@ -139,7 +139,7 @@ %type type_qualifier %type storage_qualifier %type interpolation_qualifier -%type opt_layout_qualifier layout_qualifier +%type layout_qualifier %type layout_qualifier_id_list layout_qualifier_id %type type_specifier %type type_specifier_no_prec @@ -959,11 +959,6 @@ fully_specified_type: } ; -opt_layout_qualifier: - { $$.i = 0; } - | layout_qualifier - ; - layout_qualifier: LAYOUT_TOK '(' layout_qualifier_id_list ')' { @@ -1025,23 +1020,39 @@ parameter_type_qualifier: type_qualifier: storage_qualifier - | interpolation_qualifier type_qualifier + | layout_qualifier + | layout_qualifier storage_qualifier + { + $$.i = $1.i | $2.i; + } + | interpolation_qualifier + | interpolation_qualifier storage_qualifier { $$.i = $1.i | $2.i; } - | INVARIANT type_qualifier + | INVARIANT storage_qualifier { $$ = $2; $$.q.invariant = 1; } + | INVARIANT interpolation_qualifier storage_qualifier + { + $$.i = $2.i | $3.i; + $$.q.invariant = 1; + } + | INVARIANT + { + $$.i = 0; + $$.q.invariant = 1; + } ; storage_qualifier: CONST_TOK { $$.i = 0; $$.q.constant = 1; } | ATTRIBUTE { $$.i = 0; $$.q.attribute = 1; } - | opt_layout_qualifier VARYING { $$.i = $1.i; $$.q.varying = 1; } + | VARYING { $$.i = 0; $$.q.varying = 1; } | CENTROID VARYING { $$.i = 0; $$.q.centroid = 1; $$.q.varying = 1; } - | opt_layout_qualifier IN_TOK { $$.i = 0; $$.q.in = 1; } + | IN_TOK { $$.i = 0; $$.q.in = 1; } | OUT_TOK { $$.i = 0; $$.q.out = 1; } | CENTROID IN_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.in = 1; } | CENTROID OUT_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.out = 1; } -- 2.30.2