• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2015-2021 The Khronos Group Inc.
3  * Copyright (c) 2015-2021 Valve Corporation
4  * Copyright (c) 2015-2021 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  * Author: Charles Giessen <charles@lunarg.com>
20  *
21  */
22 
23 #pragma once
24 
25 #include "loader_common.h"
26 
27 typedef struct {
28     // This union holds the data that drivers which use ICD interface version 2 and before expect. This is so they can dereference
29     // VkSurfaceKHR to get this struct and access the creation parameters used in subsequent API calls, such as get surface formats
30     // & get surface present modes.
31     // Thus, these members need to stay here in order to preserve ABI compatibility.
32     union {
33 #if defined(VK_USE_PLATFORM_WAYLAND_KHR)
34         VkIcdSurfaceWayland wayland_surf;
35 #endif  // VK_USE_PLATFORM_WAYLAND_KHR
36 #if defined(VK_USE_PLATFORM_WIN32_KHR)
37         VkIcdSurfaceWin32 win_surf;
38 #endif  // VK_USE_PLATFORM_WIN32_KHR
39 #if defined(VK_USE_PLATFORM_XCB_KHR)
40         VkIcdSurfaceXcb xcb_surf;
41 #endif  // VK_USE_PLATFORM_XCB_KHR
42 #if defined(VK_USE_PLATFORM_XLIB_KHR)
43         VkIcdSurfaceXlib xlib_surf;
44 #endif  // VK_USE_PLATFORM_XLIB_KHR
45 #if defined(VK_USE_PLATFORM_DIRECTFB_EXT)
46         VkIcdSurfaceDirectFB directfb_surf;
47 #endif  // VK_USE_PLATFORM_DIRECTFB_EXT
48 #if defined(VK_USE_PLATFORM_MACOS_MVK)
49         VkIcdSurfaceMacOS macos_surf;
50 #endif  // VK_USE_PLATFORM_MACOS_MVK
51 #if defined(VK_USE_PLATFORM_GGP)
52         VkIcdSurfaceGgp ggp_surf;
53 #endif  // VK_USE_PLATFORM_GGP
54 #if defined(VK_USE_PLATFORM_FUCHSIA)
55         VkIcdSurfaceImagePipe imagepipe_surf;
56 #endif  // VK_USE_PLATFORM_FUCHSIA
57 #if defined(VK_USE_PLATFORM_METAL_EXT)
58         VkIcdSurfaceMetal metal_surf;
59 #endif  // VK_USE_PLATFORM_METAL_EXT
60 #if defined(VK_USE_PLATFORM_SCREEN_QNX)
61         VkIcdSurfaceScreen screen_surf;
62 #endif  // VK_USE_PLATFORM_SCREEN_QNX
63 #if defined(VK_USE_PLATFORM_VI_NN)
64         VkIcdSurfaceVi vi_surf;
65 #endif  // VK_USE_PLATFORM_VI_NN
66         VkIcdSurfaceDisplay display_surf;
67         VkIcdSurfaceHeadless headless_surf;
68     };
69     uint32_t base_size;            // Size of VkIcdSurfaceBase
70     uint32_t platform_size;        // Size of corresponding VkIcdSurfaceXXX
71     uint32_t non_platform_offset;  // Start offset to base_size
72     uint32_t entire_size;          // Size of entire VkIcdSurface
73     uint32_t surface_index;        // This surface's index into each drivers list of created surfaces
74 } VkIcdSurface;
75 
76 bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr);
77 
78 void wsi_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo);
79 bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop);
80 
81 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateHeadlessSurfaceEXT(VkInstance instance,
82                                                                    const VkHeadlessSurfaceCreateInfoEXT *pCreateInfo,
83                                                                    const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
84 
85 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
86                                                              const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain);
87 
88 VKAPI_ATTR void VKAPI_CALL terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
89                                                         const VkAllocationCallbacks *pAllocator);
90 
91 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
92                                                                              uint32_t queueFamilyIndex, VkSurfaceKHR surface,
93                                                                              VkBool32 *pSupported);
94 
95 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice,
96                                                                                   VkSurfaceKHR surface,
97                                                                                   VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
98 
99 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
100                                                                              uint32_t *pSurfaceFormatCount,
101                                                                              VkSurfaceFormatKHR *pSurfaceFormats);
102 
103 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice,
104                                                                                   VkSurfaceKHR surface, uint32_t *pPresentModeCount,
105                                                                                   VkPresentModeKHR *pPresentModes);
106 
107 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface,
108                                                                                VkDeviceGroupPresentModeFlagsKHR *pModes);
109 
110 #if defined(VK_USE_PLATFORM_WIN32_KHR)
111 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
112                                                                 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
113 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice,
114                                                                                        uint32_t queueFamilyIndex);
115 #endif
116 #if defined(VK_USE_PLATFORM_WAYLAND_KHR)
117 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance instance,
118                                                                   const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
119                                                                   const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
120 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice,
121                                                                                          uint32_t queueFamilyIndex,
122                                                                                          struct wl_display *display);
123 #endif
124 #if defined(VK_USE_PLATFORM_XCB_KHR)
125 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
126                                                               const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
127 
128 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice,
129                                                                                      uint32_t queueFamilyIndex,
130                                                                                      xcb_connection_t *connection,
131                                                                                      xcb_visualid_t visual_id);
132 #endif
133 #if defined(VK_USE_PLATFORM_XLIB_KHR)
134 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
135                                                                const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
136 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice,
137                                                                                       uint32_t queueFamilyIndex, Display *dpy,
138                                                                                       VisualID visualID);
139 #endif
140 #if defined(VK_USE_PLATFORM_DIRECTFB_EXT)
141 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDirectFBSurfaceEXT(VkInstance instance,
142                                                                    const VkDirectFBSurfaceCreateInfoEXT *pCreateInfo,
143                                                                    const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
144 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceDirectFBPresentationSupportEXT(VkPhysicalDevice physicalDevice,
145                                                                                           uint32_t queueFamilyIndex,
146                                                                                           IDirectFB *dfb);
147 #endif
148 #if defined(VK_USE_PLATFORM_MACOS_MVK)
149 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK *pCreateInfo,
150                                                                 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
151 #endif
152 #if defined(VK_USE_PLATFORM_IOS_MVK)
153 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateIOSSurfaceMVK(VkInstance instance, const VkIOSSurfaceCreateInfoMVK *pCreateInfo,
154                                                               const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
155 #endif
156 #if defined(VK_USE_PLATFORM_GGP)
157 VKAPI_ATTR VkResult VKAPI_CALL
158 terminator_CreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP *pCreateInfo,
159                                             const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
160 #endif
161 #if defined(VK_USE_PLATFORM_METAL_EXT)
162 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMetalSurfaceEXT(VkInstance instance, const VkMetalSurfaceCreateInfoEXT *pCreateInfo,
163                                                                 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
164 #endif
165 #if defined(VK_USE_PLATFORM_SCREEN_QNX)
166 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateScreenSurfaceQNX(VkInstance instance,
167                                                                  const VkScreenSurfaceCreateInfoQNX *pCreateInfo,
168                                                                  const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
169 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceScreenPresentationSupportQNX(VkPhysicalDevice physicalDevice,
170                                                                                         uint32_t queueFamilyIndex,
171                                                                                         struct _screen_window *window);
172 #endif  // VK_USE_PLATFORM_SCREEN_QNX
173 #if defined(VK_USE_PLATFORM_VI_NN)
174 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateViSurfaceNN(VkInstance instance, const VkViSurfaceCreateInfoNN *pCreateInfo,
175                                                             const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
176 #endif  // VK_USE_PLATFORM_VI_NN
177 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice,
178                                                                                 uint32_t *pPropertyCount,
179                                                                                 VkDisplayPropertiesKHR *pProperties);
180 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice,
181                                                                                      uint32_t *pPropertyCount,
182                                                                                      VkDisplayPlanePropertiesKHR *pProperties);
183 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex,
184                                                                               uint32_t *pDisplayCount, VkDisplayKHR *pDisplays);
185 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display,
186                                                                       uint32_t *pPropertyCount,
187                                                                       VkDisplayModePropertiesKHR *pProperties);
188 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display,
189                                                                const VkDisplayModeCreateInfoKHR *pCreateInfo,
190                                                                const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode);
191 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode,
192                                                                          uint32_t planeIndex,
193                                                                          VkDisplayPlaneCapabilitiesKHR *pCapabilities);
194 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(VkInstance instance,
195                                                                        const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,
196                                                                        const VkAllocationCallbacks *pAllocator,
197                                                                        VkSurfaceKHR *pSurface);
198 
199 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
200                                                                     const VkSwapchainCreateInfoKHR *pCreateInfos,
201                                                                     const VkAllocationCallbacks *pAllocator,
202                                                                     VkSwapchainKHR *pSwapchains);
203 
204 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice,
205                                                                                 VkSurfaceKHR surface, uint32_t *pRectCount,
206                                                                                 VkRect2D *pRects);
207 
208 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice,
209                                                                                  uint32_t *pPropertyCount,
210                                                                                  VkDisplayProperties2KHR *pProperties);
211 
212 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlaneProperties2KHR(VkPhysicalDevice physicalDevice,
213                                                                                       uint32_t *pPropertyCount,
214                                                                                       VkDisplayPlaneProperties2KHR *pProperties);
215 
216 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModeProperties2KHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display,
217                                                                        uint32_t *pPropertyCount,
218                                                                        VkDisplayModeProperties2KHR *pProperties);
219 
220 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physicalDevice,
221                                                                           const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo,
222                                                                           VkDisplayPlaneCapabilities2KHR *pCapabilities);
223 #if defined(VK_USE_PLATFORM_FUCHSIA)
224 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateImagePipeSurfaceFUCHSIA(VkInstance instance,
225                                                                         const VkImagePipeSurfaceCreateInfoFUCHSIA *pCreateInfo,
226                                                                         const VkAllocationCallbacks *pAllocator,
227                                                                         VkSurfaceKHR *pSurface);
228 #endif
229 
230 #if defined(VK_USE_PLATFORM_ANDROID_KHR)
231 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR(VkInstance instance,
232                                                                   const VkAndroidSurfaceCreateInfoKHR *pCreateInfo,
233                                                                   const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
234 #endif
235 
236 #if defined(VK_USE_PLATFORM_OHOS)
237 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSurfaceOHOS(VkInstance instance,
238                                                                        const VkSurfaceCreateInfoOHOS* pCreateInfo,
239                                                                        const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
240 #endif
241 
242 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2KHR(
243     VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
244     VkSurfaceCapabilities2KHR *pSurfaceCapabilities);
245 
246 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice,
247                                                                               const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
248                                                                               uint32_t *pSurfaceFormatCount,
249                                                                               VkSurfaceFormat2KHR *pSurfaceFormats);
250