Mesa (master): glsl: Do not call lhs->variable_referenced() multiple times

Iago Toral Quiroga itoral at kemper.freedesktop.org
Tue May 13 08:05:07 UTC 2014


Module: Mesa
Branch: master
Commit: a143fbb3220e4c40cd2c75eca6f3e94fba0fe324
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a143fbb3220e4c40cd2c75eca6f3e94fba0fe324

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Fri May  9 08:50:03 2014 +0200

glsl: Do not call lhs->variable_referenced() multiple times

Instead take the result from the first call and use it where needed.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/ast_to_hir.cpp |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 7516c33..0128b3f 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -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,




More information about the mesa-commit mailing list