diff options
author | Grazvydas Ignotas <[email protected]> | 2017-03-16 01:09:27 +0200 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-03-21 11:15:52 +1100 |
commit | 529a767041c880f90c4465cb34a89430459c7fce (patch) | |
tree | b19c1fcbc36ffe1314155559c7fa52226c8c6e2d /src/util/disk_cache.c | |
parent | 021c87fa24afe849e51dd0249ec8e7b59e097062 (diff) |
util/disk_cache: use a helper to compute cache keys
This will allow to hash additional data into the cache keys or even
change the hashing algorithm easily, should we decide to do so.
v2: don't try to compute key (and crash) if cache is disabled
Signed-off-by: Grazvydas Ignotas <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/util/disk_cache.c')
-rw-r--r-- | src/util/disk_cache.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index d7e1996c41b..2478a1a4170 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -1063,4 +1063,11 @@ disk_cache_has_key(struct disk_cache *cache, const cache_key key) return memcmp(entry, key, CACHE_KEY_SIZE) == 0; } +void +disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size, + cache_key key) +{ + _mesa_sha1_compute(data, size, key); +} + #endif /* ENABLE_SHADER_CACHE */ |