glsl: Reduce processing of expression trees in do_structure_splitting.
authorEric Anholt <eric@anholt.net>
Fri, 11 Mar 2011 21:17:03 +0000 (13:17 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 15 Mar 2011 16:49:01 +0000 (09:49 -0700)
Most of the time we don't have a non-uniform struct variable in the
shader, so this cuts the time spent in do_structure_splitting during
glean texCombine by about 2/3.

src/glsl/opt_structure_splitting.cpp

index 014407c..2c1f6bb 100644 (file)
@@ -151,6 +151,12 @@ ir_structure_reference_visitor::visit_enter(ir_dereference_record *ir)
 ir_visitor_status
 ir_structure_reference_visitor::visit_enter(ir_assignment *ir)
 {
+   /* If there are no structure references yet, no need to bother with
+    * processing the expression tree.
+    */
+   if (this->variable_list.is_empty())
+      return visit_continue_with_parent;
+
    if (ir->lhs->as_dereference_variable() &&
        ir->rhs->as_dereference_variable() &&
        !ir->condition) {