diff options
author | Timothy Arceri <[email protected]> | 2016-02-11 15:45:05 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-02-12 09:06:49 +1100 |
commit | 98d3cc9fbcdf4f630921a763261925d91bd04053 (patch) | |
tree | 126e602b486e2206f9a9e8f5a0154695ae958f6a /src/compiler/glsl/ast_to_hir.cpp | |
parent | 0d4898ae8068d3984242775a6fcc87f280c0ac5a (diff) |
glsl: remove duplicate embedded struct validation
Commit c98deb18d5836f in 2010 disallowed embedded struct definitions
in ES. Then in 2013 d9bb8b7b56ce65b disallowed it for everything but
GLSL 1.10.
Commit c98deb18d5836f seemed the cleanest way to do the check so its
been extended to cover GL and the other version has been removed.
Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/compiler/glsl/ast_to_hir.cpp | 59 |
1 files changed, 17 insertions, 42 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 92f4988c339..38336729cea 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -6267,13 +6267,24 @@ ast_process_struct_or_iface_block_members(exec_list *instructions, decl_list->type->specifier->hir(instructions, state); - /* Section 10.9 of the GLSL ES 1.00 specification states that - * embedded structure definitions have been removed from the language. + /* Section 4.1.8 (Structures) of the GLSL 1.10 spec says: + * + * "Anonymous structures are not supported; so embedded structures + * must have a declarator. A name given to an embedded struct is + * scoped at the same level as the struct it is embedded in." + * + * The same section of the GLSL 1.20 spec says: + * + * "Anonymous structures are not supported. Embedded structures are + * not supported." + * + * The GLSL ES 1.00 and 3.00 specs have similar langauge. So, we allow + * embedded structures in 1.10 only. */ - if (state->es_shader && decl_list->type->specifier->structure != NULL) { - _mesa_glsl_error(&loc, state, "embedded structure definitions are " - "not allowed in GLSL ES 1.00"); - } + if (state->language_version != 110 && + decl_list->type->specifier->structure != NULL) + _mesa_glsl_error(&loc, state, + "embedded structure declarations are not allowed"); const glsl_type *decl_type = decl_list->type->glsl_type(& type_name, state); @@ -6514,33 +6525,6 @@ ast_struct_specifier::hir(exec_list *instructions, { YYLTYPE loc = this->get_location(); - /* Section 4.1.8 (Structures) of the GLSL 1.10 spec says: - * - * "Anonymous structures are not supported; so embedded structures must - * have a declarator. A name given to an embedded struct is scoped at - * the same level as the struct it is embedded in." - * - * The same section of the GLSL 1.20 spec says: - * - * "Anonymous structures are not supported. Embedded structures are not - * supported. - * - * struct S { float f; }; - * struct T { - * S; // Error: anonymous structures disallowed - * struct { ... }; // Error: embedded structures disallowed - * S s; // Okay: nested structures with name are allowed - * };" - * - * The GLSL ES 1.00 and 3.00 specs have similar langauge and examples. So, - * we allow embedded structures in 1.10 only. - */ - if (state->language_version != 110 && state->struct_specifier_depth != 0) - _mesa_glsl_error(&loc, state, - "embedded structure declarations are not allowed"); - - state->struct_specifier_depth++; - unsigned expl_location = 0; if (layout && layout->flags.q.explicit_location) { if (!process_qualifier_constant(state, &loc, "location", @@ -6583,8 +6567,6 @@ ast_struct_specifier::hir(exec_list *instructions, } } - state->struct_specifier_depth--; - /* Structure type definitions do not have r-values. */ return NULL; @@ -6704,11 +6686,6 @@ ast_interface_block::hir(exec_list *instructions, exec_list declared_variables; glsl_struct_field *fields; - /* Treat an interface block as one level of nesting, so that embedded struct - * specifiers will be disallowed. - */ - state->struct_specifier_depth++; - /* For blocks that accept memory qualifiers (i.e. shader storage), verify * that we don't have incompatible qualifiers */ @@ -6751,8 +6728,6 @@ ast_interface_block::hir(exec_list *instructions, qual_stream, expl_location); - state->struct_specifier_depth--; - if (!redeclaring_per_vertex) { validate_identifier(this->block_name, loc, state); |