radv: use correct alloc function when loading from disk
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 31 Oct 2017 00:31:19 +0000 (11:31 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 31 Oct 2017 03:51:55 +0000 (14:51 +1100)
Fixes regression in:

dEQP-VK.api.object_management.alloc_callback_fail.graphics_pipeline

Fixes: 1e84e53712ae "radv: add cache items to in memory cache when reading from disk"
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_pipeline_cache.c

index 91470d14191694f05f22651ee84ee5eb17e994e2..2904b62e6b6fa33b5d3107091640cb2217ecc45e 100644 (file)
@@ -276,7 +276,20 @@ radv_create_shader_variants_from_pipeline_cache(struct radv_device *device,
                        pthread_mutex_unlock(&cache->mutex);
                        return false;
                } else {
-                       radv_pipeline_cache_add_entry(cache, entry);
+                       size_t size = entry_size(entry);
+                       struct cache_entry *new_entry = vk_alloc(&cache->alloc, size, 8,
+                                                                VK_SYSTEM_ALLOCATION_SCOPE_CACHE);
+                       if (!new_entry) {
+                               free(entry);
+                               pthread_mutex_unlock(&cache->mutex);
+                               return false;
+                       }
+
+                       memcpy(new_entry, entry, entry_size(entry));
+                       free(entry);
+                       entry = new_entry;
+
+                       radv_pipeline_cache_add_entry(cache, new_entry);
                }
        }