summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-08-07 02:56:01 -0700
committerKenneth Graunke <kenneth@whitecape.org>2010-09-07 17:30:38 -0700
commitd8e34e29eb58c38ef60226156aab8f4a93b397b7 (patch)
treed647746ef4f9fe42b4ae88991a0a1447f384e734 /src
parentb4ec3f268c4a81c4b9047813423bdf49f0cb1cb5 (diff)
ast_to_hir: Reject unsized array declarations in GLSL ES 1.00.
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ast_to_hir.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index b959087124..e767c58e09 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1474,7 +1474,7 @@ ast_compound_statement::hir(exec_list *instructions,
static const glsl_type *
-process_array_type(const glsl_type *base, ast_node *array_size,
+process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size,
struct _mesa_glsl_parse_state *state)
{
unsigned length = 0;
@@ -1510,6 +1510,12 @@ process_array_type(const glsl_type *base, ast_node *array_size,
}
}
}
+ } else if (state->es_shader) {
+ /* Section 10.17 of the GLSL ES 1.00 specification states that unsized
+ * array declarations have been removed from the language.
+ */
+ _mesa_glsl_error(loc, state, "unsized array declarations are not "
+ "allowed in GLSL ES 1.00.");
}
return glsl_type::get_array_instance(base, length);
@@ -1530,7 +1536,8 @@ ast_type_specifier::glsl_type(const char **name,
*name = this->type_name;
if (this->is_array) {
- type = process_array_type(type, this->array_size, state);
+ YYLTYPE loc = this->get_location();
+ type = process_array_type(&loc, type, this->array_size, state);
}
}
@@ -1727,7 +1734,8 @@ ast_declarator_list::hir(exec_list *instructions,
}
if (decl->is_array) {
- var_type = process_array_type(decl_type, decl->array_size, state);
+ var_type = process_array_type(&loc, decl_type, decl->array_size,
+ state);
} else {
var_type = decl_type;
}
@@ -2142,7 +2150,7 @@ ast_parameter_declarator::hir(exec_list *instructions,
* call already handled the "vec4[..] foo" case.
*/
if (this->is_array) {
- type = process_array_type(type, this->array_size, state);
+ type = process_array_type(&loc, type, this->array_size, state);
}
if (type->array_size() == 0) {
@@ -2712,11 +2720,12 @@ ast_struct_specifier::hir(exec_list *instructions,
foreach_list_typed (ast_declaration, decl, link,
&decl_list->declarations) {
- const struct glsl_type *const field_type =
- (decl->is_array)
- ? process_array_type(decl_type, decl->array_size, state)
- : decl_type;
-
+ const struct glsl_type *field_type = decl_type;
+ if (decl->is_array) {
+ YYLTYPE loc = decl->get_location();
+ field_type = process_array_type(&loc, decl_type, decl->array_size,
+ state);
+ }
fields[i].type = (field_type != NULL)
? field_type : glsl_type::error_type;
fields[i].name = decl->identifier;