From: Francisco Jerez Date: Wed, 22 Apr 2015 11:46:17 +0000 (+0300) Subject: i965/fs: Fix offset() for registers with zero stride. X-Git-Tag: upstream/17.1.0~18871 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4171ef371a25fccf9e96c0908a4848ea79dcfef2;p=platform%2Fupstream%2Fmesa.git 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 --- diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h index f3dfe79..a98f4e3 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;