i965/fs: Fix offset() for registers with zero stride.
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 22 Apr 2015 11:46:17 +0000 (14:46 +0300)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 12 May 2015 12:47:56 +0000 (15:47 +0300)
stride == 0 implies that the register has one channel per vector
component.

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_ir_fs.h

index f3dfe790f348e53b6a4ce293c02dcb1a7f3543f1..a98f4e3e14289aa23c81303b68f3a14e947a6b39 100644 (file)
@@ -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;