radv/meta: disable disk cache for meta shaders
authorDaniel Schürmann <daniel@schuermann.dev>
Wed, 28 Jun 2023 10:15:51 +0000 (12:15 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 11 Jul 2023 07:36:53 +0000 (07:36 +0000)
Meta shaders are already stored in a separate cache file,
inserting them into the disk cache is unnecessary.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23909>

src/amd/vulkan/meta/radv_meta.c
src/amd/vulkan/radv_pipeline_cache.c

index db709d2..d69082e 100644 (file)
@@ -334,12 +334,17 @@ radv_load_meta_pipeline(struct radv_device *device)
    void *data = NULL;
    bool ret = false;
    int fd = -1;
-   VkResult result = VK_SUCCESS;
+   struct vk_pipeline_cache *cache = NULL;
 
    VkPipelineCacheCreateInfo create_info = {
       .sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO,
    };
 
+   struct vk_pipeline_cache_create_info info = {
+      .pCreateInfo = &create_info,
+      .skip_disk_cache = true,
+   };
+
    if (!radv_builtin_cache_path(path))
       goto fail;
 
@@ -358,8 +363,10 @@ radv_load_meta_pipeline(struct radv_device *device)
    create_info.pInitialData = data;
 
 fail:
-   result = vk_common_CreatePipelineCache(radv_device_to_handle(device), &create_info, NULL, &device->meta_state.cache);
-   if (result == VK_SUCCESS) {
+   cache = vk_pipeline_cache_create(&device->vk, &info, NULL);
+
+   if (cache) {
+      device->meta_state.cache = vk_pipeline_cache_to_handle(cache);
       device->meta_state.initial_cache_entries = num_cache_entries(device->meta_state.cache);
       ret = device->meta_state.initial_cache_entries > 0;
    }
index 367bccf..215c15d 100644 (file)
@@ -212,8 +212,6 @@ radv_shader_create(struct radv_device *device, struct vk_pipeline_cache *cache,
    uint8_t hash[SHA1_DIGEST_LENGTH];
    _mesa_sha1_compute(binary, binary->total_size, hash);
 
-   /* TODO: Skip disk-cache for meta-shaders because they are stored in a different cache file */
-
    struct vk_pipeline_cache_object *shader_obj;
    shader_obj = vk_pipeline_cache_create_and_insert_object(cache, hash, SHA1_DIGEST_LENGTH, binary, binary->total_size,
                                                            &radv_shader_ops);