summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlejandro SeguĂ­ <[email protected]>2015-08-03 02:15:20 +0200
committerTimothy Arceri <[email protected]>2015-08-04 12:31:05 +1000
commite23cbaadaac0c67a72b10e3dd14b75abc19ab3c5 (patch)
tree0a1561c9d2e7b31a97c035c3319c1d386e1ec936 /src
parent7ac946e546bba440f87ce95ef022745201744f9c (diff)
glsl: replace old hash table with new and faster one
The util/hash_table was intended to be a fast hash table replacement for the program/hash_table see 35fd61bd99c1 and 72e55bb6888ff. Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ir_print_visitor.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index 78475f39b78..8dbd938c58b 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -25,7 +25,7 @@
#include "glsl_types.h"
#include "glsl_parser_extras.h"
#include "main/macros.h"
-#include "program/hash_table.h"
+#include "util/hash_table.h"
static void print_type(FILE *f, const glsl_type *t);
@@ -89,14 +89,14 @@ ir_print_visitor::ir_print_visitor(FILE *f)
{
indentation = 0;
printable_names =
- hash_table_ctor(32, hash_table_pointer_hash, hash_table_pointer_compare);
+ _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal);
symbols = _mesa_symbol_table_ctor();
mem_ctx = ralloc_context(NULL);
}
ir_print_visitor::~ir_print_visitor()
{
- hash_table_dtor(printable_names);
+ _mesa_hash_table_destroy(printable_names, NULL);
_mesa_symbol_table_dtor(symbols);
ralloc_free(mem_ctx);
}
@@ -121,18 +121,22 @@ ir_print_visitor::unique_name(ir_variable *var)
}
/* Do we already have a name for this variable? */
- const char *name = (const char *) hash_table_find(this->printable_names, var);
- if (name != NULL)
- return name;
+ struct hash_entry * entry =
+ _mesa_hash_table_search(this->printable_names, var);
+
+ if (entry != NULL) {
+ return (const char *) entry->data;
+ }
/* If there's no conflict, just use the original name */
+ const char* name = NULL;
if (_mesa_symbol_table_find_symbol(this->symbols, -1, var->name) == NULL) {
name = var->name;
} else {
static unsigned i = 1;
name = ralloc_asprintf(this->mem_ctx, "%s@%u", var->name, ++i);
}
- hash_table_insert(this->printable_names, (void *) name, var);
+ _mesa_hash_table_insert(this->printable_names, var, (void *) name);
_mesa_symbol_table_add_symbol(this->symbols, -1, name, var);
return name;
}