glsl: Skip processing of expression trees in discard simplification.
authorEric Anholt <eric@anholt.net>
Fri, 11 Mar 2011 21:23:13 +0000 (13:23 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 15 Mar 2011 16:49:01 +0000 (09:49 -0700)
It only cares about "if", "loop", and "discard".

src/glsl/opt_discard_simplification.cpp

index 0e577c478a91598df8c4de5c373d6feeb6199e50..7c2928d271cecd793a05f4cbfeeb393792555566 100644 (file)
@@ -95,6 +95,7 @@ public:
 
    ir_visitor_status visit_enter(ir_if *);
    ir_visitor_status visit_enter(ir_loop *);
+   ir_visitor_status visit_enter(ir_assignment *);
 
    bool progress;
 };
@@ -117,6 +118,15 @@ is_only_instruction(ir_discard *discard)
           discard->next->is_tail_sentinel());
 }
 
+/* We only care about the top level instructions, so don't descend
+ * into expressions.
+ */
+ir_visitor_status
+discard_simplifier::visit_enter(ir_assignment *ir)
+{
+   return visit_continue_with_parent;
+}
+
 ir_visitor_status
 discard_simplifier::visit_enter(ir_if *ir)
 {