[Mesa-dev] [PATCH 5/7] glsl: Add "typeless" constructor for quadop ir_expressions

Kenneth Graunke kenneth at whitecape.org
Fri Jul 27 10:49:23 PDT 2012


From: Ian Romanick <ian.d.romanick at intel.com>

This matches the typeless constructors for unop and binop
ir_expressions.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/ir.cpp | 17 +++++++++++++++++
 src/glsl/ir.h   |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index b0e38d8..5faf34a 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -236,6 +236,23 @@ ir_expression::ir_expression(int op, const struct glsl_type *type,
    this->operands[3] = op3;
 }
 
+ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1,
+			     ir_rvalue *op2, ir_rvalue *op3)
+{
+   assert(op0->type->is_scalar());
+   assert((op0->type == op1->type)
+	  && (op0->type == op2->type)
+	  && (op0->type == op3->type));
+
+   this->ir_type = ir_type_expression;
+   this->type = glsl_type::get_instance(op0->type->base_type, 4, 1);
+   this->operation = ir_expression_operation(op);
+   this->operands[0] = op0;
+   this->operands[1] = op1;
+   this->operands[2] = op2;
+   this->operands[3] = op3;
+}
+
 ir_expression::ir_expression(int op, ir_rvalue *op0)
 {
    this->ir_type = ir_type_expression;
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 8506f60..e2743f6 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -1050,6 +1050,8 @@ public:
     */
    ir_expression(int op, const struct glsl_type *type,
 		 ir_rvalue *, ir_rvalue *, ir_rvalue *, ir_rvalue *);
+   ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1, ir_rvalue *op2,
+		 ir_rvalue *op3);
 
    virtual ir_expression *as_expression()
    {
-- 
1.7.11.3



More information about the mesa-dev mailing list