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. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49621 Signed-off-by: Chad Versace <chad.vers...@linux.intel.com> --- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 4b9330b..a153224 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -475,20 +475,19 @@ fs_visitor::visit(ir_expression *ir) emit(BRW_OPCODE_AND, temp, op[0], fs_reg(1)); emit(BRW_OPCODE_MOV, this->result, temp); break; - case ir_unop_f2b: + temp = fs_reg(this, glsl_type::int_type); + inst = emit(BRW_OPCODE_CMP, temp, op[0], fs_reg(0.0f)); + inst->conditional_mod = BRW_CONDITIONAL_NEQ; + emit(BRW_OPCODE_AND, this->result, temp, fs_reg(1)); + break; 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->conditional_mod = BRW_CONDITIONAL_NZ; + temp = fs_reg(this, glsl_type::int_type); + inst = emit(BRW_OPCODE_CMP, temp, op[0], fs_reg(0)); + inst->conditional_mod = BRW_CONDITIONAL_NEQ; + emit(BRW_OPCODE_AND, this->result, temp, fs_reg(1)); break; - case ir_unop_trunc: emit(BRW_OPCODE_RNDZ, this->result, op[0]); break; -- 1.7.10.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev