On Saturday, October 20, 2018 10:55:44 AM PST Jason Ekstrand wrote:
> @@ -553,14 +552,18 @@ fs_visitor::optimize_frontfacing_ternary(nir_alu_instr 
> *instr,
>     if (src0->intrinsic != nir_intrinsic_load_front_face)
>        return false;
>  
> -   nir_const_value *value1 = nir_src_as_const_value(instr->src[1].src);
> -   if (!value1 || fabsf(value1->f32[0]) != 1.0f)
> +   if (!nir_src_is_const(instr->src[1].src) ||
> +       !nir_src_is_const(instr->src[2].src))
>        return false;
>  
> -   nir_const_value *value2 = nir_src_as_const_value(instr->src[2].src);
> -   if (!value2 || fabsf(value2->f32[0]) != 1.0f)
> +   const float value1 = nir_src_as_float(instr->src[1].src);
> +   const float value2 = nir_src_as_float(instr->src[2].src);
> +   if (fabsf(value1) != 1.0f || fabsf(value2) != 1.0f)
>        return false;
>  
> +   /* nir_opt_algebraic should have gotten rid of bcsel(b, a, a) */
> +   assert(value1 == -value2);
> +

This is likely true, but it doesn't seem like this belongs in this
refactoring patch - we weren't doing it before, and no new code appears
to depend on the condition.  Normally I wouldn't mind, but I'm a bit
paranoid about float equality in assertions.  It's probably fine,
though, since we ensured fabsf is 1.0f earlier...

Patches 5-9 are:
Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to