vulkan/pipeline_cache: add 'skip_disk_cache' option
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23909>
This commit is contained in:
committed by
Marge Bot
parent
c778803d67
commit
2efa5ad0f6
@@ -356,9 +356,8 @@ vk_pipeline_cache_lookup_object(struct vk_pipeline_cache *cache,
|
||||
}
|
||||
|
||||
if (object == NULL) {
|
||||
#ifdef ENABLE_SHADER_CACHE
|
||||
struct disk_cache *disk_cache = cache->base.device->physical->disk_cache;
|
||||
if (disk_cache != NULL && cache->object_cache != NULL) {
|
||||
if (!cache->skip_disk_cache && disk_cache && cache->object_cache) {
|
||||
cache_key cache_key;
|
||||
disk_cache_compute_key(disk_cache, key_data, key_size, cache_key);
|
||||
|
||||
@@ -375,7 +374,6 @@ vk_pipeline_cache_lookup_object(struct vk_pipeline_cache *cache,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* No disk cache or not found in the disk cache */
|
||||
return NULL;
|
||||
@@ -422,14 +420,13 @@ vk_pipeline_cache_add_object(struct vk_pipeline_cache *cache,
|
||||
struct vk_pipeline_cache_object *inserted =
|
||||
vk_pipeline_cache_insert_object(cache, object);
|
||||
|
||||
#ifdef ENABLE_SHADER_CACHE
|
||||
if (object == inserted) {
|
||||
/* If it wasn't in the object cache, it might not be in the disk cache
|
||||
* either. Better try and add it.
|
||||
*/
|
||||
|
||||
struct disk_cache *disk_cache = cache->base.device->physical->disk_cache;
|
||||
if (object->ops->serialize != NULL && disk_cache) {
|
||||
if (!cache->skip_disk_cache && object->ops->serialize && disk_cache) {
|
||||
struct blob blob;
|
||||
blob_init(&blob);
|
||||
|
||||
@@ -444,7 +441,6 @@ vk_pipeline_cache_add_object(struct vk_pipeline_cache *cache,
|
||||
blob_finish(&blob);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return inserted;
|
||||
}
|
||||
@@ -455,14 +451,12 @@ vk_pipeline_cache_create_and_insert_object(struct vk_pipeline_cache *cache,
|
||||
const void *data, size_t data_size,
|
||||
const struct vk_pipeline_cache_object_ops *ops)
|
||||
{
|
||||
#ifdef ENABLE_SHADER_CACHE
|
||||
struct disk_cache *disk_cache = cache->base.device->physical->disk_cache;
|
||||
if (disk_cache) {
|
||||
if (!cache->skip_disk_cache && disk_cache) {
|
||||
cache_key cache_key;
|
||||
disk_cache_compute_key(disk_cache, key_data, key_size, cache_key);
|
||||
disk_cache_put(disk_cache, cache_key, data, data_size, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct vk_pipeline_cache_object *object =
|
||||
vk_pipeline_cache_object_deserialize(cache, key_data, key_size, data,
|
||||
@@ -625,6 +619,11 @@ vk_pipeline_cache_create(struct vk_device *device,
|
||||
|
||||
cache->flags = pCreateInfo->flags;
|
||||
cache->weak_ref = info->weak_ref;
|
||||
#ifndef ENABLE_SHADER_CACHE
|
||||
cache->skip_disk_cache = true;
|
||||
#else
|
||||
cache->skip_disk_cache = info->skip_disk_cache;
|
||||
#endif
|
||||
|
||||
struct VkPhysicalDeviceProperties pdevice_props;
|
||||
device->physical->dispatch_table.GetPhysicalDeviceProperties(
|
||||
|
||||
@@ -154,6 +154,7 @@ struct vk_pipeline_cache {
|
||||
/* pCreateInfo::flags */
|
||||
VkPipelineCacheCreateFlags flags;
|
||||
bool weak_ref;
|
||||
bool skip_disk_cache;
|
||||
|
||||
struct vk_pipeline_cache_header header;
|
||||
|
||||
@@ -194,6 +195,9 @@ struct vk_pipeline_cache_create_info {
|
||||
* owner when it's destroyed.
|
||||
*/
|
||||
bool weak_ref;
|
||||
|
||||
/** If true, do not attempt to use the disk cache */
|
||||
bool skip_disk_cache;
|
||||
};
|
||||
|
||||
struct vk_pipeline_cache *
|
||||
|
||||
Reference in New Issue
Block a user