diff options
author | Ian Romanick <[email protected]> | 2016-12-13 20:31:19 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2016-12-19 15:55:43 -0800 |
commit | 8d499f60c88b70a39f53d0fbe96a6ada6fd36b8b (patch) | |
tree | 33c8ef6bef24eff0dac91aa4b614ded7178c12f8 /src/compiler/glsl/ir_array_refcount.cpp | |
parent | b7053b80f27091acc8ccc954db99197e3073bff4 (diff) |
glsl: Add structures to track accessed elements of a single array
Signed-off-by: Ian Romanick <[email protected]>
Cc: [email protected]
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ir_array_refcount.cpp')
-rw-r--r-- | src/compiler/glsl/ir_array_refcount.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/compiler/glsl/ir_array_refcount.cpp b/src/compiler/glsl/ir_array_refcount.cpp index 36b22742fa8..1b5c43c9927 100644 --- a/src/compiler/glsl/ir_array_refcount.cpp +++ b/src/compiler/glsl/ir_array_refcount.cpp @@ -34,6 +34,7 @@ #include "util/hash_table.h" ir_array_refcount_visitor::ir_array_refcount_visitor() + : derefs(0), num_derefs(0), derefs_size(0) { this->mem_ctx = ralloc_context(NULL); this->ht = _mesa_hash_table_create(NULL, _mesa_hash_pointer, @@ -84,6 +85,26 @@ ir_array_refcount_visitor::get_variable_entry(ir_variable *var) } +array_deref_range * +ir_array_refcount_visitor::get_array_deref() +{ + if ((num_derefs + 1) * sizeof(array_deref_range) > derefs_size) { + void *ptr = reralloc_size(mem_ctx, derefs, derefs_size + 4096); + + if (ptr == NULL) + return NULL; + + derefs_size += 4096; + derefs = (array_deref_range *)ptr; + } + + array_deref_range *d = &derefs[num_derefs]; + num_derefs++; + + return d; +} + + ir_visitor_status ir_array_refcount_visitor::visit(ir_dereference_variable *ir) { |