diff options
author | Francisco Jerez <[email protected]> | 2016-05-16 17:19:17 -0700 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2016-05-27 23:19:20 -0700 |
commit | b736e78ddbafc8f3d45ab110cef618c1514e9c64 (patch) | |
tree | 4c4e786b7129ece0305fbef8a495c92fc0c1d19f /src | |
parent | 2db9dd5aeb9566c8480651989981cb1169957748 (diff) |
i965/fs: Fix byte_offset() for MRF/ARF/FIXED_GRF regs.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_ir_fs.h | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h index 3d47b0c34e4..e8f1d5353da 100644 --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h @@ -80,29 +80,35 @@ retype(fs_reg reg, enum brw_reg_type type) static inline fs_reg byte_offset(fs_reg reg, unsigned delta) { - reg.subreg_offset += delta; - switch (reg.file) { case BAD_FILE: break; case VGRF: case ATTR: - reg.reg_offset += reg.subreg_offset / 32; + case UNIFORM: { + const unsigned reg_size = (reg.file == UNIFORM ? 4 : REG_SIZE); + const unsigned suboffset = reg.subreg_offset + delta; + reg.reg_offset += suboffset / reg_size; + reg.subreg_offset = suboffset % reg_size; break; - case MRF: - reg.nr += delta / 32; + } + case MRF: { + const unsigned suboffset = reg.subreg_offset + delta; + reg.nr += suboffset / REG_SIZE; + reg.subreg_offset = suboffset % REG_SIZE; break; - case UNIFORM: - reg.reg_offset += reg.subreg_offset / 4; - reg.subreg_offset %= 4; - return reg; + } case ARF: - case FIXED_GRF: + case FIXED_GRF: { + const unsigned suboffset = reg.subnr + delta; + reg.nr += suboffset / REG_SIZE; + reg.subnr = suboffset % REG_SIZE; + break; + } case IMM: default: assert(delta == 0); } - reg.subreg_offset %= 32; return reg; } |