• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * GStreamer
3  * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef _VK_INSTANCE_H_
22 #define _VK_INSTANCE_H_
23 
24 #include <vk.h>
25 
26 G_BEGIN_DECLS
27 
28 #define GST_TYPE_VULKAN_INSTANCE         (gst_vulkan_instance_get_type())
29 #define GST_VULKAN_INSTANCE(o)           (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_VULKAN_INSTANCE, GstVulkanInstance))
30 #define GST_VULKAN_INSTANCE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_VULKAN_INSTANCE, GstVulkanInstanceClass))
31 #define GST_IS_VULKAN_INSTANCE(o)        (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_INSTANCE))
32 #define GST_IS_VULKAN_INSTANCE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_VULKAN_INSTANCE))
33 #define GST_VULKAN_INSTANCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_INSTANCE, GstVulkanInstanceClass))
34 GType gst_vulkan_instance_get_type       (void);
35 
36 #define GST_VULKAN_INSTANCE_CONTEXT_TYPE_STR "gst.vulkan.instance"
37 
38 struct _GstVulkanInstance
39 {
40   GstObject parent;
41 
42   VkInstance instance; /* hides a pointer */
43   VkPhysicalDevice *physical_devices; /* hides a pointer */
44   guint32 n_physical_devices;
45 
46   VkDebugReportCallbackEXT msg_callback;
47   PFN_vkCreateDebugReportCallbackEXT dbgCreateDebugReportCallback;
48   PFN_vkDestroyDebugReportCallbackEXT dbgDestroyDebugReportCallback;
49   PFN_vkDebugReportMessageEXT dbgReportMessage;
50 
51   GstVulkanInstancePrivate *priv;
52 };
53 
54 struct _GstVulkanInstanceClass
55 {
56   GstObjectClass parent_class;
57 };
58 
59 GstVulkanInstance * gst_vulkan_instance_new                     (void);
60 gboolean            gst_vulkan_instance_open                    (GstVulkanInstance * instance,
61                                                                  GError ** error);
62 
63 gpointer            gst_vulkan_instance_get_proc_address        (GstVulkanInstance * instance,
64                                                                  const gchar * name);
65 
66 GstVulkanDevice *   gst_vulkan_instance_create_device           (GstVulkanInstance * instance,
67                                                                  GError ** error);
68 
69 void                gst_context_set_vulkan_instance             (GstContext * context,
70                                                                  GstVulkanInstance * instance);
71 gboolean            gst_context_get_vulkan_instance             (GstContext * context,
72                                                                  GstVulkanInstance ** instance);
73 gboolean            gst_vulkan_instance_handle_context_query    (GstElement * element,
74                                                                  GstQuery * query,
75                                                                  GstVulkanInstance ** instance);
76 gboolean            gst_vulkan_instance_run_context_query       (GstElement * element,
77                                                                  GstVulkanInstance ** instance);
78 
79 G_END_DECLS
80 
81 #endif /* _VK_INSTANCE_H_ */
82