Home | History | Annotate | Download | only in loader
      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 (at) 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, const char *name, void **addr);
     55 
     56 void wsi_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo);
     57 bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop);
     58 
     59 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
     60                                                              const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain);
     61 
     62 VKAPI_ATTR void VKAPI_CALL terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
     63                                                         const VkAllocationCallbacks *pAllocator);
     64 
     65 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
     66                                                                              uint32_t queueFamilyIndex, VkSurfaceKHR surface,
     67                                                                              VkBool32 *pSupported);
     68 
     69 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice,
     70                                                                                   VkSurfaceKHR surface,
     71                                                                                   VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
     72 
     73 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
     74                                                                              uint32_t *pSurfaceFormatCount,
     75                                                                              VkSurfaceFormatKHR *pSurfaceFormats);
     76 
     77 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice,
     78                                                                                   VkSurfaceKHR surface, uint32_t *pPresentModeCount,
     79                                                                                   VkPresentModeKHR *pPresentModes);
     80 
     81 #ifdef VK_USE_PLATFORM_WIN32_KHR
     82 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
     83                                                                 const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
     84 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice,
     85                                                                                        uint32_t queueFamilyIndex);
     86 #endif
     87 #ifdef VK_USE_PLATFORM_MIR_KHR
     88 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo,
     89                                                               const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
     90 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice,
     91                                                                                      uint32_t queueFamilyIndex,
     92                                                                                      MirConnection *connection);
     93 #endif
     94 #ifdef VK_USE_PLATFORM_WAYLAND_KHR
     95 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance instance,
     96                                                                   const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
     97                                                                   const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
     98 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice,
     99                                                                                          uint32_t queueFamilyIndex,
    100                                                                                          struct wl_display *display);
    101 #endif
    102 #ifdef VK_USE_PLATFORM_XCB_KHR
    103 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
    104                                                               const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
    105 
    106 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice,
    107                                                                                      uint32_t queueFamilyIndex,
    108                                                                                      xcb_connection_t *connection,
    109                                                                                      xcb_visualid_t visual_id);
    110 #endif
    111 #ifdef VK_USE_PLATFORM_XLIB_KHR
    112 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
    113                                                                const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
    114 VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice,
    115                                                                                       uint32_t queueFamilyIndex, Display *dpy,
    116                                                                                       VisualID visualID);
    117 #endif
    118 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice,
    119                                                                                 uint32_t *pPropertyCount,
    120                                                                                 VkDisplayPropertiesKHR *pProperties);
    121 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice,
    122                                                                                      uint32_t *pPropertyCount,
    123                                                                                      VkDisplayPlanePropertiesKHR *pProperties);
    124 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex,
    125                                                                               uint32_t *pDisplayCount, VkDisplayKHR *pDisplays);
    126 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display,
    127                                                                       uint32_t *pPropertyCount,
    128                                                                       VkDisplayModePropertiesKHR *pProperties);
    129 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display,
    130                                                                const VkDisplayModeCreateInfoKHR *pCreateInfo,
    131                                                                const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode);
    132 VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode,
    133                                                                          uint32_t planeIndex,
    134                                                                          VkDisplayPlaneCapabilitiesKHR *pCapabilities);
    135 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(VkInstance instance,
    136                                                                        const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,
    137                                                                        const VkAllocationCallbacks *pAllocator,
    138                                                                        VkSurfaceKHR *pSurface);
    139 
    140 VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
    141                                                                     const VkSwapchainCreateInfoKHR *pCreateInfos,
    142                                                                     const VkAllocationCallbacks *pAllocator,
    143                                                                     VkSwapchainKHR *pSwapchains);
    144 
    145 #endif // WSI_H
    146