summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-02-05 13:08:19 +1100
committerTimothy Arceri <[email protected]>2016-02-09 13:52:52 +1100
commit3fd42807593eb68d83a36215fc5fc49b3adc7724 (patch)
tree5a73afc187f7d4ed5ce683c49470f05b341ee203 /src/compiler/glsl/ast_to_hir.cpp
parent74f956c416d5b0b37b4c2d6b957167bb203502c3 (diff)
glsl: validate arrays of arrays on empty type delclarations
Fixes: dEQP-GLES31.functional.shaders.arrays_of_arrays.invalid.empty_declaration_without_var_name_fragment dEQP-GLES31.functional.shaders.arrays_of_arrays.invalid.empty_declaration_without_var_name_vertex Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ast_to_hir.cpp')
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp63
1 files changed, 38 insertions, 25 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 3fca18a5087..92f4988c339 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -4210,33 +4210,46 @@ ast_declarator_list::hir(exec_list *instructions,
_mesa_glsl_error(&loc, state,
"invalid type `%s' in empty declaration",
type_name);
- } else if (decl_type->base_type == GLSL_TYPE_ATOMIC_UINT) {
- /* Empty atomic counter declarations are allowed and useful
- * to set the default offset qualifier.
- */
- return NULL;
- } else if (this->type->qualifier.precision != ast_precision_none) {
- if (this->type->specifier->structure != NULL) {
- _mesa_glsl_error(&loc, state,
- "precision qualifiers can't be applied "
- "to structures");
- } else {
- static const char *const precision_names[] = {
- "highp",
- "highp",
- "mediump",
- "lowp"
- };
+ } else {
+ if (decl_type->base_type == GLSL_TYPE_ARRAY) {
+ /* From Section 4.12 (Empty Declarations) of the GLSL 4.5 spec:
+ *
+ * "The combinations of types and qualifiers that cause
+ * compile-time or link-time errors are the same whether or not
+ * the declaration is empty."
+ */
+ validate_array_dimensions(decl_type, state, &loc);
+ }
- _mesa_glsl_warning(&loc, state,
- "empty declaration with precision qualifier, "
- "to set the default precision, use "
- "`precision %s %s;'",
- precision_names[this->type->qualifier.precision],
- type_name);
+ if (decl_type->base_type == GLSL_TYPE_ATOMIC_UINT) {
+ /* Empty atomic counter declarations are allowed and useful
+ * to set the default offset qualifier.
+ */
+ return NULL;
+ } else if (this->type->qualifier.precision != ast_precision_none) {
+ if (this->type->specifier->structure != NULL) {
+ _mesa_glsl_error(&loc, state,
+ "precision qualifiers can't be applied "
+ "to structures");
+ } else {
+ static const char *const precision_names[] = {
+ "highp",
+ "highp",
+ "mediump",
+ "lowp"
+ };
+
+ _mesa_glsl_warning(&loc, state,
+ "empty declaration with precision "
+ "qualifier, to set the default precision, "
+ "use `precision %s %s;'",
+ precision_names[this->type->
+ qualifier.precision],
+ type_name);
+ }
+ } else if (this->type->specifier->structure == NULL) {
+ _mesa_glsl_warning(&loc, state, "empty declaration");
}
- } else if (this->type->specifier->structure == NULL) {
- _mesa_glsl_warning(&loc, state, "empty declaration");
}
}