[Mesa-dev] [PATCH] glsl: Do not call lhs->variable_referenced() multiple times
Iago Toral Quiroga
itoral at igalia.com
Thu May 8 23:50:03 PDT 2014
Instead take the result from the first call and use it where needed.
---
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
@@ -792,25 +792,24 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
ir_variable *lhs_var = lhs->variable_referenced();
if (lhs_var)
lhs_var->data.assigned = true;
if (!error_emitted) {
if (non_lvalue_description != NULL) {
_mesa_glsl_error(&lhs_loc, 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,
"whole array assignment forbidden")) {
/* From page 32 (page 38 of the PDF) of the GLSL 1.10 spec:
*
* "Other binary or unary expressions, non-dereferenced
* arrays, function names, swizzles with repeated fields,
* and constants cannot be l-values."
*
--
1.9.1
More information about the mesa-dev
mailing list