summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-02-10 12:09:19 -0800
committerMatt Turner <[email protected]>2014-02-11 16:05:55 -0800
commit025d99ce3cea21c9ecea77b95655c0c838b2fa3c (patch)
tree782886d4a6ee80e88de592595970fa18d51f0127 /src
parent4cffd3e791e4696ac672f2053b821937a2a5fb58 (diff)
glsl: Do not vectorize vector array dereferences.
Array dereferences must have scalar indices, so we cannot vectorize them. Cc: "10.1" <[email protected]> Reported-by: Andrew Guertin <[email protected]> Tested-by: Andrew Guertin <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/opt_vectorize.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/glsl/opt_vectorize.cpp b/src/glsl/opt_vectorize.cpp
index 8ee81f1a329..dba303d3131 100644
--- a/src/glsl/opt_vectorize.cpp
+++ b/src/glsl/opt_vectorize.cpp
@@ -82,6 +82,7 @@ public:
virtual ir_visitor_status visit_enter(ir_assignment *);
virtual ir_visitor_status visit_enter(ir_swizzle *);
+ virtual ir_visitor_status visit_enter(ir_dereference_array *);
virtual ir_visitor_status visit_enter(ir_if *);
virtual ir_visitor_status visit_enter(ir_loop *);
@@ -289,6 +290,19 @@ ir_vectorize_visitor::visit_enter(ir_swizzle *ir)
return visit_continue;
}
+/* Upon entering an ir_array_dereference, remove the current assignment from
+ * further consideration. Since the index of an array dereference must scalar,
+ * we are not able to vectorize it.
+ *
+ * FINISHME: If all of scalar indices are identical we could vectorize.
+ */
+ir_visitor_status
+ir_vectorize_visitor::visit_enter(ir_dereference_array *ir)
+{
+ this->current_assignment = NULL;
+ return visit_continue_with_parent;
+}
+
/* Since there is no statement to visit between the "then" and "else"
* instructions try to vectorize before, in between, and after them to avoid
* combining statements from different basic blocks.