anv/pipeline_cache: fix incorrect guards for NIR cache
authorIago Toral Quiroga <itoral@igalia.com>
Fri, 11 Jan 2019 10:41:01 +0000 (11:41 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Fri, 11 Jan 2019 11:45:18 +0000 (12:45 +0100)
Fixes: f6aa9f718516 'anv/pipeline_cache: Add support for caching NIR'
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_pipeline_cache.c

index 18f310b06ee5a6e4a296a08ddb44b81dbff7b69f..f9733c53098b5da1314ca780a18d584d692e4fdb 100644 (file)
@@ -239,6 +239,7 @@ anv_pipeline_cache_init(struct anv_pipeline_cache *cache,
                                                  sha1_compare_func);
    } else {
       cache->cache = NULL;
+      cache->nir_cache = NULL;
    }
 }
 
@@ -670,7 +671,7 @@ anv_device_search_for_nir(struct anv_device *device,
                           unsigned char sha1_key[20],
                           void *mem_ctx)
 {
-   if (cache) {
+   if (cache && cache->nir_cache) {
       const struct serialized_nir *snir = NULL;
 
       pthread_mutex_lock(&cache->mutex);
@@ -702,7 +703,7 @@ anv_device_upload_nir(struct anv_device *device,
                       const struct nir_shader *nir,
                       unsigned char sha1_key[20])
 {
-   if (cache) {
+   if (cache && cache->nir_cache) {
       pthread_mutex_lock(&cache->mutex);
       struct hash_entry *entry =
          _mesa_hash_table_search(cache->nir_cache, sha1_key);