summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-05-19 15:50:02 -0700
committerEric Anholt <[email protected]>2010-06-24 15:05:20 -0700
commit3c5979565facebc82000a611b991d2977b8e9bbf (patch)
tree8d2a2430b91d366482a4d3ae0be3a0abe4ed1610
parent2c432637d0960aa522ccd09416ba1d8a65c6988b (diff)
ir_to_mesa: Add sin/cos.
-rw-r--r--ir_to_mesa.cpp6
-rw-r--r--mesa_codegen.brg16
2 files changed, 22 insertions, 0 deletions
diff --git a/ir_to_mesa.cpp b/ir_to_mesa.cpp
index 67c79b66ee5..205e2fc8c95 100644
--- a/ir_to_mesa.cpp
+++ b/ir_to_mesa.cpp
@@ -430,6 +430,12 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
case ir_unop_log2:
this->result = this->create_tree(MB_TERM_log2_vec4, ir, op[0], NULL);
break;
+ case ir_unop_sin:
+ this->result = this->create_tree(MB_TERM_sin_vec4, ir, op[0], NULL);
+ break;
+ case ir_unop_cos:
+ this->result = this->create_tree(MB_TERM_cos_vec4, ir, op[0], NULL);
+ break;
case ir_binop_add:
this->result = this->create_tree(MB_TERM_add_vec4_vec4, ir, op[0], op[1]);
break;
diff --git a/mesa_codegen.brg b/mesa_codegen.brg
index a0ab7c86305..fc59a834f05 100644
--- a/mesa_codegen.brg
+++ b/mesa_codegen.brg
@@ -53,6 +53,8 @@
%term exp2_vec4
%term log_vec4
%term log2_vec4
+%term sin_vec4
+%term cos_vec4
%term add_vec4_vec4
%term sub_vec4_vec4
%term mul_vec4_vec4
@@ -157,6 +159,20 @@ vec4: swizzle_vec4(vec4) 1
reg);
}
+vec4: sin_vec4(vec4) 1
+{
+ ir_to_mesa_emit_scalar_op1(tree, OPCODE_SIN,
+ tree->dst_reg,
+ tree->left->src_reg);
+}
+
+vec4: cos_vec4(vec4) 1
+{
+ ir_to_mesa_emit_scalar_op1(tree, OPCODE_COS,
+ tree->dst_reg,
+ tree->left->src_reg);
+}
+
vec4: add_vec4_vec4(vec4, vec4) 1 { ir_to_mesa_emit_op2(tree, OPCODE_ADD); }
vec4: sub_vec4_vec4(vec4, vec4) 1 { ir_to_mesa_emit_op2(tree, OPCODE_SUB); }
vec4: mul_vec4_vec4(vec4, vec4) 1 { ir_to_mesa_emit_op2(tree, OPCODE_MUL); }