i965/vs: Add support for if(any(bvec)) on gen6.
authorEric Anholt <eric@anholt.net>
Wed, 10 Aug 2011 21:13:23 +0000 (14:13 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 16 Aug 2011 20:04:43 +0000 (13:04 -0700)
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index 2a1f003b5ce97789e3c166ac0452ea0a3df09293..d188857959718fa3a7ece9fca0855fb45f4d3c59 100644 (file)
@@ -564,10 +564,6 @@ vec4_visitor::emit_if_gen6(ir_if *ir)
 
       assert(expr->get_num_operands() <= 2);
       for (unsigned int i = 0; i < expr->get_num_operands(); i++) {
-        assert(expr->operands[i]->type->is_scalar() ||
-               expr->operation == ir_binop_any_nequal ||
-               expr->operation == ir_binop_all_equal);
-
         expr->operands[i]->accept(this);
         op[i] = this->result;
       }
@@ -634,6 +630,14 @@ vec4_visitor::emit_if_gen6(ir_if *ir)
         inst->predicate = BRW_PREDICATE_ALIGN16_ANY4H;
         return;
 
+      case ir_unop_any:
+        inst = emit(BRW_OPCODE_CMP, dst_null_d(), op[0], src_reg(0));
+        inst->conditional_mod = BRW_CONDITIONAL_NZ;
+
+        inst = emit(BRW_OPCODE_IF);
+        inst->predicate = BRW_PREDICATE_ALIGN16_ANY4H;
+        return;
+
       default:
         assert(!"not reached");
         inst = emit(BRW_OPCODE_IF, dst_null_d(), op[0], src_reg(0));