There were only two users. Replace each with nir_fneu instead.
This is now a squash of what was two separate commits.
nir_lower_pstipple_block is called after nir_lower_bool_to_int32, so
nir_fneu32 has to be used here or there will be regresssions in stipple
tests on llvmpipe.
v2: Rebase on !20869.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Suggested-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20509>
}
static inline nir_ssa_def *
-nir_f2b(nir_builder *b, nir_ssa_def *src)
-{
- return nir_type_convert(b, src, nir_type_float, nir_type_bool1,
- nir_rounding_mode_undef);
-}
-
-static inline nir_ssa_def *
nir_i2b(nir_builder *b, nir_ssa_def *src)
{
return nir_ine(b, src, nir_imm_intN_t(b, 0, src->bit_size));
nir_builder_instr_insert(b, &tex->instr);
/* kill if tex != 0.0.. take .x or .w channel according to format: */
- cond = nir_f2b(b, nir_channel(b, &tex->dest.ssa,
- options->swizzle_xxxx ? 0 : 3));
+ cond = nir_fneu(b, nir_channel(b, &tex->dest.ssa,
+ options->swizzle_xxxx ? 0 : 3),
+ nir_imm_floatN_t(b, 0.0, tex->dest.ssa.bit_size));
nir_discard_if(b, cond);
nir_builder_instr_insert(b, &tex->instr);
- nir_ssa_def *condition = nir_f2b32(b, nir_channel(b, &tex->dest.ssa, 3));
+ nir_ssa_def *condition;
switch (state->bool_type) {
case nir_type_bool1:
- condition = nir_f2b(b, nir_channel(b, &tex->dest.ssa, 3));
+ condition = nir_fneu(b, nir_channel(b, &tex->dest.ssa, 3),
+ nir_imm_floatN_t(b, 0.0, tex->dest.ssa.bit_size));
break;
case nir_type_bool32:
- condition = nir_f2b32(b, nir_channel(b, &tex->dest.ssa, 3));
+ condition = nir_fneu32(b, nir_channel(b, &tex->dest.ssa, 3),
+ nir_imm_floatN_t(b, 0.0, tex->dest.ssa.bit_size));
break;
default:
unreachable("Invalid Boolean type.");