ir_to_mesa: Implement min and max expressions.

fixes glsl-orangebook-ch06-bump.frag.
This commit is contained in:
Eric Anholt 2010-05-19 16:10:37 -07:00
parent 346daeca07
commit c23c6c773a
2 changed files with 11 additions and 0 deletions

View file

@ -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;
}

View file

@ -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); }
%%