void emit_assignment_writes(fs_reg &l, fs_reg &r,
const glsl_type *type, bool predicated);
void resolve_ud_negate(fs_reg *reg);
+ void resolve_bool_comparison(ir_rvalue *rvalue, fs_reg *reg);
struct brw_reg interp_reg(int location, int channel);
int setup_uniform_values(int loc, const glsl_type *type);
resolve_ud_negate(&op[0]);
resolve_ud_negate(&op[1]);
+ resolve_bool_comparison(ir->operands[0], &op[0]);
+ resolve_bool_comparison(ir->operands[1], &op[1]);
+
inst = emit(BRW_OPCODE_CMP, temp, op[0], op[1]);
inst->conditional_mod = brw_conditional_for_comparison(ir->operation);
break;
case ir_binop_all_equal:
case ir_binop_nequal:
case ir_binop_any_nequal:
+ resolve_bool_comparison(expr->operands[0], &op[0]);
+ resolve_bool_comparison(expr->operands[1], &op[1]);
+
inst = emit(BRW_OPCODE_CMP, reg_null_cmp, op[0], op[1]);
inst->conditional_mod =
brw_conditional_for_comparison(expr->operation);
emit(BRW_OPCODE_MOV, temp, *reg);
*reg = temp;
}
+
+void
+fs_visitor::resolve_bool_comparison(ir_rvalue *rvalue, fs_reg *reg)
+{
+ if (rvalue->type != glsl_type::bool_type)
+ return;
+
+ fs_reg temp = fs_reg(this, glsl_type::bool_type);
+ emit(BRW_OPCODE_AND, temp, *reg, fs_reg(1));
+ *reg = temp;
+}