summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2016-04-06 10:27:14 +0200
committerSamuel Iglesias Gonsálvez <[email protected]>2016-05-16 09:55:32 +0200
commit17decd940c1e105506db74e8539a77db271adbc5 (patch)
tree73cef29e31c8b19be8c8beba3aeddabcda94eaf7 /src/mesa
parent2fd79ebe8fe4f0f0397bba1624deed9fa4e7fc3b (diff)
i965/fs: fix subreg_offset overflow in byte_offset()
This can happen if the register already has a non-zero subreg_offset when byte_offset() is called. v2 (Sam): - Refactor byte_offset() (Jordan). Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_ir_fs.h10
1 files changed, 6 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 86acdb236a4..305d91cd4c2 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -80,19 +80,21 @@ 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 += delta / 32;
+ reg.reg_offset += reg.subreg_offset / 32;
break;
case MRF:
reg.nr += delta / 32;
break;
case UNIFORM:
- reg.reg_offset += delta / 4;
- reg.subreg_offset += delta % 4;
+ reg.reg_offset += reg.subreg_offset / 4;
+ reg.subreg_offset %= 4;
return reg;
case ARF:
case FIXED_GRF:
@@ -100,7 +102,7 @@ byte_offset(fs_reg reg, unsigned delta)
default:
assert(delta == 0);
}
- reg.subreg_offset += delta % 32;
+ reg.subreg_offset %= 32;
return reg;
}