3 * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
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.
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.
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.
21 #ifndef _VK_SWAPPER_H_
22 #define _VK_SWAPPER_H_
24 #include <gst/video/video.h>
27 #include <vulkan/vk_ext_khr_swapchain.h>
28 #include <vulkan/vk_ext_khr_device_swapchain.h>
32 #define GST_TYPE_VULKAN_SWAPPER (gst_vulkan_swapper_get_type())
33 #define GST_VULKAN_SWAPPER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_VULKAN_SWAPPER, GstVulkanSwapper))
34 #define GST_VULKAN_SWAPPER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_VULKAN_SWAPPER, GstVulkanSwapperClass))
35 #define GST_IS_VULKAN_SWAPPER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_SWAPPER))
36 #define GST_IS_VULKAN_SWAPPER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_VULKAN_SWAPPER))
37 #define GST_VULKAN_SWAPPER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_SWAPPER, GstVulkanSwapperClass))
38 GType gst_vulkan_swapper_get_type (void);
40 struct _GstVulkanSwapper
44 GstVulkanDevice *device;
45 GstVulkanWindow *window;
46 GstVulkanQueue *queue;
48 VkSurfacePropertiesKHR surf_props;
49 VkSurfaceFormatKHR *surf_formats;
50 guint32 n_surf_formats;
51 VkPresentModeKHR *surf_present_modes;
52 guint32 n_surf_present_modes;
54 VkSwapchainKHR swap_chain;
55 GstVulkanImageMemory **swap_chain_images;
56 guint32 n_swap_chain_images;
61 PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
62 PFN_vkGetSurfacePropertiesKHR GetSurfacePropertiesKHR;
63 PFN_vkGetSurfaceFormatsKHR GetSurfaceFormatsKHR;
64 PFN_vkGetSurfacePresentModesKHR GetSurfacePresentModesKHR;
65 PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
66 PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
67 PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
68 PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
69 PFN_vkQueuePresentKHR QueuePresentKHR;
72 struct _GstVulkanSwapperClass
74 GstObjectClass parent_class;
77 GstVulkanSwapper * gst_vulkan_swapper_new (GstVulkanDevice * device,
78 GstVulkanWindow * window);
80 GstCaps * gst_vulkan_swapper_get_supported_caps (GstVulkanSwapper * swapper,
82 gboolean gst_vulkan_swapper_set_caps (GstVulkanSwapper * swapper,
85 gboolean gst_vulkan_swapper_render_buffer (GstVulkanSwapper * swapper,
91 #endif /* _VK_INSTANCE_H_ */