aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-05-29 20:46:21 +0200
committermarha <marha@users.sourceforge.net>2014-05-29 20:46:21 +0200
commit816a5430313e07083c5325f0a430126a2e10ec41 (patch)
tree82e47992f52149b83238690062e0c56202cb2ebb /mesalib/src/glsl/ast_to_hir.cpp
parentc2dfa0e8c98b06e050c530d704d75a7e4edad02e (diff)
downloadvcxsrv-816a5430313e07083c5325f0a430126a2e10ec41.tar.gz
vcxsrv-816a5430313e07083c5325f0a430126a2e10ec41.tar.bz2
vcxsrv-816a5430313e07083c5325f0a430126a2e10ec41.zip
mesa xkeyboard-config git update 29 Mar 2014
xkeyboard-config commit bc3ac1b0d152e929b3532a541596cf9fe286bb9e mesa commit dfd117b8570a69a429e660c069997e78b181ab6d
Diffstat (limited to 'mesalib/src/glsl/ast_to_hir.cpp')
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 0128b3f4e..f230a70a3 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -3078,7 +3078,7 @@ validate_identifier(const char *identifier, YYLTYPE loc,
* OpenGL, and may not be declared in a shader as either a
* variable or a function."
*/
- if (strncmp(identifier, "gl_", 3) == 0) {
+ if (is_gl_identifier(identifier)) {
_mesa_glsl_error(&loc, state,
"identifier `%s' uses reserved `gl_' prefix",
identifier);
@@ -3651,11 +3651,15 @@ ast_declarator_list::hir(exec_list *instructions,
* instruction stream.
*/
exec_list initializer_instructions;
+
+ /* Examine var name here since var may get deleted in the next call */
+ bool var_is_gl_id = is_gl_identifier(var->name);
+
ir_variable *earlier =
get_variable_being_redeclared(var, decl->get_location(), state,
false /* allow_all_redeclarations */);
if (earlier != NULL) {
- if (strncmp(var->name, "gl_", 3) == 0 &&
+ if (var_is_gl_id &&
earlier->data.how_declared == ir_var_declared_in_block) {
_mesa_glsl_error(&loc, state,
"`%s' has already been redeclared using "
@@ -5399,7 +5403,7 @@ ast_interface_block::hir(exec_list *instructions,
ir_variable *earlier =
get_variable_being_redeclared(var, loc, state,
true /* allow_all_redeclarations */);
- if (strncmp(var->name, "gl_", 3) != 0 || earlier == NULL) {
+ if (!is_gl_identifier(var->name) || earlier == NULL) {
_mesa_glsl_error(&loc, state,
"redeclaration of gl_PerVertex can only "
"include built-in variables");
@@ -5634,7 +5638,7 @@ detect_conflicting_assignments(struct _mesa_glsl_parse_state *state,
gl_FragColor_assigned = true;
else if (strcmp(var->name, "gl_FragData") == 0)
gl_FragData_assigned = true;
- else if (strncmp(var->name, "gl_", 3) != 0) {
+ else if (!is_gl_identifier(var->name)) {
if (state->stage == MESA_SHADER_FRAGMENT &&
var->data.mode == ir_var_shader_out) {
user_defined_fs_output_assigned = true;