summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBryan Cain <[email protected]>2011-07-27 16:36:10 -0500
committerBryan Cain <[email protected]>2011-08-01 17:59:10 -0500
commit3e7fce9773ec332665326a785b6ed1fcf5bd578e (patch)
tree01f4b923813c32a11f86fcdc0062af926599c1da /src/mesa/state_tracker
parent10d31cb307f90a08fafed5c67945ffe53d279940 (diff)
glsl_to_tgsi: add each relative address to the previous
This is a glsl_to_tgsi port of commit d6e1a8f71437.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 0cbfc943a05..f66e240a177 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1741,6 +1741,18 @@ glsl_to_tgsi_visitor::visit(ir_dereference_array *ir)
this->result, st_src_reg_for_float(element_size));
}
+ /* If there was already a relative address register involved, add the
+ * new and the old together to get the new offset.
+ */
+ if (src.reladdr != NULL) {
+ st_src_reg accum_reg = get_temp(glsl_type::float_type);
+
+ emit(ir, TGSI_OPCODE_ADD, st_dst_reg(accum_reg),
+ index_reg, *src.reladdr);
+
+ index_reg = accum_reg;
+ }
+
src.reladdr = ralloc(mem_ctx, st_src_reg);
memcpy(src.reladdr, &index_reg, sizeof(index_reg));
}