diff options
author | Eric Anholt <[email protected]> | 2011-08-07 10:59:39 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-08-16 13:04:42 -0700 |
commit | 1ff4f11dd94711a498cde0330101c58636ef2741 (patch) | |
tree | e5decff4e75cd197b69df4d34f44db3d13978e90 /src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | |
parent | 314c2574ff6e562a6cfc5fb84980f092e495a948 (diff) |
i965/vs: Track the variable index of array accesses.
This isn't used currently, as we lower all array accesses.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index f90025c8e7e..8bd048ff459 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -37,6 +37,7 @@ src_reg::src_reg(dst_reg reg) this->reg = reg.reg; this->reg_offset = reg.reg_offset; this->type = reg.type; + this->reladdr = reg.reladdr; int swizzles[4]; int next_chan = 0; @@ -66,6 +67,7 @@ dst_reg::dst_reg(src_reg reg) this->reg_offset = reg.reg_offset; this->type = reg.type; this->writemask = WRITEMASK_XYZW; + this->reladdr = reg.reladdr; } vec4_instruction * @@ -1186,7 +1188,6 @@ vec4_visitor::visit(ir_dereference_array *ir) if (constant_index) { src.reg_offset += constant_index->value.i[0] * element_size; } else { -#if 0 /* Variable array index */ /* Variable index array dereference. It eats the "vec4" of the * base of the array and an index that offsets the Mesa register * index. @@ -1198,15 +1199,22 @@ vec4_visitor::visit(ir_dereference_array *ir) if (element_size == 1) { index_reg = this->result; } else { - index_reg = src_reg(this, glsl_type::float_type); + index_reg = src_reg(this, glsl_type::int_type); emit(BRW_OPCODE_MUL, dst_reg(index_reg), - this->result, src_reg_for_float(element_size)); + this->result, src_reg(element_size)); + } + + if (src.reladdr) { + src_reg temp = src_reg(this, glsl_type::int_type); + + emit(BRW_OPCODE_ADD, dst_reg(temp), *src.reladdr, index_reg); + + index_reg = temp; } src.reladdr = ralloc(mem_ctx, src_reg); memcpy(src.reladdr, &index_reg, sizeof(index_reg)); -#endif } /* If the type is smaller than a vec4, replicate the last channel out. */ |