[Mesa-dev] [PATCH] glsl: Fixed vectorize pass vs. texture lookups
Aras Pranckevicius
aras at unity3d.com
Thu Aug 14 01:28:01 PDT 2014
Attached patch fixes GLSL vectorization optimization going wrong on some
texture lookups, see https://bugs.freedesktop.org/show_bug.cgi?id=82574
--
Aras Pranckevičius
work: http://unity3d.com
home: http://aras-p.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140814/ab8bb01c/attachment.html>
-------------- next part --------------
From 9c592e2d0216e1b17f303be3ae1505b209abd5b3 Mon Sep 17 00:00:00 2001
From: Aras Pranckevicius <aras at unity3d.com>
Date: Wed, 13 Aug 2014 20:40:05 +0300
Subject: [PATCH] glsl: Fixed vectorize pass vs. texture lookups
https://bugs.freedesktop.org/show_bug.cgi?id=82574
---
src/glsl/opt_vectorize.cpp | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/glsl/opt_vectorize.cpp b/src/glsl/opt_vectorize.cpp
index 826de5f..aa24043 100644
--- a/src/glsl/opt_vectorize.cpp
+++ b/src/glsl/opt_vectorize.cpp
@@ -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 *);
@@ -354,6 +355,18 @@ ir_vectorize_visitor::visit_enter(ir_loop *ir)
}
/**
+ * 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
* ::last_assignment so that we can compare future assignments with it.
--
1.8.4.2
More information about the mesa-dev
mailing list