return deref;
}
- uint32_t hash = _mesa_key_hash_string(name);
+ uint32_t hash = _mesa_hash_string(name);
struct hash_entry *h =
_mesa_hash_table_search_pre_hashed(state->remap_table, hash, name);
state.shader = shader;
state.shader_program = shader_program;
- state.remap_table = _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ state.remap_table = _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
nir_foreach_function(function, shader) {
parser = ralloc (NULL, glcpp_parser_t);
glcpp_lex_init_extra (parser, &parser->scanner);
- parser->defines = _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ parser->defines = _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
parser->linalloc = linear_alloc_parent(parser, 0);
parser->active = NULL;
public:
interface_block_definitions()
: mem_ctx(ralloc_context(NULL)),
- ht(_mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ ht(_mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal))
{
}
* the hash is organized by block-name.
*/
struct hash_table *block_hash =
- _mesa_hash_table_create(mem_ctx, _mesa_key_hash_string,
+ _mesa_hash_table_create(mem_ctx, _mesa_hash_string,
_mesa_key_string_equal);
if (block_hash == NULL) {
consumer ? consumer->Stage : MESA_SHADER_NONE);
void *hash_table_ctx = ralloc_context(NULL);
hash_table *tfeedback_candidates =
- _mesa_hash_table_create(hash_table_ctx, _mesa_key_hash_string,
+ _mesa_hash_table_create(hash_table_ctx, _mesa_hash_string,
_mesa_key_string_equal);
hash_table *consumer_inputs =
- _mesa_hash_table_create(hash_table_ctx, _mesa_key_hash_string,
+ _mesa_hash_table_create(hash_table_ctx, _mesa_hash_string,
_mesa_key_string_equal);
hash_table *consumer_interface_inputs =
- _mesa_hash_table_create(hash_table_ctx, _mesa_key_hash_string,
+ _mesa_hash_table_create(hash_table_ctx, _mesa_hash_string,
_mesa_key_string_equal);
ir_variable *consumer_inputs_with_locations[VARYING_SLOT_TESS_MAX] = {
NULL,
function_list(), added_functions(&function_list, mem_ctx)
{
functions = _mesa_hash_table_create(mem_ctx,
- _mesa_key_hash_string,
+ _mesa_hash_string,
_mesa_key_string_equal);
foreach_in_list(ir_instruction, node, instructions) {
void
flatten_named_interface_blocks_declarations::run(exec_list *instructions)
{
- interface_namespace = _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ interface_namespace = _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
/* First pass: adjust instance block variables with an instance name
hash_table_var_hash(const void *key)
{
const ir_variable * var = static_cast<const ir_variable *>(key);
- return _mesa_key_hash_string(var->name);
+ return _mesa_hash_string(var->name);
}
output_read_remover::output_read_remover(unsigned stage)
public:
string_to_uint_map()
{
- this->ht = _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ this->ht = _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
}
this->ir.make_empty();
this->consumer_inputs =
- _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
this->consumer_interface_inputs =
- _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
/* Needs to happen after glsl type initialization */
if (explicit_matrix_types == NULL) {
explicit_matrix_types =
- _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
}
assert(glsl_type_users > 0);
if (array_types == NULL) {
- array_types = _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ array_types = _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
}
state->fp = fp;
state->shader = shader;
state->ht = _mesa_pointer_hash_table_create(NULL);
- state->syms = _mesa_set_create(NULL, _mesa_key_hash_string,
+ state->syms = _mesa_set_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
state->index = 0;
}
return false;
perf->oa_metrics_table =
- _mesa_hash_table_create(perf, _mesa_key_hash_string,
+ _mesa_hash_table_create(perf, _mesa_hash_string,
_mesa_key_string_equal);
/* Index all the metric sets mesa knows about before looking to see what
struct _mesa_symbol_table *table = calloc(1, sizeof(*table));
if (table != NULL) {
- table->ht = _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ table->ht = _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
_mesa_symbol_table_push_scope(table);
return XXH32(data, size, 0);
}
+uint32_t
+_mesa_hash_int(const void *key)
+{
+ return XXH32(key, sizeof(int), 0);
+}
+
+uint32_t
+_mesa_hash_uint(const void *key)
+{
+ return XXH32(key, sizeof(unsigned), 0);
+}
+
+uint32_t
+_mesa_hash_u32(const void *key)
+{
+ return XXH32(key, 4, 0);
+}
+
/** FNV-1a string hash implementation */
uint32_t
_mesa_hash_string(const void *_key)
return hash;
}
+uint32_t
+_mesa_hash_pointer(const void *pointer)
+{
+ uintptr_t num = (uintptr_t) pointer;
+ return (uint32_t) ((num >> 2) ^ (num >> 6) ^ (num >> 10) ^ (num >> 14));
+}
+
+bool
+_mesa_key_int_equal(const void *a, const void *b)
+{
+ return *((const int *)a) == *((const int *)b);
+}
+
+bool
+_mesa_key_uint_equal(const void *a, const void *b)
+{
+
+ return *((const unsigned *)a) == *((const unsigned *)b);
+}
+
+bool
+_mesa_key_u32_equal(const void *a, const void *b)
+{
+ return *((const uint32_t *)a) == *((const uint32_t *)b);
+}
+
/**
* String compare function for use as the comparison callback in
* _mesa_hash_table_create().
bool (*predicate)(struct hash_entry *entry));
uint32_t _mesa_hash_data(const void *data, size_t size);
+
+uint32_t _mesa_hash_int(const void *key);
+uint32_t _mesa_hash_uint(const void *key);
+uint32_t _mesa_hash_u32(const void *key);
uint32_t _mesa_hash_string(const void *key);
+uint32_t _mesa_hash_pointer(const void *pointer);
+
+bool _mesa_key_int_equal(const void *a, const void *b);
+bool _mesa_key_uint_equal(const void *a, const void *b);
+bool _mesa_key_u32_equal(const void *a, const void *b);
bool _mesa_key_string_equal(const void *a, const void *b);
bool _mesa_key_pointer_equal(const void *a, const void *b);
-static inline uint32_t _mesa_key_hash_string(const void *key)
-{
- return _mesa_hash_string((const char *)key);
-}
-
-static inline uint32_t _mesa_hash_pointer(const void *pointer)
-{
- uintptr_t num = (uintptr_t) pointer;
- return (uint32_t) ((num >> 2) ^ (num >> 6) ^ (num >> 10) ^ (num >> 14));
-}
-
struct hash_table *
_mesa_pointer_hash_table_create(void *mem_ctx);
(void) argc;
(void) argv;
- ht = _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ ht = _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
_mesa_hash_table_insert(ht, str1, NULL);
(void) argc;
(void) argv;
- ht = _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ ht = _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
_mesa_hash_table_insert(ht, str1, NULL);
(void) argc;
(void) argv;
- ht = _mesa_hash_table_create(NULL, _mesa_key_hash_string, _mesa_key_string_equal);
+ ht = _mesa_hash_table_create(NULL, _mesa_hash_string, _mesa_key_string_equal);
_mesa_hash_table_insert(ht, str1, NULL);
_mesa_hash_table_insert(ht, str2, NULL);
assert(str1 != str2);
- ht = _mesa_hash_table_create(NULL, _mesa_key_hash_string,
+ ht = _mesa_hash_table_create(NULL, _mesa_hash_string,
_mesa_key_string_equal);
_mesa_hash_table_insert(ht, str1, str1);