[Mesa-dev] [PATCH 18/20] i965: support atomic counter AoA

Timothy Arceri t_arceri at yahoo.com.au
Wed Jul 29 06:57:00 PDT 2015


---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index bf17fe6..384deef 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2415,11 +2415,23 @@ vec4_visitor::visit_atomic_counter_intrinsic(ir_call *ir)
    src_reg offset(this, glsl_type::uint_type);
    ir_dereference_array *deref_array = deref->as_dereference_array();
    if (deref_array) {
-      deref_array->array_index->accept(this);
-
-      src_reg tmp(this, glsl_type::uint_type);
-      emit(MUL(dst_reg(tmp), this->result, ATOMIC_COUNTER_SIZE));
-      emit(ADD(dst_reg(offset), tmp, location->data.atomic.offset));
+      emit(MOV(dst_reg(offset), location->data.atomic.offset));
+      while (deref_array) {
+         deref_array->array_index->accept(this);
+
+         unsigned size;
+         if (deref_array->array->type->fields.array->is_array()) {
+            size =
+               deref_array->array->type->fields.array->arrays_of_arrays_size() *
+               ATOMIC_COUNTER_SIZE;
+         } else {
+            size = ATOMIC_COUNTER_SIZE;
+         }
+         src_reg tmp(this, glsl_type::uint_type);
+         emit(MUL(dst_reg(tmp), this->result, size));
+         emit(ADD(dst_reg(offset), tmp, offset));
+         deref_array = deref_array->array->as_dereference_array();
+      }
    } else {
       offset = location->data.atomic.offset;
    }
-- 
2.4.3



More information about the mesa-dev mailing list