From: Eric Anholt Date: Wed, 19 May 2010 22:50:02 +0000 (-0700) Subject: ir_to_mesa: Add sin/cos. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c5979565facebc82000a611b991d2977b8e9bbf;p=mesa.git ir_to_mesa: Add sin/cos. --- 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); }