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

Kenneth Graunke kenneth at whitecape.org
Mon Mar 23 15:25:47 PDT 2015


On Monday, March 23, 2015 12:15:17 PM Ian Romanick wrote:
> 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;
>           }
>        }
> 

LGTM

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150323/f65b1620/attachment.sig>


More information about the mesa-dev mailing list