diff options
author | Dave Airlie <[email protected]> | 2016-02-05 12:00:38 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2016-02-09 10:52:09 +1000 |
commit | b74e8c89a684c5c632df9b39f15585de584148c1 (patch) | |
tree | 1c9d0ff3d1970a314236c204e0f14ed9510b9fe1 /src/mesa | |
parent | 90bbe3d781ce15ecd6316ee63f431a82c311878e (diff) |
st/mesa: add atomic AoA support
reuse the sampler deref handling code to do the same
thing for atomics.
Acked-by: Ilia Mirkin <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index ea59d78e154..ce93aec4e71 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3160,19 +3160,17 @@ glsl_to_tgsi_visitor::visit_atomic_counter_intrinsic(ir_call *ir) /* Calculate the surface offset */ st_src_reg offset; - ir_dereference_array *deref_array = deref->as_dereference_array(); + unsigned array_size = 0, base = 0, index = 0; - if (deref_array) { - offset = get_temp(glsl_type::uint_type); - - deref_array->array_index->accept(this); + get_deref_offsets(deref, &array_size, &base, &index, &offset); + if (offset.file != PROGRAM_UNDEFINED) { emit_asm(ir, TGSI_OPCODE_MUL, st_dst_reg(offset), - this->result, st_src_reg_for_int(ATOMIC_COUNTER_SIZE)); + offset, st_src_reg_for_int(ATOMIC_COUNTER_SIZE)); emit_asm(ir, TGSI_OPCODE_ADD, st_dst_reg(offset), - offset, st_src_reg_for_int(location->data.offset)); + offset, st_src_reg_for_int(location->data.offset + index * ATOMIC_COUNTER_SIZE)); } else { - offset = st_src_reg_for_int(location->data.offset); + offset = st_src_reg_for_int(location->data.offset + index * ATOMIC_COUNTER_SIZE); } ir->return_deref->accept(this); |