Mesa (glsl2): glsl2: Make ir_assignment derive from ir_instruction, not ir_rvalue.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Jul 22 23:47:48 UTC 2010


Module: Mesa
Branch: glsl2
Commit: 3c033637de7def553559c11d037f2e8bbb750f77
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c033637de7def553559c11d037f2e8bbb750f77

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Jul 22 16:40:35 2010 -0700

glsl2: Make ir_assignment derive from ir_instruction, not ir_rvalue.

Assignments can only exist at the top level instruction stream; the
residual value is handled by assigning the value to a temporary and
returning an ir_dereference_variable of that temporary.

---

 src/glsl/ir.h          |    2 +-
 src/glsl/ir_reader.cpp |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index c73bf4c..3fd3a76 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -506,7 +506,7 @@ public:
 };
 
 
-class ir_assignment : public ir_rvalue {
+class ir_assignment : public ir_instruction {
 public:
    ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, ir_rvalue *condition);
 
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index 2248e92..14bd2d6 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -357,6 +357,8 @@ read_instruction(_mesa_glsl_parse_state *st, s_expression *expr,
    ir_instruction *inst = NULL;
    if (strcmp(tag->value(), "declare") == 0) {
       inst = read_declaration(st, list);
+   } else if (strcmp(tag->value(), "assign") == 0) {
+      inst = read_assignment(st, list);
    } else if (strcmp(tag->value(), "if") == 0) {
       inst = read_if(st, list, loop_ctx);
    } else if (strcmp(tag->value(), "loop") == 0) {
@@ -546,8 +548,6 @@ read_rvalue(_mesa_glsl_parse_state *st, s_expression *expr)
       return rvalue;
    else if (strcmp(tag->value(), "swiz") == 0) {
       rvalue = read_swizzle(st, list);
-   } else if (strcmp(tag->value(), "assign") == 0) {
-      rvalue = read_assignment(st, list);
    } else if (strcmp(tag->value(), "expression") == 0) {
       rvalue = read_expression(st, list);
    } else if (strcmp(tag->value(), "call") == 0) {




More information about the mesa-commit mailing list