glsl: Implement type inferencing of matrix types.
authorMatt Turner <mattst88@gmail.com>
Fri, 27 Mar 2015 17:45:07 +0000 (10:45 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 31 Mar 2015 21:01:15 +0000 (14:01 -0700)
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/glsl/ir.cpp

index 54656f89933feda6745eee3f6f7701790cf60619..4b8ca9b0f85f9a342388caf47fd794d2fba5c1a7 100644 (file)
@@ -380,10 +380,12 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1)
       } else if (op1->type->is_scalar()) {
         this->type = op0->type;
       } else {
-        /* FINISHME: matrix types */
-        assert(!op0->type->is_matrix() && !op1->type->is_matrix());
-        assert(op0->type == op1->type);
-        this->type = op0->type;
+         if (this->operation == ir_binop_mul) {
+            this->type = glsl_type::get_mul_type(op0->type, op1->type);
+         } else {
+            assert(op0->type == op1->type);
+            this->type = op0->type;
+         }
       }
       break;