ast_to_hir: Reject function names that start with "gl_".
Fixes piglit test redeclaration-03.vert.
This commit is contained in:
@@ -2099,6 +2099,18 @@ ast_function::hir(exec_list *instructions,
|
|||||||
|
|
||||||
const char *const name = identifier;
|
const char *const name = identifier;
|
||||||
|
|
||||||
|
/* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec,
|
||||||
|
*
|
||||||
|
* "Identifiers starting with "gl_" are reserved for use by
|
||||||
|
* OpenGL, and may not be declared in a shader as either a
|
||||||
|
* variable or a function."
|
||||||
|
*/
|
||||||
|
if (strncmp(name, "gl_", 3) == 0) {
|
||||||
|
YYLTYPE loc = this->get_location();
|
||||||
|
_mesa_glsl_error(&loc, state,
|
||||||
|
"identifier `%s' uses reserved `gl_' prefix", name);
|
||||||
|
}
|
||||||
|
|
||||||
/* Convert the list of function parameters to HIR now so that they can be
|
/* Convert the list of function parameters to HIR now so that they can be
|
||||||
* used below to compare this function's signature with previously seen
|
* used below to compare this function's signature with previously seen
|
||||||
* signatures for functions with the same name.
|
* signatures for functions with the same name.
|
||||||
|
Reference in New Issue
Block a user