radv: Add logic for multisample format descriptions.
[mesa.git] / src / amd / vulkan / radv_pipeline_cache.c
index 6858d37eba8f72c8979d8d8682d6063755b7182b..57d526103061377fe625e41e5443e7c381683bdf 100644 (file)
@@ -248,7 +248,6 @@ radv_is_cache_disabled(struct radv_device *device)
         * MESA_GLSL_CACHE_DISABLE=1, and when VK_AMD_shader_info is requested.
         */
        return (device->instance->debug_flags & RADV_DEBUG_NO_CACHE) ||
-              !device->physical_device->disk_cache ||
               device->keep_shader_info;
 }
 
@@ -256,22 +255,27 @@ bool
 radv_create_shader_variants_from_pipeline_cache(struct radv_device *device,
                                                struct radv_pipeline_cache *cache,
                                                const unsigned char *sha1,
-                                               struct radv_shader_variant **variants)
+                                               struct radv_shader_variant **variants,
+                                               bool *found_in_application_cache)
 {
        struct cache_entry *entry;
 
-       if (!cache)
+       if (!cache) {
                cache = device->mem_cache;
+               *found_in_application_cache = false;
+       }
 
        pthread_mutex_lock(&cache->mutex);
 
        entry = radv_pipeline_cache_search_unlocked(cache, sha1);
 
        if (!entry) {
+               *found_in_application_cache = false;
+
                /* Don't cache when we want debug info, since this isn't
                 * present in the cache.
                 */
-               if (radv_is_cache_disabled(device)) {
+               if (radv_is_cache_disabled(device) || !device->physical_device->disk_cache) {
                        pthread_mutex_unlock(&cache->mutex);
                        return false;
                }
@@ -456,7 +460,7 @@ struct cache_header {
        uint8_t  uuid[VK_UUID_SIZE];
 };
 
-void
+bool
 radv_pipeline_cache_load(struct radv_pipeline_cache *cache,
                         const void *data, size_t size)
 {
@@ -464,18 +468,18 @@ radv_pipeline_cache_load(struct radv_pipeline_cache *cache,
        struct cache_header header;
 
        if (size < sizeof(header))
-               return;
+               return false;
        memcpy(&header, data, sizeof(header));
        if (header.header_size < sizeof(header))
-               return;
+               return false;
        if (header.header_version != VK_PIPELINE_CACHE_HEADER_VERSION_ONE)
-               return;
+               return false;
        if (header.vendor_id != ATI_VENDOR_ID)
-               return;
+               return false;
        if (header.device_id != device->physical_device->rad_info.pci_id)
-               return;
+               return false;
        if (memcmp(header.uuid, device->physical_device->cache_uuid, VK_UUID_SIZE) != 0)
-               return;
+               return false;
 
        char *end = (void *) data + size;
        char *p = (void *) data + header.header_size;
@@ -497,6 +501,8 @@ radv_pipeline_cache_load(struct radv_pipeline_cache *cache,
                }
                p += size;
        }
+
+       return true;
 }
 
 VkResult radv_CreatePipelineCache(