diff options
author | Matthew Waters <matthew@centricular.com> | 2019-03-29 16:24:15 +1100 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2019-04-08 09:26:20 +0000 |
commit | b9be6b318ee4a31d5a729a99d6b85c174f620d9b (patch) | |
tree | da18edcd64b9739c025059b9b700834bf58b1dff | |
parent | ab12a4cd0fe044a96dd156cec3f83aa29dd3a6c4 (diff) | |
download | gstreamer-plugins-bad-b9be6b318ee4a31d5a729a99d6b85c174f620d9b.tar.gz |
vulkan: make the debug extension optional
i.e. don't fail if it's not available
-rw-r--r-- | ext/vulkan/vkinstance.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/ext/vulkan/vkinstance.c b/ext/vulkan/vkinstance.c index 121de7592..9fdc90c7b 100644 --- a/ext/vulkan/vkinstance.c +++ b/ext/vulkan/vkinstance.c @@ -178,6 +178,7 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error) uint32_t instance_layer_count = 0; uint32_t enabled_layer_count = 0; gchar **enabled_layers; + gboolean have_debug_extension = FALSE; VkResult err; g_return_val_if_fail (GST_IS_VULKAN_INSTANCE (instance), FALSE); @@ -265,6 +266,7 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error) instance_extensions[i].extensionName)) { extension_names[enabled_extension_count++] = (gchar *) VK_EXT_DEBUG_REPORT_EXTENSION_NAME; + have_debug_extension = TRUE; } if (!g_strcmp0 (winsys_ext_name, instance_extensions[i].extensionName)) { winsys_ext_found = TRUE; @@ -342,35 +344,36 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error) "vkEnumeratePhysicalDevices") < 0) goto error; - instance->dbgCreateDebugReportCallback = (PFN_vkCreateDebugReportCallbackEXT) - gst_vulkan_instance_get_proc_address (instance, - "vkCreateDebugReportCallbackEXT"); - if (!instance->dbgCreateDebugReportCallback) { - g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED, - "Failed to retreive vkCreateDebugReportCallback"); - goto error; - } - instance->dbgDestroyDebugReportCallback = - (PFN_vkDestroyDebugReportCallbackEXT) - gst_vulkan_instance_get_proc_address (instance, - "vkDestroyDebugReportCallbackEXT"); - if (!instance->dbgDestroyDebugReportCallback) { - g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED, - "Failed to retreive vkDestroyDebugReportCallback"); - goto error; - } - instance->dbgReportMessage = (PFN_vkDebugReportMessageEXT) - gst_vulkan_instance_get_proc_address (instance, - "vkDebugReportMessageEXT"); - if (!instance->dbgReportMessage) { - g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED, - "Failed to retreive vkDebugReportMessage"); - goto error; - } - - { + if (have_debug_extension) { VkDebugReportCallbackCreateInfoEXT info = { 0, }; + instance->dbgCreateDebugReportCallback = + (PFN_vkCreateDebugReportCallbackEXT) + gst_vulkan_instance_get_proc_address (instance, + "vkCreateDebugReportCallbackEXT"); + if (!instance->dbgCreateDebugReportCallback) { + g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED, + "Failed to retreive vkCreateDebugReportCallback"); + goto error; + } + instance->dbgDestroyDebugReportCallback = + (PFN_vkDestroyDebugReportCallbackEXT) + gst_vulkan_instance_get_proc_address (instance, + "vkDestroyDebugReportCallbackEXT"); + if (!instance->dbgDestroyDebugReportCallback) { + g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED, + "Failed to retreive vkDestroyDebugReportCallback"); + goto error; + } + instance->dbgReportMessage = (PFN_vkDebugReportMessageEXT) + gst_vulkan_instance_get_proc_address (instance, + "vkDebugReportMessageEXT"); + if (!instance->dbgReportMessage) { + g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED, + "Failed to retreive vkDebugReportMessage"); + goto error; + } + info.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT; info.pNext = NULL; info.flags = |