mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 09:20:13 +01:00
i965/fs: Fix conversions float->bool, int->bool
Fixes gles2conform GL.equal.equal_bvec2_frag. This fixes brw_fs_visitor's translation of ir_unop_f2b. It used CMP to convert the float to one of 0 or ~0. However, the convention in the compiler is that true is represented by 1, not ~0. This patch adds an AND to convert ~0 to 1. By inspection, a similar problem existed with ir_unop_i2b, with a similar fix. [v2 kayden]: eliminate extra temporary register. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49621 Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
This commit is contained in:
parent
345ee593e9
commit
cf0bbb30f6
1 changed files with 9 additions and 9 deletions
|
|
@ -477,16 +477,16 @@ fs_visitor::visit(ir_expression *ir)
|
|||
break;
|
||||
|
||||
case ir_unop_f2b:
|
||||
case ir_unop_i2b:
|
||||
temp = this->result;
|
||||
/* original gen4 does implicit conversion before comparison. */
|
||||
if (intel->gen < 5)
|
||||
temp.type = op[0].type;
|
||||
|
||||
resolve_ud_negate(&op[0]);
|
||||
|
||||
inst = emit(BRW_OPCODE_CMP, temp, op[0], fs_reg(0.0f));
|
||||
inst = emit(BRW_OPCODE_CMP, this->result, op[0], fs_reg(0.0f));
|
||||
inst->conditional_mod = BRW_CONDITIONAL_NZ;
|
||||
emit(BRW_OPCODE_AND, this->result, this->result, fs_reg(1));
|
||||
break;
|
||||
case ir_unop_i2b:
|
||||
assert(op[0].type == BRW_REGISTER_TYPE_D);
|
||||
|
||||
inst = emit(BRW_OPCODE_CMP, this->result, op[0], fs_reg(0));
|
||||
inst->conditional_mod = BRW_CONDITIONAL_NZ;
|
||||
emit(BRW_OPCODE_AND, this->result, this->result, fs_reg(1));
|
||||
break;
|
||||
|
||||
case ir_unop_trunc:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue