Mesa (master): ast_to_hir: Mark arrays as lvalues in GLSL ES, but prohibit assignment.

Kenneth Graunke kwg at kemper.freedesktop.org
Wed Sep 8 00:46:15 UTC 2010


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Sep  7 02:59:38 2010 -0700

ast_to_hir: Mark arrays as lvalues in GLSL ES, but prohibit assignment.

This allows them to be passed as out/inout parameters, but still
prevents them from being used as the target of an assignment.  This is
per section 5.8 of the GLSL ES 1.00 specification.

---

 src/glsl/ast_to_hir.cpp |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 8322dbf..3de6caa 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -516,6 +516,12 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
 	 _mesa_glsl_error(& lhs_loc, state, "non-lvalue in assignment");
 	 error_emitted = true;
       }
+
+      if (state->es_shader && lhs->type->is_array()) {
+	 _mesa_glsl_error(&lhs_loc, state, "whole array assignment is not "
+			  "allowed in GLSL ES 1.00.");
+	 error_emitted = true;
+      }
    }
 
    ir_rvalue *new_rhs = validate_assignment(state, lhs->type, rhs);
@@ -1624,7 +1630,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
 		       qual_string);
    }
 
-   if (var->type->is_array() && (state->language_version >= 120)) {
+   if (var->type->is_array() && state->language_version != 110) {
       var->array_lvalue = true;
    }
 }




More information about the mesa-commit mailing list