vkdevice: enable device optional extensions

Enable before-hand what the user might use.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4351>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-04-21 16:49:01 +02:00 committed by GStreamer Marge Bot
parent 00189bf8f3
commit bb29b4dfec

View file

@ -177,12 +177,35 @@ static void
gst_vulkan_device_constructed (GObject * object) gst_vulkan_device_constructed (GObject * object)
{ {
GstVulkanDevice *device = GST_VULKAN_DEVICE (object); GstVulkanDevice *device = GST_VULKAN_DEVICE (object);
const char *optional_extensions[] = {
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME,
#if (defined(VK_VERSION_1_3) || (defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 170))
VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME,
#endif
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
VK_KHR_VIDEO_QUEUE_EXTENSION_NAME,
VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME,
VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME,
VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME,
#ifdef VK_ENABLE_BETA_EXTENSION
VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME,
VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME,
VK_EXT_VIDEO_ENCODE_H265_EXTENSION_NAME,
#endif
#endif
};
int i;
g_object_get (device->physical_device, "instance", &device->instance, NULL); g_object_get (device->physical_device, "instance", &device->instance, NULL);
/* by default allow vkswapper to work for rendering to an output window. /* Ignore the failure if the extension does not exist. */
* Ignore the failure if the extension does not exist. */ for (i = 0; i < G_N_ELEMENTS (optional_extensions); i++) {
gst_vulkan_device_enable_extension (device, VK_KHR_SWAPCHAIN_EXTENSION_NAME); if (!gst_vulkan_device_enable_extension (device, optional_extensions[i])) {
GST_INFO_OBJECT (device, "Could not enable extension %s",
optional_extensions[i]);
}
}
G_OBJECT_CLASS (parent_class)->constructed (object); G_OBJECT_CLASS (parent_class)->constructed (object);
} }