From 0bbcfbfc0b35c7fa59441006adb1f69519a7df8f Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Sat, 20 May 2017 11:06:25 +1000 Subject: util/disk_cache: add new driver_flags param to cache keys This will be used for things such as adding driver specific environment variables to the key. Allowing us to set environment vars that change the shader and not have the driver ignore them if it finds existing shaders in the cache. Reviewed-by: Eduardo Lima Mitev --- src/util/disk_cache.c | 8 +++++++- src/util/disk_cache.h | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/util') diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index cf5d518f096..138d7ec174f 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -161,7 +161,8 @@ concatenate_and_mkdir(void *ctx, const char *path, const char *name) } struct disk_cache * -disk_cache_create(const char *gpu_name, const char *timestamp) +disk_cache_create(const char *gpu_name, const char *timestamp, + uint64_t driver_flags) { void *local; struct disk_cache *cache = NULL; @@ -356,6 +357,9 @@ disk_cache_create(const char *gpu_name, const char *timestamp) size_t ptr_size_size = sizeof(ptr_size); cache->driver_keys_blob_size += ptr_size_size; + size_t driver_flags_size = sizeof(driver_flags); + cache->driver_keys_blob_size += driver_flags_size; + cache->driver_keys_blob = ralloc_size(cache, cache->driver_keys_blob_size); if (!cache->driver_keys_blob) @@ -365,6 +369,8 @@ disk_cache_create(const char *gpu_name, const char *timestamp) memcpy(cache->driver_keys_blob + ts_size, gpu_name, gpu_name_size); memcpy(cache->driver_keys_blob + ts_size + gpu_name_size, &ptr_size, ptr_size_size); + memcpy(cache->driver_keys_blob + ts_size + gpu_name_size + ptr_size_size, + &driver_flags, driver_flags_size); /* Seed our rand function */ s_rand_xorshift128plus(cache->seed_xorshift128plus, true); diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h index 2bb1cf537d0..72f44638a55 100644 --- a/src/util/disk_cache.h +++ b/src/util/disk_cache.h @@ -93,7 +93,8 @@ disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp) * assistance in computing SHA-1 signatures. */ struct disk_cache * -disk_cache_create(const char *gpu_name, const char *timestamp); +disk_cache_create(const char *gpu_name, const char *timestamp, + uint64_t driver_flags); /** * Destroy a cache object, (freeing all associated resources). @@ -171,7 +172,8 @@ disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size, #else static inline struct disk_cache * -disk_cache_create(const char *gpu_name, const char *timestamp) +disk_cache_create(const char *gpu_name, const char *timestamp, + uint64_t driver_flags) { return NULL; } -- cgit v1.2.3