[Mesa-dev] [PATCH 6/9] intel/fs: Use the new nir_src_is_const and friends
Kenneth Graunke
kenneth at whitecape.org
Wed Nov 7 18:20:10 UTC 2018
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 <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181107/838e2e55/attachment.sig>
More information about the mesa-dev
mailing list