summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glsl_parser.yy
diff options
context:
space:
mode:
authorTimothy Arceri <timothy.arceri@collabora.com>2016-02-14 14:45:04 +1100
committerTimothy Arceri <timothy.arceri@collabora.com>2016-03-05 19:07:00 +1100
commit78d3098c05cfbf5c51cf92483d1f894a41e46e7c (patch)
tree5a5aee785842aa2491032893238d0f33261b8247 /src/compiler/glsl/glsl_parser.yy
parentd244986bf20aedf5ef6a156ec97d33f485993323 (diff)
downloadexternal_mesa3d-78d3098c05cfbf5c51cf92483d1f894a41e46e7c.zip
external_mesa3d-78d3098c05cfbf5c51cf92483d1f894a41e46e7c.tar.gz
external_mesa3d-78d3098c05cfbf5c51cf92483d1f894a41e46e7c.tar.bz2
glsl: rework parsing of blocks
Previously interface blocks were giving the global default flags of uniform blocks. This meant we could not check for invalid qualifiers on interface blocks because they always contained invalid flags. This changes parsing so that interface blocks now get an empty set of layouts. Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Diffstat (limited to 'src/compiler/glsl/glsl_parser.yy')
-rw-r--r--src/compiler/glsl/glsl_parser.yy51
1 files changed, 22 insertions, 29 deletions
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy
index 99bd0e6..9d6ea29 100644
--- a/src/compiler/glsl/glsl_parser.yy
+++ b/src/compiler/glsl/glsl_parser.yy
@@ -170,7 +170,6 @@ static bool match_layout_qualifier(const char *s1, const char *s2,
%token <identifier> IDENTIFIER TYPE_IDENTIFIER NEW_IDENTIFIER
%type <identifier> any_identifier
%type <interface_block> instance_name_opt
-%type <interface_block> buffer_instance_name_opt
%token <real> FLOATCONSTANT
%token <dreal> DOUBLECONSTANT
%token <n> INTCONSTANT UINTCONSTANT BOOLCONSTANT
@@ -220,6 +219,7 @@ static bool match_layout_qualifier(const char *s1, const char *s2,
%type <type_qualifier> subroutine_qualifier
%type <subroutine_list> subroutine_type_list
%type <type_qualifier> interface_qualifier
+%type <type_qualifier> uniform_interface_qualifier
%type <type_qualifier> buffer_interface_qualifier
%type <type_specifier> type_specifier
%type <type_specifier> type_specifier_nonarray
@@ -2625,10 +2625,23 @@ basic_interface_block:
$$ = block;
}
- | buffer_interface_qualifier NEW_IDENTIFIER '{' member_list '}' buffer_instance_name_opt ';'
+ | uniform_interface_qualifier NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';'
{
ast_interface_block *const block = $6;
+ block->layout = *state->default_uniform_qualifier;
+ block->block_name = $2;
+ block->declarations.push_degenerate_list_at_head(& $4->link);
+
+ _mesa_ast_process_interface_block(& @1, state, block, $1);
+
+ $$ = block;
+ }
+ | buffer_interface_qualifier NEW_IDENTIFIER '{' member_list '}' instance_name_opt ';'
+ {
+ ast_interface_block *const block = $6;
+
+ block->layout = *state->default_shader_storage_qualifier;
block->block_name = $2;
block->declarations.push_degenerate_list_at_head(& $4->link);
@@ -2649,7 +2662,10 @@ interface_qualifier:
memset(& $$, 0, sizeof($$));
$$.flags.q.out = 1;
}
- | UNIFORM
+ ;
+
+uniform_interface_qualifier:
+ UNIFORM
{
memset(& $$, 0, sizeof($$));
$$.flags.q.uniform = 1;
@@ -2667,39 +2683,16 @@ buffer_interface_qualifier:
instance_name_opt:
/* empty */
{
- $$ = new(state) ast_interface_block(*state->default_uniform_qualifier,
- NULL, NULL);
- }
- | NEW_IDENTIFIER
- {
- $$ = new(state) ast_interface_block(*state->default_uniform_qualifier,
- $1, NULL);
- $$->set_location(@1);
- }
- | NEW_IDENTIFIER array_specifier
- {
- $$ = new(state) ast_interface_block(*state->default_uniform_qualifier,
- $1, $2);
- $$->set_location_range(@1, @2);
- }
- ;
-
-buffer_instance_name_opt:
- /* empty */
- {
- $$ = new(state) ast_interface_block(*state->default_shader_storage_qualifier,
- NULL, NULL);
+ $$ = new(state) ast_interface_block(NULL, NULL);
}
| NEW_IDENTIFIER
{
- $$ = new(state) ast_interface_block(*state->default_shader_storage_qualifier,
- $1, NULL);
+ $$ = new(state) ast_interface_block($1, NULL);
$$->set_location(@1);
}
| NEW_IDENTIFIER array_specifier
{
- $$ = new(state) ast_interface_block(*state->default_shader_storage_qualifier,
- $1, $2);
+ $$ = new(state) ast_interface_block($1, $2);
$$->set_location_range(@1, @2);
}
;