diff options
author | Eric Anholt <[email protected]> | 2012-04-23 16:48:09 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-05-04 14:00:32 -0700 |
commit | dc42910e98dc00760255cc4579da458de09175b9 (patch) | |
tree | 65f47bf39dd85bdd33dcfe15562bf1abb7c6d38e /src/mesa | |
parent | b2ee5a08bae6cdbbdafc1f1d9d6f3afbad2f7944 (diff) |
i965/fs: Fix regression in comparison handling from ANDs change.
I had fixed up the logic ops for delayed ANDing, but not equality
comparisons on bools. Fixes new piglit fs-bool-less-compare-true.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48629
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 6d9a042ff1b..6b45c4ece96 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -582,6 +582,7 @@ public: 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); diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index d4ebc79dbce..20d4c53a858 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -395,6 +395,9 @@ fs_visitor::visit(ir_expression *ir) 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; @@ -1542,6 +1545,9 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir) 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); @@ -2129,3 +2135,14 @@ fs_visitor::resolve_ud_negate(fs_reg *reg) 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; +} |