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 <airlied@redhat.com>
This commit is contained in:
Timothy Arceri
2016-02-05 13:08:19 +11:00
parent 74f956c416
commit 3fd4280759

View File

@@ -4210,7 +4210,18 @@ 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) {
} 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);
}
if (decl_type->base_type == GLSL_TYPE_ATOMIC_UINT) {
/* Empty atomic counter declarations are allowed and useful
* to set the default offset qualifier.
*/
@@ -4229,16 +4240,18 @@ ast_declarator_list::hir(exec_list *instructions,
};
_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],
"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");
}
}
}
foreach_list_typed (ast_declaration, decl, link, &this->declarations) {
const struct glsl_type *var_type;