Mesa (gallium-mesa-7.4): slang: redo the last commit for if/break & if/ continue tests as it

Alan Hourihane alanh at kemper.freedesktop.org
Wed Mar 18 21:44:34 UTC 2009


Module: Mesa
Branch: gallium-mesa-7.4
Commit: ed25e2031c917bd1b2fea75375b4d60837b4ab9f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ed25e2031c917bd1b2fea75375b4d60837b4ab9f

Author: Alan Hourihane <alanh at vmware.com>
Date:   Wed Mar 18 21:42:14 2009 +0000

slang: redo the last commit for if/break & if/continue tests as it
wasn't good enough for deeply nested if's.

---

 src/mesa/shader/slang/slang_codegen.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index ac70632..2052129 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2665,6 +2665,9 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper)
 
       /* do IR codegen for body */
       n = _slang_gen_operation(A, body);
+      if (!n)
+         return NULL;
+
       root = new_seq(root, n);
 
       slang_operation_delete(body);
@@ -2806,12 +2809,16 @@ _slang_gen_if(slang_assemble_ctx * A, const slang_operation *oper)
    if (is_operation_type(&oper->children[1], SLANG_OPER_BREAK)
        && !haveElseClause) {
       /* Special case: generate a conditional break */
+      if (!A->CurLoop) /* probably trying to unroll */
+         return NULL;
       ifBody = new_break_if_true(A->CurLoop, cond);
       return ifBody;
    }
    else if (is_operation_type(&oper->children[1], SLANG_OPER_CONTINUE)
             && !haveElseClause) {
-      /* Special case: generate a conditional break */
+      /* Special case: generate a conditional continue */
+      if (!A->CurLoop) /* probably trying to unroll */
+         return NULL;
       ifBody = new_cont_if_true(A->CurLoop, cond);
       return ifBody;
    }




More information about the mesa-commit mailing list