Mesa (master): glsl: fix 'if ((x=foo()) > 1.0)' bug

Brian Paul brianp at kemper.freedesktop.org
Thu Jul 8 15:26:39 UTC 2010


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

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Jul  8 09:22:52 2010 -0600

glsl: fix 'if ((x=foo()) > 1.0)' bug

Fixes fd.o bug 27216.  May also be the root cause of fd.o bug 28950.

We weren't propogating the storage info for the x=foo() expression up
through the IR tree to the inequality expression.

NOTE: This is a candidate for the Mesa 7.8 branch.

---

 src/mesa/slang/slang_emit.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/mesa/slang/slang_emit.c b/src/mesa/slang/slang_emit.c
index aa9d662..127c672 100644
--- a/src/mesa/slang/slang_emit.c
+++ b/src/mesa/slang/slang_emit.c
@@ -2361,7 +2361,10 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
 #if 0
       assert(!n->Store);
 #endif
-      n->Store = n->Children[1]->Store;
+      if (n->Children[1]->Store)
+         n->Store = n->Children[1]->Store;
+      else
+         n->Store = n->Children[0]->Store;
       return inst;
 
    case IR_SCOPE:
@@ -2369,6 +2372,7 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
       _slang_push_var_table(emitInfo->vt);
       inst = emit(emitInfo, n->Children[0]);
       _slang_pop_var_table(emitInfo->vt);
+      n->Store = n->Children[0]->Store;
       return inst;
 
    case IR_VAR_DECL:




More information about the mesa-commit mailing list