diff options
author | Eric Anholt <eric@anholt.net> | 2010-03-31 08:20:58 -1000 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-03-31 09:17:35 -1000 |
commit | b97ee2e260efb68849ee13402072b7d7185746d5 (patch) | |
tree | 39223f70a5a39dea0fb88eec75aa3e62ac554d82 | |
parent | b98020770730bd4a7e9bd5c2e4ab2ae8c1eb0376 (diff) |
Test that variable names don't use the reserved gl_ prefix.
Fixes identifier2.frag.
-rw-r--r-- | ast_to_hir.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index f66c029808..708656a6fc 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -1177,6 +1177,21 @@ ast_declarator_list::hir(exec_list *instructions, continue; } + /* 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(decl->identifier, "gl_", 3) == 0) { + /* FINISHME: This should only trigger if we're not redefining + * FINISHME: a builtin (to add a qualifier, for example). + */ + _mesa_glsl_error(& loc, state, + "identifier `%s' uses reserved `gl_' prefix", + decl->identifier); + } + instructions->push_tail(var); if (this->type->qualifier.attribute |