[Mesa-dev] [PATCH (gles3) 14/20] glsl: Fix type-deduction for and/or/xor expressions

Chad Versace chad.versace at linux.intel.com
Mon Jan 21 00:49:26 PST 2013


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.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/glsl/ir.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 9e4c7c9..d80ee3a 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -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;
 
-- 
1.8.1.1



More information about the mesa-dev mailing list