summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_ir_fs.h
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2016-09-01 12:42:20 -0700
committerFrancisco Jerez <currojerez@riseup.net>2016-09-14 14:50:52 -0700
commit86944e063ad40cac0860bfd85a3cc4e9a9805aa3 (patch)
tree23ce7c3356e4eb93e141d8a731c03459d3fb5bad /src/mesa/drivers/dri/i965/brw_ir_fs.h
parent8ad5fb3a8fc5a6559909941447219a85c71e2471 (diff)
downloadexternal_mesa3d-86944e063ad40cac0860bfd85a3cc4e9a9805aa3.zip
external_mesa3d-86944e063ad40cac0860bfd85a3cc4e9a9805aa3.tar.gz
external_mesa3d-86944e063ad40cac0860bfd85a3cc4e9a9805aa3.tar.bz2
i965/fs: Replace fs_reg::reg_offset with fs_reg::offset expressed in bytes.
The fs_reg::offset field in byte units introduced in this patch is a more straightforward alternative to the current register offset representation split between fs_reg::reg_offset and ::subreg_offset. The split representation makes it too easy to forget about one of the offsets while dealing with the other, which has led to multiple back-end bugs in the past. To make the matter worse the unit reg_offset was expressed in was rather inconsistent, for uniforms it would be expressed in either 4B or 16B units depending on the back-end, and for most other things it would be expressed in 32B units. This encodes reg_offset as a new offset field expressed consistently in byte units. Each rvalue reference of reg_offset in existing code like 'x = r.reg_offset' is rewritten to 'x = r.offset / reg_unit', and each lvalue reference like 'r.reg_offset = x' is rewritten to 'r.offset = r.offset % reg_unit + x * reg_unit'. Because the change affects a lot of places and is rather non-trivial to verify due to the inconsistent value of reg_unit, I've tried to avoid making any additional changes other than applying the rewrite rule above in order to keep the patch as simple as possible, sometimes at the cost of introducing obvious stupidity (e.g. algebraic expressions that could be simplified given some knowledge of the context) -- I'll clean those up later on in a second pass. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_ir_fs.h')
-rw-r--r--src/mesa/drivers/dri/i965/brw_ir_fs.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index dd5f82a..10da31e 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -88,7 +88,7 @@ byte_offset(fs_reg reg, unsigned delta)
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.offset += ROUND_DOWN_TO(suboffset, reg_size);
reg.subreg_offset = suboffset % reg_size;
break;
}
@@ -192,8 +192,8 @@ reg_space(const fs_reg &r)
static inline unsigned
reg_offset(const fs_reg &r)
{
- return ((r.file == VGRF || r.file == IMM ? 0 : r.nr) + r.reg_offset) *
- (r.file == UNIFORM ? 4 : REG_SIZE) + r.subreg_offset;
+ return (r.file == VGRF || r.file == IMM ? 0 : r.nr) *
+ (r.file == UNIFORM ? 4 : REG_SIZE) + r.offset + r.subreg_offset;
}
/**