From: Eric Anholt Date: Wed, 19 May 2010 23:10:37 +0000 (-0700) Subject: ir_to_mesa: Implement min and max expressions. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c23c6c773a5c79b458e52ff42bd9f431c87d4036;p=mesa.git ir_to_mesa: Implement min and max expressions. fixes glsl-orangebook-ch06-bump.frag. --- diff --git a/ir_to_mesa.cpp b/ir_to_mesa.cpp index 4238d9a8c81..59ee3b29f0a 100644 --- a/ir_to_mesa.cpp +++ b/ir_to_mesa.cpp @@ -529,6 +529,12 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_unop_floor: this->result = this->create_tree(MB_TERM_floor_vec4, ir, op[0], NULL); break; + case ir_binop_min: + this->result = this->create_tree(MB_TERM_min_vec4_vec4, ir, op[0], op[1]); + break; + case ir_binop_max: + this->result = this->create_tree(MB_TERM_max_vec4_vec4, ir, op[0], op[1]); + break; default: break; } diff --git a/mesa_codegen.brg b/mesa_codegen.brg index 25c0c47c02f..d53ccf39070 100644 --- a/mesa_codegen.brg +++ b/mesa_codegen.brg @@ -74,6 +74,8 @@ %term sqrt_vec4 %term rsq_vec4 %term swizzle_vec4 +%term min_vec4_vec4 +%term max_vec4_vec4 # Each tree will produce stmt. Currently, the only production for # stmt is from an assign rule -- every statement tree from @@ -273,4 +275,7 @@ vec4: log2_vec4(vec4) 1 tree->left->src_reg); } +vec4: min_vec4_vec4(vec4, vec4) 1 { ir_to_mesa_emit_op2(tree, OPCODE_MIN); } +vec4: max_vec4_vec4(vec4, vec4) 1 { ir_to_mesa_emit_op2(tree, OPCODE_MAX); } + %%