brw/nir: Use offset() for all uses of offs in emit_pixel_interpolater_alu_at_offset

This is necessary to appropriately uniformize the first component
access of a convergent vector. Without this, this is produced:

    load_payload(16) %18:D, 0d, 0d NoMask group0
    add(32) %21:F, %18+0.0:F, 0.5f
    add(32) %22:F, %18+2.0<0>:F, 0.5f

This is the correct code:

    load_payload(16) %18:D, 0d, 0d NoMask group0
    add(32) %21:F, %18+0.0<0>:F, 0.5f
    add(32) %22:F, %18+2.0<0>:F, 0.5f

Without 38b58e286f, the code generated was more incorrect, but happened
to work for this test case:

    load_payload(16) %18:D, 0d, 0d NoMask group0
    add(32) %21:F, %18+0.0<0>:F, 0.5f
    add(32) %22:F, %18+0.4<0>:F, 0.5f

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 38b58e286f ("brw/nir: Fix source handling of nir_intrinsic_load_barycentric_at_offset")
Closes: #12969
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34427>
This commit is contained in:
Ian Romanick 2025-04-08 12:40:14 -07:00 committed by Marge Bot
parent b5d1b0d7e3
commit cb69d019cf

View file

@ -2159,7 +2159,7 @@ emit_pixel_interpolater_alu_at_offset(const brw_builder &bld,
/* Account for half-pixel X/Y coordinate offset. */
const brw_reg off_x = bld.vgrf(BRW_TYPE_F);
bld.ADD(off_x, offs, brw_imm_f(0.5));
bld.ADD(off_x, offset(offs, bld, 0), brw_imm_f(0.5));
const brw_reg off_y = bld.vgrf(BRW_TYPE_F);
bld.ADD(off_y, offset(offs, bld, 1), brw_imm_f(0.5));