[Mesa-dev] [PATCH 4/9] glsl: simplified error checking for duplicated layout-qualifiers
Timothy Arceri
timothy.arceri at collabora.com
Mon Oct 24 02:18:18 UTC 2016
Patches 2 and 4 are:
Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>
On Sat, 2016-10-22 at 23:09 +0300, Andres Gomez wrote:
> Tthe GLSL parser has been simplified to check for the needed
> GL_ARB_shading_language_420pack extension just when merging the
> qualifiers in the proper cases.
>
> Signed-off-by: Andres Gomez <agomez at igalia.com>
> ---
> src/compiler/glsl/ast_type.cpp | 6 ++++++
> src/compiler/glsl/glsl_parser.yy | 24 ------------------------
> 2 files changed, 6 insertions(+), 24 deletions(-)
>
> diff --git a/src/compiler/glsl/ast_type.cpp
> b/src/compiler/glsl/ast_type.cpp
> index c4ca30d..48ee27e 100644
> --- a/src/compiler/glsl/ast_type.cpp
> +++ b/src/compiler/glsl/ast_type.cpp
> @@ -201,6 +201,12 @@ ast_type_qualifier::merge_qualifier(YYLTYPE
> *loc,
> return false;
> }
>
> + if (is_multiple_layouts_merge && !state->has_420pack_or_es31()) {
> + _mesa_glsl_error(loc, state,
> + "duplicate layout(...) qualifiers");
> + return false;
> + }
> +
> if (q.flags.q.prim_type) {
> if (this->flags.q.prim_type && this->prim_type != q.prim_type)
> {
> _mesa_glsl_error(loc, state,
> diff --git a/src/compiler/glsl/glsl_parser.yy
> b/src/compiler/glsl/glsl_parser.yy
> index 2532713..41a5a17 100644
> --- a/src/compiler/glsl/glsl_parser.yy
> +++ b/src/compiler/glsl/glsl_parser.yy
> @@ -1881,9 +1881,6 @@ type_qualifier:
> * precise qualifiers since these are useful in
> ARB_separate_shader_objects.
> * There is no clear spec guidance on this either.
> */
> - if (!state->has_420pack_or_es31() && $2.has_layout())
> - _mesa_glsl_error(&@1, state, "duplicate layout(...)
> qualifiers");
> -
> $$ = $1;
> $$.merge_qualifier(& @1, state, $2, false, $2.has_layout());
> }
> @@ -2707,11 +2704,6 @@ interface_block:
> {
> ast_interface_block *block = (ast_interface_block *) $2;
>
> - if (!state->has_420pack_or_es31() && block-
> >layout_helper.has_layout()) {
> - _mesa_glsl_error(&@1, state, "duplicate layout(...)
> qualifiers");
> - YYERROR;
> - }
> -
> if (!$1.merge_qualifier(& @1, state, block->layout_helper,
> false,
> block->layout_helper.has_layout())) {
> YYERROR;
> @@ -2849,10 +2841,6 @@ layout_uniform_defaults:
> layout_qualifier layout_uniform_defaults
> {
> $$ = $1;
> - if (!state->has_420pack_or_es31()) {
> - _mesa_glsl_error(&@1, state, "duplicate layout(...)
> qualifiers");
> - YYERROR;
> - }
> if (!$$.merge_qualifier(& @1, state, $2, false, true)) {
> YYERROR;
> }
> @@ -2864,10 +2852,6 @@ layout_buffer_defaults:
> layout_qualifier layout_buffer_defaults
> {
> $$ = $1;
> - if (!state->has_420pack_or_es31()) {
> - _mesa_glsl_error(&@1, state, "duplicate layout(...)
> qualifiers");
> - YYERROR;
> - }
> if (!$$.merge_qualifier(& @1, state, $2, false, true)) {
> YYERROR;
> }
> @@ -2879,10 +2863,6 @@ layout_in_defaults:
> layout_qualifier layout_in_defaults
> {
> $$ = $1;
> - if (!state->has_420pack_or_es31()) {
> - _mesa_glsl_error(&@1, state, "duplicate layout(...)
> qualifiers");
> - YYERROR;
> - }
> if (!$$.merge_qualifier(& @1, state, $2, false, true)) {
> YYERROR;
> }
> @@ -2894,10 +2874,6 @@ layout_out_defaults:
> layout_qualifier layout_out_defaults
> {
> $$ = $1;
> - if (!state->has_420pack_or_es31()) {
> - _mesa_glsl_error(&@1, state, "duplicate layout(...)
> qualifiers");
> - YYERROR;
> - }
> if (!$$.merge_qualifier(& @1, state, $2, false, true)) {
> YYERROR;
> }
More information about the mesa-dev
mailing list