radv: reference pipeline cache object in radv_pipeline
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23878>
This commit is contained in:

committed by
Marge Bot

parent
05269047d3
commit
3bd72eec1e
@@ -86,6 +86,9 @@ void
|
||||
radv_pipeline_destroy(struct radv_device *device, struct radv_pipeline *pipeline,
|
||||
const VkAllocationCallbacks *allocator)
|
||||
{
|
||||
if (pipeline->cache_object)
|
||||
vk_pipeline_cache_object_unref(&device->vk, pipeline->cache_object);
|
||||
|
||||
switch (pipeline->type) {
|
||||
case RADV_PIPELINE_GRAPHICS:
|
||||
radv_destroy_graphics_pipeline(device, radv_pipeline_to_graphics(pipeline));
|
||||
|
@@ -396,7 +396,7 @@ radv_pipeline_cache_search(struct radv_device *device, struct vk_pipeline_cache
|
||||
radv_pipeline_to_graphics_lib(pipeline)->base.ps_epilog = ps_epilog;
|
||||
}
|
||||
|
||||
vk_pipeline_cache_object_unref(&device->vk, object);
|
||||
pipeline->cache_object = object;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -447,8 +447,7 @@ radv_pipeline_cache_insert(struct radv_device *device, struct vk_pipeline_cache
|
||||
}
|
||||
|
||||
/* Add the object to the cache */
|
||||
struct vk_pipeline_cache_object *object = vk_pipeline_cache_add_object(cache, &pipeline_obj->base);
|
||||
vk_pipeline_cache_object_unref(&device->vk, object);
|
||||
pipeline->cache_object = vk_pipeline_cache_add_object(cache, &pipeline_obj->base);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -502,6 +501,7 @@ radv_ray_tracing_pipeline_cache_search(struct radv_device *device, struct vk_pip
|
||||
VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT;
|
||||
}
|
||||
|
||||
pipeline->base.base.cache_object = object;
|
||||
return complete;
|
||||
}
|
||||
|
||||
@@ -516,6 +516,13 @@ radv_ray_tracing_pipeline_cache_insert(struct radv_device *device, struct vk_pip
|
||||
if (!cache)
|
||||
cache = device->mem_cache;
|
||||
|
||||
/* Skip insertion on cache hit.
|
||||
* This branch can be triggered if a cache_object was found but not all NIR shaders could be
|
||||
* looked up. The cache_object is already complete in that case.
|
||||
*/
|
||||
if (pipeline->base.base.cache_object)
|
||||
return;
|
||||
|
||||
/* Count compiled shaders excl. library shaders */
|
||||
unsigned num_shaders = pipeline->base.base.shaders[MESA_SHADER_INTERSECTION] ? 1 : 0;
|
||||
for (unsigned i = 0; i < num_stages; ++i)
|
||||
@@ -540,8 +547,7 @@ radv_ray_tracing_pipeline_cache_insert(struct radv_device *device, struct vk_pip
|
||||
stack_sizes[i] = pipeline->stages[i].stack_size;
|
||||
|
||||
/* Add the object to the cache */
|
||||
struct vk_pipeline_cache_object *object = vk_pipeline_cache_add_object(cache, &pipeline_obj->base);
|
||||
vk_pipeline_cache_object_unref(&device->vk, object);
|
||||
pipeline->base.base.cache_object = vk_pipeline_cache_add_object(cache, &pipeline_obj->base);
|
||||
}
|
||||
|
||||
struct vk_pipeline_cache_object *
|
||||
|
@@ -2200,6 +2200,8 @@ struct radv_pipeline {
|
||||
struct vk_object_base base;
|
||||
enum radv_pipeline_type type;
|
||||
|
||||
struct vk_pipeline_cache_object *cache_object;
|
||||
|
||||
bool is_internal;
|
||||
bool need_indirect_descriptor_sets;
|
||||
struct radv_shader *shaders[MESA_VULKAN_SHADER_STAGES];
|
||||
|
Reference in New Issue
Block a user