glsl: Restrict func redeclarations (not just redefinitions) on GLSL 1.00.

Fixes DEQP's scoping.invalid.redeclare_function_fragment/vertex.

v2: Fix accidental rejection of prototype+decl.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v1)
Tested-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Eric Anholt
2017-05-01 16:42:03 -07:00
parent e5ade7db73
commit 79da0ed2fc

View File

@@ -5933,6 +5933,16 @@ ast_function::hir(exec_list *instructions,
*/
return NULL;
}
} else if (state->language_version == 100 && !is_definition) {
/* From the GLSL 1.00 spec, section 4.2.7:
*
* "A particular variable, structure or function declaration
* may occur at most once within a scope with the exception
* that a single function prototype plus the corresponding
* function definition are allowed."
*/
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state, "function `%s' redeclared", name);
}
}
}