From cb69d019cfbdaa2c4bbfd73031fa1867b593178c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Apr 2025 12:40:14 -0700 Subject: [PATCH] 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 38b58e286fa, 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 Fixes: 38b58e286fa ("brw/nir: Fix source handling of nir_intrinsic_load_barycentric_at_offset") Closes: #12969 Part-of: --- src/intel/compiler/brw_from_nir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_from_nir.cpp b/src/intel/compiler/brw_from_nir.cpp index 4ba0c814356..4a9fd0b3289 100644 --- a/src/intel/compiler/brw_from_nir.cpp +++ b/src/intel/compiler/brw_from_nir.cpp @@ -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));