summaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_algebraic.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2014-06-24 19:12:24 -0700
committerIan Romanick <ian.d.romanick@intel.com>2014-06-25 10:56:32 -0700
commit316dafa27d237c9b70580d8fe4591792e939bcd6 (patch)
tree9c30819cd7e09196bb900e6cd922c0fdb74f5813 /src/glsl/opt_algebraic.cpp
parent4ccbbbdd741555174d78c4271610683f18fea661 (diff)
downloadexternal_mesa3d-316dafa27d237c9b70580d8fe4591792e939bcd6.zip
external_mesa3d-316dafa27d237c9b70580d8fe4591792e939bcd6.tar.gz
external_mesa3d-316dafa27d237c9b70580d8fe4591792e939bcd6.tar.bz2
glsl: Don't convert reductions of ivec to a dot-product
Mesa has an optimization that converts expressions like "v.x + v.y + v.z + v.w" into dot(v, 1.0). And therein lies the rub: the other operand to the dot-product is always a float... even if the vector is an ivec or uvec. This results in an assertion failure in ir_builder. If the base type of the operand is not float, don't try the optimization. Dot-product is not valid on integer data. Fixes piglit vs-integer-reduction.shader_test and OpenGL ES conformance test ES2-CTS.gtf.GL2Tests.glGetUniform.glGetUniform. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Christoph Brill <egore911@gmail.com>
Diffstat (limited to 'src/glsl/opt_algebraic.cpp')
-rw-r--r--src/glsl/opt_algebraic.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 448af6b..ac7514a 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -124,7 +124,9 @@ static ir_expression *
try_replace_with_dot(ir_expression *expr0, ir_expression *expr1, void *mem_ctx)
{
if (expr0 && expr0->operation == ir_binop_add &&
- expr1 && expr1->operation == ir_binop_add) {
+ expr0->type->is_float() &&
+ expr1 && expr1->operation == ir_binop_add &&
+ expr1->type->is_float()) {
ir_swizzle *x = expr0->operands[0]->as_swizzle();
ir_swizzle *y = expr0->operands[1]->as_swizzle();
ir_swizzle *z = expr1->operands[0]->as_swizzle();