Mesa (10.1): glsl: Try vectorizing when seeing a repeated assignment to a channel.
Carl Worth
cworth at kemper.freedesktop.org
Fri Apr 18 23:11:14 UTC 2014
Module: Mesa
Branch: 10.1
Commit: 9abd686e3f1b25fceda6649bb71f65731dc61c42
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9abd686e3f1b25fceda6649bb71f65731dc61c42
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Tue Apr 8 16:55:23 2014 -0700
glsl: Try vectorizing when seeing a repeated assignment to a channel.
When considering assignment expressions like:
v.x += u.x;
v.x += u.x;
the vectorizer would incorrectly keep going, attempting to find more
instructions to vectorize. It would overwrite the saved assignment
to point at the second one, and increment channels a second time,
resulting in try_vectorize thinking the expression was a vec2 instead of
a float.
Instead, if we see a repeated assignment to a channel, just try to
vectorize everything we've found so far. This clears the saved state
so it will start over.
Fixes Piglit's repeated-channel-assignments.vert.
Cc: "10.1" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
(cherry picked from commit ae2a03b5736037128fb071595717f300d5b3afd5)
---
src/glsl/opt_vectorize.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/glsl/opt_vectorize.cpp b/src/glsl/opt_vectorize.cpp
index 13faac0..5f5188d 100644
--- a/src/glsl/opt_vectorize.cpp
+++ b/src/glsl/opt_vectorize.cpp
@@ -260,6 +260,7 @@ ir_vectorize_visitor::visit_enter(ir_assignment *ir)
if (ir->condition ||
this->channels >= 4 ||
!single_channel_write_mask(ir->write_mask) ||
+ this->assignment[write_mask_to_swizzle(ir->write_mask)] != NULL ||
(lhs && !ir->lhs->equals(lhs)) ||
(rhs && !ir->rhs->equals(rhs, ir_type_swizzle))) {
try_vectorize();
More information about the mesa-commit
mailing list