pco: force image/texture array coordinate f2i32 conversions to be rtne

Signed-off-by: Simon Perretta <simon.perretta@imgtec.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36412>
This commit is contained in:
Simon Perretta 2025-03-01 18:59:39 +00:00 committed by Marge Bot
parent 4d201a16f9
commit ed652e10fc
3 changed files with 9 additions and 1 deletions

View file

@ -328,6 +328,8 @@ unop_numeric_convert_mp("f2u", tuint16, tfloat32)
unop_numeric_convert_mp("i2f", tfloat16, tint32)
unop_numeric_convert_mp("u2f", tfloat16, tuint32)
unop_numeric_convert("f2i32_rtne", tint32, tfloat32, "(int32_t)_mesa_roundevenf(src0)")
# Unary floating-point rounding operations.

View file

@ -190,7 +190,9 @@ static inline unsigned process_coords(nir_builder *b,
return num_comps;
*float_array_index = nir_channel(b, *float_coords, num_comps - 1);
*int_array_index = nir_channel(b, *int_coords, num_comps - 1);
*int_array_index = coords_are_float
? nir_f2i32_rtne(b, *float_array_index)
: nir_channel(b, *int_coords, num_comps - 1);
*float_coords = nir_trim_vector(b, *float_coords, num_comps - 1);
*int_coords = nir_trim_vector(b, *int_coords, num_comps - 1);

View file

@ -2242,6 +2242,10 @@ static pco_instr *trans_alu(trans_ctx *tctx, nir_alu_instr *alu)
.roundzero = true);
break;
case nir_op_f2i32_rtne:
instr = pco_pck(&tctx->b, dest, src[0], .pck_fmt = PCO_PCK_FMT_S32);
break;
case nir_op_f2u32:
instr = pco_pck(&tctx->b,
dest,