glsl: Do not call lhs->variable_referenced() multiple times
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 9 May 2014 06:50:03 +0000 (08:50 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Tue, 13 May 2014 08:01:02 +0000 (10:01 +0200)
Instead take the result from the first call and use it where needed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ast_to_hir.cpp

index 7516c33e1dfd70867f799d3ba04081dbb3355a97..0128b3f4e82f8e872bb8e872955c49429d6416ae 100644 (file)
@@ -799,11 +799,10 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
                           "assignment to %s",
                           non_lvalue_description);
          error_emitted = true;
-      } else if (lhs->variable_referenced() != NULL
-                 && lhs->variable_referenced()->data.read_only) {
+      } else if (lhs_var != NULL && lhs_var->data.read_only) {
          _mesa_glsl_error(&lhs_loc, state,
                           "assignment to read-only variable '%s'",
-                          lhs->variable_referenced()->name);
+                          lhs_var->name);
          error_emitted = true;
       } else if (lhs->type->is_array() &&
                  !state->check_version(120, 300, &lhs_loc,