glsl: Fix type-deduction for and/or/xor expressions
authorChad Versace <chad.versace@linux.intel.com>
Tue, 15 Jan 2013 20:16:12 +0000 (12:16 -0800)
committerChad Versace <chad.versace@linux.intel.com>
Fri, 25 Jan 2013 05:24:10 +0000 (21:24 -0800)
In ir_expression's constructor, the cases for {bit,logic}_{and,or,xor}
failed to handle the case when both operands were vectors.

Note: This is a candidate for the stable branches.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
src/glsl/ir.cpp

index bb02df37bf1950e508dfb91f5fb6bc06fcf9f16c..49ee2fe9ef4f32a7b4babfdaff2099b343153e3b 100644 (file)
@@ -378,10 +378,15 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1)
    case ir_binop_bit_and:
    case ir_binop_bit_xor:
    case ir_binop_bit_or:
+       assert(!op0->type->is_matrix());
+       assert(!op1->type->is_matrix());
       if (op0->type->is_scalar()) {
          this->type = op1->type;
       } else if (op1->type->is_scalar()) {
          this->type = op0->type;
+      } else {
+          assert(op0->type->vector_elements == op1->type->vector_elements);
+          this->type = op0->type;
       }
       break;