diff options
author | Francisco Jerez <currojerez@riseup.net> | 2016-09-01 12:42:20 -0700 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2016-09-14 14:50:52 -0700 |
commit | 86944e063ad40cac0860bfd85a3cc4e9a9805aa3 (patch) | |
tree | 23ce7c3356e4eb93e141d8a731c03459d3fb5bad /src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp | |
parent | 8ad5fb3a8fc5a6559909941447219a85c71e2471 (diff) | |
download | external_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_fs_saturate_propagation.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp index f59fdbd..60bb1c0 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp @@ -116,7 +116,8 @@ opt_saturate_propagation_local(fs_visitor *v, bblock_t *block) for (int i = 0; i < scan_inst->sources; i++) { if (scan_inst->src[i].file == VGRF && scan_inst->src[i].nr == inst->src[0].nr && - scan_inst->src[i].reg_offset == inst->src[0].reg_offset) { + scan_inst->src[i].offset / REG_SIZE == + inst->src[0].offset / REG_SIZE) { if (scan_inst->opcode != BRW_OPCODE_MOV || !scan_inst->saturate || scan_inst->src[0].abs || |