Mesa (7.9): glsl: Add unary ir_expression constructor
Ian Romanick
idr at kemper.freedesktop.org
Fri Dec 17 02:21:28 UTC 2010
Module: Mesa
Branch: 7.9
Commit: 5650cc462d693ee9a6443918d2357f0bfb8e921f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5650cc462d693ee9a6443918d2357f0bfb8e921f
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Tue Nov 9 14:19:10 2010 -0800
glsl: Add unary ir_expression constructor
(cherry picked from commit 13f57d42b6929f50d8ef8b4123f46a61c46fde7b)
---
src/glsl/ir.cpp | 13 +++++++++++++
src/glsl/ir.h | 8 ++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 4aa212e..844f847 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -177,8 +177,21 @@ ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs,
ir_expression::ir_expression(int op, const struct glsl_type *type,
+ ir_rvalue *op0)
+{
+ assert(get_num_operands(ir_expression_operation(op)) == 1);
+ this->ir_type = ir_type_expression;
+ this->type = type;
+ this->operation = ir_expression_operation(op);
+ this->operands[0] = op0;
+ this->operands[1] = 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)
+ || (get_num_operands(ir_expression_operation(op)) == 2));
this->ir_type = ir_type_expression;
this->type = type;
this->operation = ir_expression_operation(op);
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index d45e254..7b2fe77 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -790,6 +790,14 @@ enum ir_expression_operation {
class ir_expression : public ir_rvalue {
public:
+ /**
+ * Constructor for unary operation expressions
+ */
+ ir_expression(int op, const struct glsl_type *type, ir_rvalue *);
+
+ /**
+ * Constructor for binary operation expressions
+ */
ir_expression(int op, const struct glsl_type *type,
ir_rvalue *, ir_rvalue *);
More information about the mesa-commit
mailing list