diff options
author | Marek Olšák <[email protected]> | 2020-03-25 21:26:24 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-27 21:00:09 +0000 |
commit | 76f79db3f5d8492370c92080b5bbea7e31827b75 (patch) | |
tree | 6dd5ce4c71e696c82f4d8984d49dfe9a692e9879 /src/util/hash_table.c | |
parent | c42fa40a51efcf877915689bf170c67fff7e5600 (diff) |
util: stop including files from mesa/main
Reviewed-by: Timothy Arceri <[email protected]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>
Diffstat (limited to 'src/util/hash_table.c')
-rw-r--r-- | src/util/hash_table.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/util/hash_table.c b/src/util/hash_table.c index 3d5de59a040..939c03c19ee 100644 --- a/src/util/hash_table.c +++ b/src/util/hash_table.c @@ -47,12 +47,31 @@ #include "hash_table.h" #include "ralloc.h" #include "macros.h" -#include "main/hash.h" +#include "u_memory.h" #include "fast_urem_by_const.h" #define XXH_INLINE_ALL #include "xxhash.h" +/** + * Magic number that gets stored outside of the struct hash_table. + * + * The hash table needs a particular pointer to be the marker for a key that + * was deleted from the table, along with NULL for the "never allocated in the + * table" marker. Legacy GL allows any GLuint to be used as a GL object name, + * and we use a 1:1 mapping from GLuints to key pointers, so we need to be + * able to track a GLuint that happens to match the deleted key outside of + * struct hash_table. We tell the hash table to use "1" as the deleted key + * value, so that we test the deleted-key-in-the-table path as best we can. + */ +#define DELETED_KEY_VALUE 1 + +static inline void * +uint_key(unsigned id) +{ + return (void *)(uintptr_t) id; +} + static const uint32_t deleted_key_value; /** |