summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-09-01 21:12:10 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-09-09 15:39:51 -0700
commit3a5ce85cfa4914711e56c8cf831699242618928e (patch)
tree524740df447147a9269d02dea9c599f2c38534af /src
parent6dcca5a308efd7a85caa52f970ed020926c487e9 (diff)
glsl2: Add ir_unop_noise
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ir.cpp3
-rw-r--r--src/glsl/ir.h2
-rw-r--r--src/mesa/program/ir_to_mesa.cpp10
3 files changed, 15 insertions, 0 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 9ac24858958..b0945431ada 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -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",
"+",
"-",
"*",
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 0d933024df0..80a647e0dc2 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -650,6 +650,8 @@ enum ir_expression_operation {
ir_unop_dFdy,
/*@}*/
+ ir_unop_noise,
+
ir_binop_add,
ir_binop_sub,
ir_binop_mul,
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index caa906abfad..7307c8506c0 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -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;