glsl2: Add ir_unop_noise

This commit is contained in:
Ian Romanick 2010-09-01 21:12:10 -07:00
parent 6dcca5a308
commit 3a5ce85cfa
3 changed files with 15 additions and 0 deletions

View file

@ -196,6 +196,8 @@ ir_expression::get_num_operands(ir_expression_operation op)
1, /* ir_unop_dFdx */
1, /* ir_unop_dFdy */
1, /* ir_unop_noise */
2, /* ir_binop_add */
2, /* ir_binop_sub */
2, /* ir_binop_mul */
@ -261,6 +263,7 @@ static const char *const operator_strs[] = {
"cos",
"dFdx",
"dFdy",
"noise",
"+",
"-",
"*",

View file

@ -650,6 +650,8 @@ enum ir_expression_operation {
ir_unop_dFdy,
/*@}*/
ir_unop_noise,
ir_binop_add,
ir_binop_sub,
ir_binop_mul,

View file

@ -1154,6 +1154,16 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
ir_to_mesa_emit_op1(ir, OPCODE_DDY, result_dst, op[0]);
break;
case ir_unop_noise: {
const enum prog_opcode opcode =
prog_opcode(OPCODE_NOISE1
+ (ir->operands[0]->type->vector_elements) - 1);
assert((opcode >= OPCODE_NOISE1) && (opcode <= OPCODE_NOISE4));
ir_to_mesa_emit_op1(ir, opcode, result_dst, op[0]);
break;
}
case ir_binop_add:
ir_to_mesa_emit_op2(ir, OPCODE_ADD, result_dst, op[0], op[1]);
break;