diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-07-22 10:17:30 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2021-07-22 10:17:30 +0000 |
commit | ca11beabae33eb59fb981b8adf50b1d47a2a98f0 (patch) | |
tree | 3e4691a396e6e54cd54224a190663d5cf976625b /lib/mesa/src/compiler/glsl/ir_array_refcount.cpp | |
parent | 27c8a50e8bbde7d28b1fc46d715a4c469e24f2c4 (diff) |
Import Mesa 21.1.5
Diffstat (limited to 'lib/mesa/src/compiler/glsl/ir_array_refcount.cpp')
-rw-r--r-- | lib/mesa/src/compiler/glsl/ir_array_refcount.cpp | 52 |
1 files changed, 3 insertions, 49 deletions
diff --git a/lib/mesa/src/compiler/glsl/ir_array_refcount.cpp b/lib/mesa/src/compiler/glsl/ir_array_refcount.cpp index c2295c96c..0c18c7e0e 100644 --- a/lib/mesa/src/compiler/glsl/ir_array_refcount.cpp +++ b/lib/mesa/src/compiler/glsl/ir_array_refcount.cpp @@ -75,54 +75,6 @@ ir_array_refcount_entry::~ir_array_refcount_entry() delete [] bits; } - -void -ir_array_refcount_entry::mark_array_elements_referenced(const array_deref_range *dr, - unsigned count) -{ - if (count != array_depth) - return; - - mark_array_elements_referenced(dr, count, 1, 0); -} - -void -ir_array_refcount_entry::mark_array_elements_referenced(const array_deref_range *dr, - unsigned count, - unsigned scale, - unsigned linearized_index) -{ - /* Walk through the list of array dereferences in least- to - * most-significant order. Along the way, accumulate the current - * linearized offset and the scale factor for each array-of-. - */ - for (unsigned i = 0; i < count; i++) { - if (dr[i].index < dr[i].size) { - linearized_index += dr[i].index * scale; - scale *= dr[i].size; - } else { - /* For each element in the current array, update the count and - * offset, then recurse to process the remaining arrays. - * - * There is some inefficency here if the last element in the - * array_deref_range list specifies the entire array. In that case, - * the loop will make recursive calls with count == 0. In the call, - * all that will happen is the bit will be set. - */ - for (unsigned j = 0; j < dr[i].size; j++) { - mark_array_elements_referenced(&dr[i + 1], - count - (i + 1), - scale * dr[i].size, - linearized_index + (j * scale)); - } - - return; - } - } - - BITSET_SET(bits, linearized_index); -} - ir_array_refcount_entry * ir_array_refcount_visitor::get_variable_entry(ir_variable *var) { @@ -224,7 +176,9 @@ ir_array_refcount_visitor::visit_enter(ir_dereference_array *ir) if (entry == NULL) return visit_stop; - entry->mark_array_elements_referenced(derefs, num_derefs); + link_util_mark_array_elements_referenced(derefs, num_derefs, + entry->array_depth, + entry->bits); return visit_continue; } |