From 4d0f136297e79a84989670f65af37f9327fd26aa Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Fri, 4 Jun 2021 01:44:47 +0900 Subject: [PATCH] vkinstance: Don't abort in case that system has no available vulkan device Specification doesn't have restriction that returned pPhysicalDeviceCount value must be non-zero Part-of: --- gst-libs/gst/vulkan/gstvkinstance.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/vulkan/gstvkinstance.c b/gst-libs/gst/vulkan/gstvkinstance.c index 14db32922e..46f9148dad 100644 --- a/gst-libs/gst/vulkan/gstvkinstance.c +++ b/gst-libs/gst/vulkan/gstvkinstance.c @@ -975,7 +975,15 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error) if (gst_vulkan_error_to_g_error (err, error, "vkEnumeratePhysicalDevices") < 0) goto error; - g_assert (instance->n_physical_devices > 0); + + if (instance->n_physical_devices == 0) { + GST_WARNING_OBJECT (instance, "No available physical device"); + g_set_error_literal (error, + GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_NOT_FOUND, + "No available physical device"); + goto error; + } + instance->physical_devices = g_new0 (VkPhysicalDevice, instance->n_physical_devices); err =