summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-07-13 14:26:50 -0700
committerEmil Velikov <[email protected]>2016-07-21 12:19:38 +0100
commitbf11931c953d870161d26c68fcf2a227425e0d4f (patch)
tree8656ded059f951c1d1f684af205ed94898c8cfab /src/compiler
parent17e1b016fc3ca9d4b858c03142b1f9530415e0a6 (diff)
glsl/types: Use _mesa_hash_data for hashing function types
This is way better than the stupid string approach especially since you could overflow the string. Again, I thought I had something better at one point but it obviously got lost. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Cc: "12.0" <[email protected]> (cherry picked from commit b919100d6101c0bd7e15a187968af9a36b49e6de)
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl_types.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp
index d78efaace68..83ce35e8637 100644
--- a/src/compiler/glsl_types.cpp
+++ b/src/compiler/glsl_types.cpp
@@ -1090,20 +1090,8 @@ static uint32_t
function_key_hash(const void *a)
{
const glsl_type *const key = (glsl_type *) a;
- char hash_key[128];
- unsigned size = 0;
-
- size = snprintf(hash_key, sizeof(hash_key), "%08x", key->length);
-
- for (unsigned i = 0; i < key->length; i++) {
- if (size >= sizeof(hash_key))
- break;
-
- size += snprintf(& hash_key[size], sizeof(hash_key) - size,
- "%p", (void *) key->fields.structure[i].type);
- }
-
- return _mesa_hash_string(hash_key);
+ return _mesa_hash_data(key->fields.parameters,
+ (key->length + 1) * sizeof(*key->fields.parameters));
}
const glsl_type *