[Mesa-dev] [PATCH] i965/fs: Fix inverted comparison

Ian Romanick idr at freedesktop.org
Mon Mar 23 12:15:17 PDT 2015


From: Ian Romanick <ian.d.romanick at intel.com>

Commit b616164 added an optimization of b2f generation of a comparison.
It also included an extra optimization of one of the comparison values
is a constant of zero.  The trick was that some value was known to be
zero, so that value could be used in the SEL instruction instead of
potentially loading 0.0 into a register.

This change switched the order of the arguments to the SEL, and, for
some unknown reason, I thought that the predicate should therefore
only be inverted for the == case.  Clearly, it should always be
inverted.

Fixes piglit fs-notEqual-of-expression.shader_test.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89722
---
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 2920a82..1bc8ec9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -538,7 +538,7 @@ fs_visitor::try_emit_b2f_of_comparison(ir_expression *ir)
 
             fs_inst *inst = emit(SEL(this->result, op[i ^ 1], fs_reg(1.0f)));
             inst->predicate = BRW_PREDICATE_NORMAL;
-            inst->predicate_inverse = cmp->operation == ir_binop_equal;
+            inst->predicate_inverse = true;
             return true;
          }
       }
-- 
2.1.0



More information about the mesa-dev mailing list