glsl: Emit mul instead of dot if only one component left.
authorMatt Turner <mattst88@gmail.com>
Fri, 31 Oct 2014 17:33:17 +0000 (10:33 -0700)
committerMatt Turner <mattst88@gmail.com>
Mon, 3 Nov 2014 19:27:38 +0000 (11:27 -0800)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85683
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85691
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/opt_algebraic.cpp

index c8d1ba1e2f516f20c7509d12f5ad6d7dc7369642..a2d7e4919c4690af548dd77fedd03e6d05513f1d 100644 (file)
@@ -572,9 +572,12 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
          if (count >= op_const[i]->type->vector_elements)
             break;
 
+         ir_expression_operation op = count == 1 ?
+            ir_binop_mul : ir_binop_dot;
+
          /* Swizzle both operands to remove the channels that were zero. */
          return new(mem_ctx)
-            ir_expression(ir_binop_dot, glsl_type::float_type,
+            ir_expression(op, glsl_type::float_type,
                           new(mem_ctx) ir_swizzle(ir->operands[0],
                                                   components, count),
                           new(mem_ctx) ir_swizzle(ir->operands[1],