From bf9953335031b3de721245ec7a2986d0b4f70027 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 6 May 2010 17:38:27 -0700 Subject: ir_to_mesa: Introduce shorthand for common Mesa IR emit patterns. --- ir_to_mesa.cpp | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'ir_to_mesa.cpp') diff --git a/ir_to_mesa.cpp b/ir_to_mesa.cpp index 77a8822934..1bdb61801c 100644 --- a/ir_to_mesa.cpp +++ b/ir_to_mesa.cpp @@ -77,23 +77,40 @@ ir_to_mesa_emit_op3(struct mbtree *tree, enum prog_opcode op, ir_to_mesa_instruction * -ir_to_mesa_emit_op2(struct mbtree *tree, enum prog_opcode op, - ir_to_mesa_dst_reg dst, - ir_to_mesa_src_reg src0, - ir_to_mesa_src_reg src1) +ir_to_mesa_emit_op2_full(struct mbtree *tree, enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0, + ir_to_mesa_src_reg src1) { return ir_to_mesa_emit_op3(tree, op, dst, src0, src1, ir_to_mesa_undef); } ir_to_mesa_instruction * -ir_to_mesa_emit_op1(struct mbtree *tree, enum prog_opcode op, - ir_to_mesa_dst_reg dst, - ir_to_mesa_src_reg src0) +ir_to_mesa_emit_op2(struct mbtree *tree, enum prog_opcode op) +{ + return ir_to_mesa_emit_op2_full(tree, op, + tree->dst_reg, + tree->left->src_reg, + tree->right->src_reg); +} + +ir_to_mesa_instruction * +ir_to_mesa_emit_op1_full(struct mbtree *tree, enum prog_opcode op, + ir_to_mesa_dst_reg dst, + ir_to_mesa_src_reg src0) { return ir_to_mesa_emit_op3(tree, op, dst, src0, ir_to_mesa_undef, ir_to_mesa_undef); } +ir_to_mesa_instruction * +ir_to_mesa_emit_op1(struct mbtree *tree, enum prog_opcode op) +{ + return ir_to_mesa_emit_op1_full(tree, op, + tree->dst_reg, + tree->left->src_reg); +} + /** * Emits Mesa scalar opcodes to produce unique answers across channels. * @@ -131,9 +148,9 @@ ir_to_mesa_emit_scalar_op1(struct mbtree *tree, enum prog_opcode op, src.swizzle = MAKE_SWIZZLE4(src_swiz, src_swiz, src_swiz, src_swiz); - inst = ir_to_mesa_emit_op1(tree, op, - dst, - src); + inst = ir_to_mesa_emit_op1_full(tree, op, + dst, + src); inst->dst_reg.writemask = this_mask; done_mask |= this_mask; } -- cgit v1.2.3