diff options
author | Timothy Arceri <[email protected]> | 2017-03-15 12:40:53 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-03-17 16:17:10 +1100 |
commit | 4ffdab78b9a497a8b597466bb6151837f71b0c6a (patch) | |
tree | d6eb2a72bc8efbf1adcf690e112ec1733c26fe5b /src/amd/vulkan/radv_pipeline_cache.c | |
parent | 124ec417f968bfb081b238fdcde04b9aaf9d6a2d (diff) |
radv: move cache check inside insert and search functions
This will allow us to use fallback in-memory and on-disk caches
should the app not provide a pipeline cache.
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_pipeline_cache.c')
-rw-r--r-- | src/amd/vulkan/radv_pipeline_cache.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c index 83bf3cb6af4..5f6355f0d1a 100644 --- a/src/amd/vulkan/radv_pipeline_cache.c +++ b/src/amd/vulkan/radv_pipeline_cache.c @@ -152,7 +152,10 @@ radv_create_shader_variant_from_pipeline_cache(struct radv_device *device, struct radv_pipeline_cache *cache, const unsigned char *sha1) { - struct cache_entry *entry = radv_pipeline_cache_search(cache, sha1); + struct cache_entry *entry = NULL; + + if (cache) + entry = radv_pipeline_cache_search(cache, sha1); if (!entry) return NULL; @@ -260,6 +263,9 @@ radv_pipeline_cache_insert_shader(struct radv_pipeline_cache *cache, struct radv_shader_variant *variant, const void *code, unsigned code_size) { + if (!cache) + return variant; + pthread_mutex_lock(&cache->mutex); struct cache_entry *entry = radv_pipeline_cache_search_unlocked(cache, sha1); if (entry) { |