From d588bdaaf7473685ce85438c0a7b80c77f719ece Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 28 Oct 2017 16:02:08 +0200 Subject: vo_gpu: vulkan: fix segfault due to index mismatch The queue family index and the queue info index are not necessarily the same, so we're forced to do a check based on the queue family index itself. Fixes #5049 --- video/out/vulkan/utils.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/video/out/vulkan/utils.c b/video/out/vulkan/utils.c index 5b9be3216f..1fd674d28f 100644 --- a/video/out/vulkan/utils.c +++ b/video/out/vulkan/utils.c @@ -519,14 +519,17 @@ bool mpvk_device_init(struct mpvk_ctx *vk, struct mpvk_device_opts opts) if (!pool) goto error; MP_TARRAY_APPEND(NULL, vk->pools, vk->num_pools, pool); - } - vk->pool_graphics = vk->pools[idx_gfx]; - vk->pool_compute = idx_comp >= 0 ? vk->pools[idx_comp] : NULL; - vk->pool_transfer = idx_tf >= 0 ? vk->pools[idx_tf] : NULL; + // Update the pool_* pointers based on the corresponding QF index + if (qf == idx_gfx) + vk->pool_graphics = pool; + if (qf == idx_comp) + vk->pool_compute = pool; + if (qf == idx_tf) + vk->pool_transfer = pool; + } vk_malloc_init(vk); - talloc_free(tmp); return true; -- cgit v1.2.3