mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 11:20:11 +01:00
glsl: Don't allow redefining builtin functions on GLSL 1.00.
The spec text cited above says you can't, but only the GLSL 3.00 (redefine or overload) case was implemented. Fixes dEQP scoping.invalid.redefine_builtin_fragment/vertex. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Tested-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
79da0ed2fc
commit
0ffa06a19b
1 changed files with 13 additions and 2 deletions
|
|
@ -5888,16 +5888,27 @@ ast_function::hir(exec_list *instructions,
|
||||||
* "User code can overload the built-in functions but cannot redefine
|
* "User code can overload the built-in functions but cannot redefine
|
||||||
* them."
|
* them."
|
||||||
*/
|
*/
|
||||||
if (state->es_shader && state->language_version >= 300) {
|
if (state->es_shader) {
|
||||||
/* Local shader has no exact candidates; check the built-ins. */
|
/* Local shader has no exact candidates; check the built-ins. */
|
||||||
_mesa_glsl_initialize_builtin_functions();
|
_mesa_glsl_initialize_builtin_functions();
|
||||||
if (_mesa_glsl_has_builtin_function(name)) {
|
if (state->language_version >= 300 &&
|
||||||
|
_mesa_glsl_has_builtin_function(name)) {
|
||||||
YYLTYPE loc = this->get_location();
|
YYLTYPE loc = this->get_location();
|
||||||
_mesa_glsl_error(& loc, state,
|
_mesa_glsl_error(& loc, state,
|
||||||
"A shader cannot redefine or overload built-in "
|
"A shader cannot redefine or overload built-in "
|
||||||
"function `%s' in GLSL ES 3.00", name);
|
"function `%s' in GLSL ES 3.00", name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state->language_version == 100) {
|
||||||
|
ir_function_signature *sig =
|
||||||
|
_mesa_glsl_find_builtin_function(state, name, &hir_parameters);
|
||||||
|
if (sig && sig->is_builtin()) {
|
||||||
|
_mesa_glsl_error(& loc, state,
|
||||||
|
"A shader cannot redefine built-in "
|
||||||
|
"function `%s' in GLSL ES 1.00", name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Verify that this function's signature either doesn't match a previously
|
/* Verify that this function's signature either doesn't match a previously
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue