aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/intel/vulkan/anv_pipeline_cache.c5
-rw-r--r--src/intel/vulkan/anv_private.h4
2 files changed, 6 insertions, 3 deletions
diff --git a/src/intel/vulkan/anv_pipeline_cache.c b/src/intel/vulkan/anv_pipeline_cache.c
index 0b677a49f3d..cdd8215b9b5 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -308,7 +308,8 @@ anv_pipeline_cache_upload_kernel(struct anv_pipeline_cache *cache,
pthread_mutex_unlock(&cache->mutex);
/* We increment refcount before handing it to the caller */
- anv_shader_bin_ref(bin);
+ if (bin)
+ anv_shader_bin_ref(bin);
return bin;
} else {
@@ -546,6 +547,8 @@ VkResult anv_MergePipelineCaches(
struct hash_entry *entry;
hash_table_foreach(src->cache, entry) {
struct anv_shader_bin *bin = entry->data;
+ assert(bin);
+
if (_mesa_hash_table_search(dst->cache, bin->key))
continue;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 7682bfcc757..eec1cd6f8d0 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1556,14 +1556,14 @@ anv_shader_bin_destroy(struct anv_device *device, struct anv_shader_bin *shader)
static inline void
anv_shader_bin_ref(struct anv_shader_bin *shader)
{
- assert(shader->ref_cnt >= 1);
+ assert(shader && shader->ref_cnt >= 1);
__sync_fetch_and_add(&shader->ref_cnt, 1);
}
static inline void
anv_shader_bin_unref(struct anv_device *device, struct anv_shader_bin *shader)
{
- assert(shader->ref_cnt >= 1);
+ assert(shader && shader->ref_cnt >= 1);
if (__sync_fetch_and_add(&shader->ref_cnt, -1) == 1)
anv_shader_bin_destroy(device, shader);
}