Fix crash when using multiple physical devices and HW core (#14889)

* [Vulkan] Detect if wrong PhysicalDevice is returned.

* [Vulkan] Actually query physical device before creating core device.
This commit is contained in:
Hans-Kristian Arntzen 2023-01-22 17:28:59 +01:00 committed by GitHub
parent 9fbd62d7b8
commit f7a9d64d73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1584,6 +1584,9 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
iface = NULL;
}
if (!vulkan_context_init_gpu(vk))
return false;
if (!cached_device_vk && iface && iface->create_device)
{
struct retro_vulkan_context context = { 0 };
@ -1605,6 +1608,9 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
}
else
{
if (vk->context.gpu != VK_NULL_HANDLE && context.gpu != vk->context.gpu)
RARCH_ERR("[Vulkan]: Got unexpected VkPhysicalDevice, despite RetroArch using explicit physical device.\n");
vk->context.destroy_device = iface->destroy_device;
vk->context.device = context.device;
@ -1626,9 +1632,6 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
cached_destroy_device_vk = NULL;
}
if (!vulkan_context_init_gpu(vk))
return false;
vkGetPhysicalDeviceProperties(vk->context.gpu,
&vk->context.gpu_properties);
vkGetPhysicalDeviceMemoryProperties(vk->context.gpu,