From fd612e4547175d1350eac2d8374d01390de58acb Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 18 Jan 2016 16:09:06 +1100 Subject: [PATCH] glsl: split layout_defaults into specific types This will allow merging of duplicate layout qualifiers as allowed by ARB_shading_language_420pack Reviewed-by: Matt Turner Reviewed-by: Chris Forbes --- src/glsl/glsl_parser.yy | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 51796a65df9..462ca45a55c 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -299,6 +299,10 @@ static bool match_layout_qualifier(const char *s1, const char *s2, %type for_init_statement %type for_rest_statement %type layout_defaults +%type layout_uniform_defaults +%type layout_buffer_defaults +%type layout_in_defaults +%type layout_out_defaults %right THEN ELSE %% @@ -2737,7 +2741,7 @@ member_declaration: } ; -layout_defaults: +layout_uniform_defaults: layout_qualifier UNIFORM ';' { if (!state->default_uniform_qualifier->merge_qualifier(& @1, state, $1)) { @@ -2745,8 +2749,10 @@ layout_defaults: } $$ = NULL; } + ; - | layout_qualifier BUFFER ';' +layout_buffer_defaults: + layout_qualifier BUFFER ';' { if (!state->default_shader_storage_qualifier->merge_qualifier(& @1, state, $1)) { YYERROR; @@ -2764,16 +2770,20 @@ layout_defaults: $$ = NULL; } + ; - | layout_qualifier IN_TOK ';' +layout_in_defaults: + layout_qualifier IN_TOK ';' { $$ = NULL; if (!state->in_qualifier->merge_in_qualifier(& @1, state, $1, $$)) { YYERROR; } } + ; - | layout_qualifier OUT_TOK ';' +layout_out_defaults: + layout_qualifier OUT_TOK ';' { $$ = NULL; if (state->stage == MESA_SHADER_GEOMETRY) { @@ -2804,3 +2814,11 @@ layout_defaults: "tessellation control or geometry shaders"); } } + ; + +layout_defaults: + layout_uniform_defaults + | layout_buffer_defaults + | layout_in_defaults + | layout_out_defaults + ; -- 2.30.2