diff options
author | Eric Anholt <[email protected]> | 2010-05-19 16:10:37 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-06-24 15:05:21 -0700 |
commit | c23c6c773a5c79b458e52ff42bd9f431c87d4036 (patch) | |
tree | 9fbe86cea05247880091a3f457aca7dfe79adcce | |
parent | 346daeca07d3c19c051799f96fa9f442262bd49f (diff) |
ir_to_mesa: Implement min and max expressions.
fixes glsl-orangebook-ch06-bump.frag.
-rw-r--r-- | ir_to_mesa.cpp | 6 | ||||
-rw-r--r-- | mesa_codegen.brg | 5 |
2 files changed, 11 insertions, 0 deletions
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); } + %% |