vulkan/pipeline_cache: replace raw data objects on cache insertion of real objects

It might happen that a raw data object (from pipeline cache creation)
was never looked up, and thus never deserialized, before it gets
inserted again into the cache. In this case, the deserialized object
got replaced by the raw data object.
Instead, replace the raw data object with the real object in the cache.

Fixes: 8b13ee75ba ('vulkan: Fall back to raw data objects when deserializing if ops == NULL')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22735>
This commit is contained in:
Daniel Schürmann
2023-04-27 15:13:51 +02:00
committed by Marge Bot
parent edfc9d9d96
commit cbab396f54

View File

@@ -319,6 +319,15 @@ vk_pipeline_cache_insert_object(struct vk_pipeline_cache *cache,
struct vk_pipeline_cache_object *result = NULL;
/* add reference to either the found or inserted object */
if (found) {
struct vk_pipeline_cache_object *found_object = (void *)entry->key;
if (found_object->ops != object->ops) {
/* The found object in the cache isn't fully formed. Replace it. */
assert(found_object->ops == &raw_data_object_ops);
assert(found_object->ref_cnt == 1 && object->ref_cnt == 1);
entry->key = object;
object = found_object;
}
result = vk_pipeline_cache_object_ref((void *)entry->key);
} else {
result = vk_pipeline_cache_object_ref(object);