From 4171ef371a25fccf9e96c0908a4848ea79dcfef2 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Wed, 22 Apr 2015 14:46:17 +0300 Subject: [PATCH] i965/fs: Fix offset() for registers with zero stride. stride == 0 implies that the register has one channel per vector component. Reviewed-by: Matt Turner --- src/mesa/drivers/dri/i965/brw_ir_fs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h index f3dfe790f34..a98f4e3e142 100644 --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h @@ -131,14 +131,15 @@ horiz_offset(fs_reg reg, unsigned delta) static inline fs_reg offset(fs_reg reg, unsigned delta) { - assert(reg.stride > 0); switch (reg.file) { case BAD_FILE: break; case GRF: case MRF: case ATTR: - return byte_offset(reg, delta * reg.width * reg.stride * type_sz(reg.type)); + return byte_offset(reg, + delta * MAX2(reg.width * reg.stride, 1) * + type_sz(reg.type)); case UNIFORM: reg.reg_offset += delta; break; -- 2.30.2