aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/disk_cache.c4
-rw-r--r--src/util/disk_cache.h42
2 files changed, 46 insertions, 0 deletions
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 76bdfe8e8b6..6de608c2e4a 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -21,6 +21,8 @@
* IN THE SOFTWARE.
*/
+#ifdef ENABLE_SHADER_CACHE
+
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
@@ -705,3 +707,5 @@ disk_cache_has_key(struct disk_cache *cache, cache_key key)
return memcmp(entry, key, CACHE_KEY_SIZE) == 0;
}
+
+#endif /* ENABLE_SHADER_CACHE */
diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h
index 0b20665e970..7e9cb809b59 100644
--- a/src/util/disk_cache.h
+++ b/src/util/disk_cache.h
@@ -40,6 +40,8 @@ struct disk_cache;
/* Provide inlined stub functions if the shader cache is disabled. */
+#ifdef ENABLE_SHADER_CACHE
+
/**
* Create a new cache object.
*
@@ -129,6 +131,46 @@ disk_cache_put_key(struct disk_cache *cache, cache_key key);
bool
disk_cache_has_key(struct disk_cache *cache, cache_key key);
+#else
+
+static inline struct disk_cache *
+disk_cache_create(void)
+{
+ return NULL;
+}
+
+static inline void
+disk_cache_destroy(struct disk_cache *cache) {
+ return;
+}
+
+static inline void
+disk_cache_put(struct disk_cache *cache, cache_key key,
+ const void *data, size_t size)
+{
+ return;
+}
+
+static inline uint8_t *
+disk_cache_get(struct disk_cache *cache, cache_key key, size_t *size)
+{
+ return NULL;
+}
+
+static inline void
+disk_cache_put_key(struct disk_cache *cache, cache_key key)
+{
+ return;
+}
+
+static inline bool
+disk_cache_has_key(struct disk_cache *cache, cache_key key)
+{
+ return false;
+}
+
+#endif /* ENABLE_SHADER_CACHE */
+
#ifdef __cplusplus
}
#endif