vulkan/runtime: 0-out pipeline cache object

I'm running into crashes because cache->cache_object is uninitialized.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 591da98779 ("vulkan: Add a common VkPipelineCache implementation")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16275>
This commit is contained in:
Lionel Landwerlin 2022-05-02 16:32:36 +03:00 committed by Marge Bot
parent 7cd9adeb41
commit 1e7ea18026
2 changed files with 3 additions and 2 deletions

View File

@ -562,8 +562,8 @@ vk_pipeline_cache_create(struct vk_device *device,
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO);
cache = vk_object_alloc(device, pAllocator, sizeof(*cache),
VK_OBJECT_TYPE_PIPELINE_CACHE);
cache = vk_object_zalloc(device, pAllocator, sizeof(*cache),
VK_OBJECT_TYPE_PIPELINE_CACHE);
if (cache == NULL)
return NULL;

View File

@ -120,6 +120,7 @@ vk_pipeline_cache_object_init(struct vk_device *device,
const struct vk_pipeline_cache_object_ops *ops,
const void *key_data, uint32_t key_size)
{
memset(object, 0, sizeof(*object));
object->device = device;
object->ops = ops;
p_atomic_set(&object->ref_cnt, 1);