aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/disk_cache.c7
-rw-r--r--src/util/disk_cache.h14
2 files changed, 21 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 */
diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h
index 3659b6dc358..e3663a65c51 100644
--- a/src/util/disk_cache.h
+++ b/src/util/disk_cache.h
@@ -178,6 +178,13 @@ disk_cache_put_key(struct disk_cache *cache, const cache_key key);
bool
disk_cache_has_key(struct disk_cache *cache, const cache_key key);
+/**
+ * Compute the name \key from \data of given \size.
+ */
+void
+disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size,
+ cache_key key);
+
#else
static inline struct disk_cache *
@@ -222,6 +229,13 @@ disk_cache_has_key(struct disk_cache *cache, const cache_key key)
return false;
}
+void
+disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size,
+ const cache_key key)
+{
+ return;
+}
+
#endif /* ENABLE_SHADER_CACHE */
#ifdef __cplusplus