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:
@@ -4210,33 +4210,46 @@ ast_declarator_list::hir(exec_list *instructions,
|
|||||||
_mesa_glsl_error(&loc, state,
|
_mesa_glsl_error(&loc, state,
|
||||||
"invalid type `%s' in empty declaration",
|
"invalid type `%s' in empty declaration",
|
||||||
type_name);
|
type_name);
|
||||||
} else if (decl_type->base_type == GLSL_TYPE_ATOMIC_UINT) {
|
} else {
|
||||||
/* Empty atomic counter declarations are allowed and useful
|
if (decl_type->base_type == GLSL_TYPE_ARRAY) {
|
||||||
* to set the default offset qualifier.
|
/* From Section 4.12 (Empty Declarations) of the GLSL 4.5 spec:
|
||||||
*/
|
*
|
||||||
return NULL;
|
* "The combinations of types and qualifiers that cause
|
||||||
} else if (this->type->qualifier.precision != ast_precision_none) {
|
* compile-time or link-time errors are the same whether or not
|
||||||
if (this->type->specifier->structure != NULL) {
|
* the declaration is empty."
|
||||||
_mesa_glsl_error(&loc, state,
|
*/
|
||||||
"precision qualifiers can't be applied "
|
validate_array_dimensions(decl_type, state, &loc);
|
||||||
"to structures");
|
}
|
||||||
} else {
|
|
||||||
static const char *const precision_names[] = {
|
if (decl_type->base_type == GLSL_TYPE_ATOMIC_UINT) {
|
||||||
"highp",
|
/* Empty atomic counter declarations are allowed and useful
|
||||||
"highp",
|
* to set the default offset qualifier.
|
||||||
"mediump",
|
*/
|
||||||
"lowp"
|
return NULL;
|
||||||
};
|
} else if (this->type->qualifier.precision != ast_precision_none) {
|
||||||
|
if (this->type->specifier->structure != NULL) {
|
||||||
_mesa_glsl_warning(&loc, state,
|
_mesa_glsl_error(&loc, state,
|
||||||
"empty declaration with precision qualifier, "
|
"precision qualifiers can't be applied "
|
||||||
"to set the default precision, use "
|
"to structures");
|
||||||
"`precision %s %s;'",
|
} else {
|
||||||
precision_names[this->type->qualifier.precision],
|
static const char *const precision_names[] = {
|
||||||
type_name);
|
"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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user