• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2015-2016 The Khronos Group Inc.
3  * Copyright (c) 2015-2016 Valve Corporation
4  * Copyright (c) 2015-2016 LunarG, Inc.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Author: Ian Elliott <ian@lunarg.com>
19  *
20  */
21 
22 #ifndef WSI_H
23 #define WSI_H
24 
25 #include "vk_loader_platform.h"
26 #include "loader.h"
27 
28 typedef struct {
29     union {
30 #ifdef VK_USE_PLATFORM_MIR_KHR
31         VkIcdSurfaceMir mir_surf;
32 #endif // VK_USE_PLATFORM_MIR_KHR
33 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
34         VkIcdSurfaceWayland wayland_surf;
35 #endif // VK_USE_PLATFORM_WAYLAND_KHR
36 #ifdef VK_USE_PLATFORM_WIN32_KHR
37         VkIcdSurfaceWin32 win_surf;
38 #endif // VK_USE_PLATFORM_WIN32_KHR
39 #ifdef VK_USE_PLATFORM_XCB_KHR
40         VkIcdSurfaceXcb xcb_surf;
41 #endif // VK_USE_PLATFORM_XCB_KHR
42 #ifdef VK_USE_PLATFORM_XLIB_KHR
43         VkIcdSurfaceXlib xlib_surf;
44 #endif // VK_USE_PLATFORM_XLIB_KHR
45         VkIcdSurfaceDisplay display_surf;
46     };
47     uint32_t base_size; // Size of VkIcdSurfaceBase
48     uint32_t platform_size; // Size of corresponding VkIcdSurfaceXXX
49     uint32_t non_platform_offset; // Start offset to base_size
50     uint32_t entire_size; // Size of entire VkIcdSurface
51     VkSurfaceKHR *real_icd_surfaces;
52 } VkIcdSurface;
53 
54 bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance,
55                                 const char *name, void **addr);
56 
57 void wsi_create_instance(struct loader_instance *ptr_instance,
58                          const VkInstanceCreateInfo *pCreateInfo);
59 bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop);
60 
61 VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSwapchainKHR(
62     VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
63     const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain);
64 
65 VKAPI_ATTR void VKAPI_CALL
66 terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
67                              const VkAllocationCallbacks *pAllocator);
68 
69 VKAPI_ATTR VkResult VKAPI_CALL
70 terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
71                                               uint32_t queueFamilyIndex,
72                                               VkSurfaceKHR surface,
73                                               VkBool32 *pSupported);
74 
75 VKAPI_ATTR VkResult VKAPI_CALL
76 terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR(
77     VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
78     VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
79 
80 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(
81     VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
82     uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats);
83 
84 VKAPI_ATTR VkResult VKAPI_CALL
85 terminator_GetPhysicalDeviceSurfacePresentModesKHR(
86     VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
87     uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes);
88 
89 #ifdef VK_USE_PLATFORM_WIN32_KHR
90 VKAPI_ATTR VkResult VKAPI_CALL
91 terminator_CreateWin32SurfaceKHR(VkInstance instance,
92                                  const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
93                                  const VkAllocationCallbacks *pAllocator,
94                                  VkSurfaceKHR *pSurface);
95 VKAPI_ATTR VkBool32 VKAPI_CALL
96 terminator_GetPhysicalDeviceWin32PresentationSupportKHR(
97     VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
98 #endif
99 #ifdef VK_USE_PLATFORM_MIR_KHR
100 VKAPI_ATTR VkResult VKAPI_CALL
101 terminator_CreateMirSurfaceKHR(VkInstance instance,
102                                const VkMirSurfaceCreateInfoKHR *pCreateInfo,
103                                const VkAllocationCallbacks *pAllocator,
104                                VkSurfaceKHR *pSurface);
105 VKAPI_ATTR VkBool32 VKAPI_CALL
106 terminator_GetPhysicalDeviceMirPresentationSupportKHR(
107     VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
108     MirConnection *connection);
109 #endif
110 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
111 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(
112     VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
113     const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
114 VKAPI_ATTR VkBool32 VKAPI_CALL
115 terminator_GetPhysicalDeviceWaylandPresentationSupportKHR(
116     VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
117     struct wl_display *display);
118 #endif
119 #ifdef VK_USE_PLATFORM_XCB_KHR
120 VKAPI_ATTR VkResult VKAPI_CALL
121 terminator_CreateXcbSurfaceKHR(VkInstance instance,
122                                const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
123                                const VkAllocationCallbacks *pAllocator,
124                                VkSurfaceKHR *pSurface);
125 
126 VKAPI_ATTR VkBool32 VKAPI_CALL
127 terminator_GetPhysicalDeviceXcbPresentationSupportKHR(
128     VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
129     xcb_connection_t *connection, xcb_visualid_t visual_id);
130 #endif
131 #ifdef VK_USE_PLATFORM_XLIB_KHR
132 VKAPI_ATTR VkResult VKAPI_CALL
133 terminator_CreateXlibSurfaceKHR(VkInstance instance,
134                                 const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
135                                 const VkAllocationCallbacks *pAllocator,
136                                 VkSurfaceKHR *pSurface);
137 VKAPI_ATTR VkBool32 VKAPI_CALL
138 terminator_GetPhysicalDeviceXlibPresentationSupportKHR(
139     VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy,
140     VisualID visualID);
141 #endif
142 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR(
143     VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount,
144     VkDisplayPropertiesKHR *pProperties);
145 VKAPI_ATTR VkResult VKAPI_CALL
146 terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR(
147     VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount,
148     VkDisplayPlanePropertiesKHR *pProperties);
149 VKAPI_ATTR VkResult VKAPI_CALL
150 terminator_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice,
151                                                uint32_t planeIndex,
152                                                uint32_t *pDisplayCount,
153                                                VkDisplayKHR *pDisplays);
154 VKAPI_ATTR VkResult VKAPI_CALL
155 terminator_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice,
156                                        VkDisplayKHR display,
157                                        uint32_t *pPropertyCount,
158                                        VkDisplayModePropertiesKHR *pProperties);
159 VKAPI_ATTR VkResult VKAPI_CALL
160 terminator_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice,
161                                 VkDisplayKHR display,
162                                 const VkDisplayModeCreateInfoKHR *pCreateInfo,
163                                 const VkAllocationCallbacks *pAllocator,
164                                 VkDisplayModeKHR *pMode);
165 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(
166     VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex,
167     VkDisplayPlaneCapabilitiesKHR *pCapabilities);
168 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(
169     VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,
170     const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
171 
172 #endif /* WSI_H */
173