From 8c9601ef7b28b047af361126a8adc46c729493b2 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Tue, 17 May 2016 17:32:55 -0700 Subject: [PATCH] i965/fs: Fix horiz_offset() to handle ARF and HW GRF register files. We'll hit these in some cases during SIMD lowering in 32-wide programs. Reviewed-by: Jason Ekstrand --- src/mesa/drivers/dri/i965/brw_ir_fs.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h index cae41a02b8c..bb05a058a8c 100644 --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h @@ -113,7 +113,7 @@ byte_offset(fs_reg reg, unsigned delta) } static inline fs_reg -horiz_offset(fs_reg reg, unsigned delta) +horiz_offset(const fs_reg ®, unsigned delta) { switch (reg.file) { case BAD_FILE: @@ -121,17 +121,23 @@ horiz_offset(fs_reg reg, unsigned delta) case IMM: /* These only have a single component that is implicitly splatted. A * horizontal offset should be a harmless no-op. + * XXX - Handle vector immediates correctly. */ - break; + return reg; case VGRF: case MRF: case ATTR: return byte_offset(reg, delta * reg.stride * type_sz(reg.type)); case ARF: case FIXED_GRF: - assert(delta == 0); + if (reg.is_null()) { + return reg; + } else { + const unsigned stride = reg.hstride ? 1 << (reg.hstride - 1) : 0; + return byte_offset(reg, delta * stride * type_sz(reg.type)); + } } - return reg; + unreachable("Invalid register file"); } /** -- 2.30.2