glsl: Fixed vectorize pass vs. texture lookups.
authorAras Pranckevicius <aras@unity3d.com>
Wed, 13 Aug 2014 17:40:05 +0000 (20:40 +0300)
committerMatt Turner <mattst88@gmail.com>
Thu, 14 Aug 2014 16:40:33 +0000 (09:40 -0700)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82574
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/glsl/opt_vectorize.cpp

index 28534a86ade10a04e19c4020422c25e494ba78c0..2f71a83583b1f5f7c4078cd7f6d6895afe9d94e3 100644 (file)
@@ -86,6 +86,7 @@ public:
    virtual ir_visitor_status visit_enter(ir_expression *);
    virtual ir_visitor_status visit_enter(ir_if *);
    virtual ir_visitor_status visit_enter(ir_loop *);
+   virtual ir_visitor_status visit_enter(ir_texture *);
 
    virtual ir_visitor_status visit_leave(ir_assignment *);
 
@@ -351,6 +352,18 @@ ir_vectorize_visitor::visit_enter(ir_loop *ir)
    return visit_continue_with_parent;
 }
 
+/**
+ * Upon entering an ir_texture, remove the current assignment from
+ * further consideration. Vectorizing multiple texture lookups into one
+ * is wrong.
+ */
+ir_visitor_status
+ir_vectorize_visitor::visit_enter(ir_texture *)
+{
+   this->current_assignment = NULL;
+   return visit_continue_with_parent;
+}
+
 /**
  * Upon leaving an ir_assignment, save a pointer to it in ::assignment[] if
  * the swizzle mask(s) found were appropriate. Also save a pointer in