Mesa (master): glsl: Reduce processing of expression trees in do_structure_splitting.

Eric Anholt anholt at kemper.freedesktop.org
Tue Mar 15 17:23:03 UTC 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Mar 11 13:17:03 2011 -0800

glsl: Reduce processing of expression trees in do_structure_splitting.

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 |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/glsl/opt_structure_splitting.cpp b/src/glsl/opt_structure_splitting.cpp
index 014407c..2c1f6bb 100644
--- a/src/glsl/opt_structure_splitting.cpp
+++ b/src/glsl/opt_structure_splitting.cpp
@@ -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) {




More information about the mesa-commit mailing list