diff options
author | Andres Gomez <[email protected]> | 2016-10-07 01:52:06 +0300 |
---|---|---|
committer | Andres Gomez <[email protected]> | 2016-11-25 13:18:30 +0200 |
commit | e5041c64094255fae6ca7327cfd75a7595442478 (patch) | |
tree | 3e72bc58e990d3bf1b3a98230cbb0db7dfcd1e08 /src/compiler/glsl/glsl_parser.yy | |
parent | 5132d0c7b695d838617bf586e730899c65361668 (diff) |
glsl: push layout-qualifier-name values from variable declarations to global
After the previous modifications in the merging of the
layout-qualifier-name values, we no longer push the final value in a
declaration to the global values.
This regression happens because we don't call for merging on the
right-most layout qualifier of a declaration which is also the
overriding one in case of multiple appearances.
Now, we add a new method to push these values to the global ones and
we call for this just after all the layout-qualifier collapsing has
happened in a declaration.
This simplifies how this was working in two ways; we make a clear
differentiation of when we are pushing this to the global values since
before it was mixed in the merging call and we only run this once all
the processing for layout-qualifiers in a declaration has happened.
Reviewed-by: Timothy Arceri <[email protected]>
Signed-off-by: Andres Gomez <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glsl_parser.yy')
-rw-r--r-- | src/compiler/glsl/glsl_parser.yy | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index 9136fddbd14..0c3781c3361 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -845,7 +845,9 @@ declaration: } } block->layout = block->default_layout; - + if (!block->layout.push_to_global(& @1, state)) { + YYERROR; + } $$ = $1; } ; @@ -921,6 +923,9 @@ parameter_declaration: { $$ = $2; $$->type->qualifier = $1; + if (!$$->type->qualifier.push_to_global(& @1, state)) { + YYERROR; + } } | parameter_qualifier parameter_type_specifier { @@ -930,6 +935,9 @@ parameter_declaration: $$->type = new(ctx) ast_fully_specified_type(); $$->type->set_location_range(@1, @2); $$->type->qualifier = $1; + if (!$$->type->qualifier.push_to_global(& @1, state)) { + YYERROR; + } $$->type->specifier = $2; } ; @@ -1145,6 +1153,9 @@ fully_specified_type: $$ = new(ctx) ast_fully_specified_type(); $$->set_location_range(@1, @2); $$->qualifier = $1; + if (!$$->qualifier.push_to_global(& @1, state)) { + YYERROR; + } $$->specifier = $2; if ($$->specifier->structure != NULL && $$->specifier->structure->is_declaration) { @@ -2911,6 +2922,10 @@ layout_defaults: merge_qualifier(& @1, state, $1, false)) { YYERROR; } + if (!state->default_uniform_qualifier-> + push_to_global(& @1, state)) { + YYERROR; + } } | layout_buffer_defaults { @@ -2919,6 +2934,10 @@ layout_defaults: merge_qualifier(& @1, state, $1, false)) { YYERROR; } + if (!state->default_shader_storage_qualifier-> + push_to_global(& @1, state)) { + YYERROR; + } /* From the GLSL 4.50 spec, section 4.4.5: * @@ -2936,6 +2955,9 @@ layout_defaults: if (!$1.merge_into_in_qualifier(& @1, state, $$)) { YYERROR; } + if (!state->in_qualifier->push_to_global(& @1, state)) { + YYERROR; + } } | layout_out_defaults { @@ -2943,5 +2965,8 @@ layout_defaults: if (!$1.merge_into_out_qualifier(& @1, state, $$)) { YYERROR; } + if (!state->out_qualifier->push_to_global(& @1, state)) { + YYERROR; + } } ; |