diff options
author | Matthew Waters <matthew@centricular.com> | 2016-04-10 17:43:39 +1000 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2016-04-11 14:18:47 +1000 |
commit | e46bd98fe613412ba3ffb72b1bd4a12b6b913c7b (patch) | |
tree | b8b1f5d201cfba2b5a5c02890393bddfca32de86 /ext/vulkan | |
parent | b76fcfd3f71ca82ce5bc8323b8ca236721675825 (diff) |
vulkan/xcb: getProcAddress winsys functions
There's no guarantee that they will always be exposed by the vulkan loader.
Diffstat (limited to 'ext/vulkan')
-rw-r--r-- | ext/vulkan/xcb/vkwindow_xcb.c | 30 | ||||
-rw-r--r-- | ext/vulkan/xcb/vkwindow_xcb.h | 3 |
2 files changed, 29 insertions, 4 deletions
diff --git a/ext/vulkan/xcb/vkwindow_xcb.c b/ext/vulkan/xcb/vkwindow_xcb.c index 6369a1d6c..d08c0bf6e 100644 --- a/ext/vulkan/xcb/vkwindow_xcb.c +++ b/ext/vulkan/xcb/vkwindow_xcb.c @@ -206,6 +206,7 @@ gst_vulkan_window_xcb_create_window (GstVulkanWindowXCB * window_xcb) static VkSurfaceKHR gst_vulkan_window_xcb_get_surface (GstVulkanWindow * window, GError ** error) { + GstVulkanWindowXCB *window_xcb = GST_VULKAN_WINDOW_XCB (window); VkXcbSurfaceCreateInfoKHR info = { 0, }; VkSurfaceKHR ret; VkResult err; @@ -216,9 +217,19 @@ gst_vulkan_window_xcb_get_surface (GstVulkanWindow * window, GError ** error) info.connection = GST_VULKAN_DISPLAY_XCB_CONNECTION (window->display); info.window = GST_VULKAN_WINDOW_XCB (window)->win_id; + if (!window_xcb->CreateXcbSurface) + window_xcb->CreateXcbSurface = + gst_vulkan_instance_get_proc_address (window->display->instance, + "vkCreateXcbSurfaceKHR"); + if (!window_xcb->CreateXcbSurface) { + g_set_error_literal (error, GST_VULKAN_ERROR, VK_ERROR_FEATURE_NOT_PRESENT, + "Could not retrieve \"vkCreateXcbSurfaceKHR\" function pointer"); + return NULL; + } + err = - vkCreateXcbSurfaceKHR (window->display->instance->instance, &info, NULL, - &ret); + window_xcb->CreateXcbSurface (window->display->instance->instance, &info, + NULL, &ret); if (gst_vulkan_error_to_g_error (err, error, "vkCreateXcbSurfaceKHR") < 0) return NULL; @@ -229,14 +240,25 @@ static gboolean gst_vulkan_window_xcb_get_presentation_support (GstVulkanWindow * window, GstVulkanDevice * device, guint32 queue_family_idx) { + GstVulkanWindowXCB *window_xcb = GST_VULKAN_WINDOW_XCB (window); VkPhysicalDevice gpu; xcb_screen_t *screen; screen = GST_VULKAN_DISPLAY_XCB_SCREEN (window->display); + if (!window_xcb->GetPhysicalDeviceXcbPresentationSupport) + window_xcb->GetPhysicalDeviceXcbPresentationSupport = + gst_vulkan_instance_get_proc_address (window->display->instance, + "vkGetPhysicalDeviceXcbPresentationSupportKHR"); + if (!window_xcb->GetPhysicalDeviceXcbPresentationSupport) { + GST_WARNING_OBJECT (window, "Could not retrieve " + "\"vkGetPhysicalDeviceXcbPresentationSupportKHR\" " "function pointer"); + return FALSE; + } + gpu = gst_vulkan_device_get_physical_device (device); - if (vkGetPhysicalDeviceXcbPresentationSupportKHR (gpu, queue_family_idx, - GST_VULKAN_DISPLAY_XCB_CONNECTION (window->display), + if (window_xcb->GetPhysicalDeviceXcbPresentationSupport (gpu, + queue_family_idx, GST_VULKAN_DISPLAY_XCB_CONNECTION (window->display), screen->root_visual)) return TRUE; return FALSE; diff --git a/ext/vulkan/xcb/vkwindow_xcb.h b/ext/vulkan/xcb/vkwindow_xcb.h index 517a4889f..db012bb8b 100644 --- a/ext/vulkan/xcb/vkwindow_xcb.h +++ b/ext/vulkan/xcb/vkwindow_xcb.h @@ -53,6 +53,9 @@ struct _GstVulkanWindowXCB gint visible :1; + PFN_vkCreateXcbSurfaceKHR CreateXcbSurface; + PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR GetPhysicalDeviceXcbPresentationSupport; + /*< private >*/ GstVulkanWindowXCBPrivate *priv; |