[Mesa-dev] [PATCH V6 09/27] i965: support atomic counter AoA

Timothy Arceri t_arceri at yahoo.com.au
Mon Sep 28 19:42:13 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 3443e5c..63c40ba 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2441,11 +2441,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