summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_builder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/ir_builder.cpp')
-rw-r--r--src/glsl/ir_builder.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index b549ff4f72b..e12ae3cf53f 100644
--- a/src/glsl/ir_builder.cpp
+++ b/src/glsl/ir_builder.cpp
@@ -231,6 +231,17 @@ ir_expression *dot(operand a, operand b)
return expr(ir_binop_dot, a, b);
}
+/* dot for vectors, mul for scalars */
+ir_expression *dotlike(operand a, operand b)
+{
+ assert(a.val->type == b.val->type);
+
+ if (a.val->type->vector_elements == 1)
+ return expr(ir_binop_mul, a, b);
+
+ return expr(ir_binop_dot, a, b);
+}
+
ir_expression*
clamp(operand a, operand b, operand c)
{