summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2014-09-06 13:48:34 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2014-09-30 10:29:13 -0700
commitf0d43c09b2fa32db66b7b6dc13becb0c7d3edeea (patch)
tree70990b9349d0330ca1aa93ea5f2453e85298569b /src/mesa/drivers/dri/i965/brw_fs_cse.cpp
parent0089d025aa7f7497b3097c5067b589410cd40fbc (diff)
i965/fs: Use offset a lot more places
We have this wonderful offset() function for advancing registers, but we're not using it. Using offset() allows us to do some sanity checking and avoid manually touching fs_reg::reg_offset. In a few commits, we will make offset do even more nifty things for us. Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_cse.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_cse.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index ea8ecf323d..7edbe1915c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -212,10 +212,8 @@ fs_visitor::opt_cse_local(bblock_t *block)
fs_inst *copy;
if (written > 1) {
fs_reg *sources = ralloc_array(mem_ctx, fs_reg, written);
- for (int i = 0; i < written; i++) {
- sources[i] = tmp;
- sources[i].reg_offset = i;
- }
+ for (int i = 0; i < written; i++)
+ sources[i] = offset(tmp, i);
copy = LOAD_PAYLOAD(orig_dst, sources, written);
} else {
copy = MOV(orig_dst, tmp);
@@ -235,10 +233,8 @@ fs_visitor::opt_cse_local(bblock_t *block)
fs_inst *copy;
if (written > 1) {
fs_reg *sources = ralloc_array(mem_ctx, fs_reg, written);
- for (int i = 0; i < written; i++) {
- sources[i] = tmp;
- sources[i].reg_offset = i;
- }
+ for (int i = 0; i < written; i++)
+ sources[i] = offset(tmp, i);
copy = LOAD_PAYLOAD(dst, sources, written);
} else {
copy = MOV(dst, tmp);