summaryrefslogtreecommitdiff
path: root/src/glsl/ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r--src/glsl/ir.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 1f5e2ebdcb..741e3cb177 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -200,18 +200,35 @@ ir_expression::ir_expression(int op, const struct glsl_type *type,
this->operation = ir_expression_operation(op);
this->operands[0] = op0;
this->operands[1] = NULL;
+ this->operands[2] = NULL;
+ this->operands[3] = NULL;
}
ir_expression::ir_expression(int op, const struct glsl_type *type,
ir_rvalue *op0, ir_rvalue *op1)
{
- assert((op1 == NULL) && (get_num_operands(ir_expression_operation(op)) == 1)
+ assert(((op1 == NULL) && (get_num_operands(ir_expression_operation(op)) == 1))
|| (get_num_operands(ir_expression_operation(op)) == 2));
this->ir_type = ir_type_expression;
this->type = type;
this->operation = ir_expression_operation(op);
this->operands[0] = op0;
this->operands[1] = op1;
+ this->operands[2] = NULL;
+ this->operands[3] = NULL;
+}
+
+ir_expression::ir_expression(int op, const struct glsl_type *type,
+ ir_rvalue *op0, ir_rvalue *op1,
+ ir_rvalue *op2, ir_rvalue *op3)
+{
+ this->ir_type = ir_type_expression;
+ this->type = type;
+ this->operation = ir_expression_operation(op);
+ this->operands[0] = op0;
+ this->operands[1] = op1;
+ this->operands[2] = op2;
+ this->operands[3] = op3;
}
unsigned int
@@ -225,6 +242,9 @@ ir_expression::get_num_operands(ir_expression_operation op)
if (op <= ir_last_binop)
return 2;
+ if (op == ir_quadop_vector)
+ return 4;
+
assert(false);
return 0;
}
@@ -287,12 +307,13 @@ static const char *const operator_strs[] = {
"min",
"max",
"pow",
+ "vector",
};
const char *ir_expression::operator_string(ir_expression_operation op)
{
assert((unsigned int) op < Elements(operator_strs));
- assert(Elements(operator_strs) == (ir_binop_pow + 1));
+ assert(Elements(operator_strs) == (ir_quadop_vector + 1));
return operator_strs[op];
}