Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (C) 2015 Valve Corporation |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | * Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be included |
| 13 | * in all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 | * DEALINGS IN THE SOFTWARE. |
| 22 | * |
| 23 | * Author: Ian Elliott <ian@lunarg.com> |
Ian Elliott | c2e9aee | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 24 | * Author: Ian Elliott <ianelliott@google.com> |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 25 | */ |
| 26 | |
| 27 | //#define _ISOC11_SOURCE /* for aligned_alloc() */ |
| 28 | #define _GNU_SOURCE |
| 29 | #include <stdlib.h> |
| 30 | #include <string.h> |
| 31 | #include "vk_loader_platform.h" |
| 32 | #include "loader.h" |
| 33 | #include "wsi.h" |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 34 | #include <vulkan/vk_icd.h> |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 35 | |
| 36 | static const VkExtensionProperties wsi_surface_extension_info = { |
| 37 | .extensionName = VK_KHR_SURFACE_EXTENSION_NAME, |
| 38 | .specVersion = VK_KHR_SURFACE_REVISION, |
| 39 | }; |
| 40 | |
Ian Elliott | c2e9aee | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 41 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 42 | static const VkExtensionProperties wsi_win32_surface_extension_info = { |
| 43 | .extensionName = VK_KHR_WIN32_SURFACE_EXTENSION_NAME, |
| 44 | .specVersion = VK_KHR_WIN32_SURFACE_REVISION, |
| 45 | }; |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 46 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 47 | |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 48 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 49 | static const VkExtensionProperties wsi_mir_surface_extension_info = { |
| 50 | .extensionName = VK_KHR_MIR_SURFACE_EXTENSION_NAME, |
| 51 | .specVersion = VK_KHR_MIR_SURFACE_REVISION, |
| 52 | }; |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 53 | #endif // VK_USE_PLATFORM_MIR_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 54 | |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 55 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 56 | static const VkExtensionProperties wsi_wayland_surface_extension_info = { |
| 57 | .extensionName = VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, |
| 58 | .specVersion = VK_KHR_WAYLAND_SURFACE_REVISION, |
| 59 | }; |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 60 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 61 | |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 62 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 63 | static const VkExtensionProperties wsi_xcb_surface_extension_info = { |
| 64 | .extensionName = VK_KHR_XCB_SURFACE_EXTENSION_NAME, |
| 65 | .specVersion = VK_KHR_XCB_SURFACE_REVISION, |
| 66 | }; |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 67 | #endif // VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 68 | |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 69 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 70 | static const VkExtensionProperties wsi_xlib_surface_extension_info = { |
| 71 | .extensionName = VK_KHR_XLIB_SURFACE_EXTENSION_NAME, |
| 72 | .specVersion = VK_KHR_XLIB_SURFACE_REVISION, |
| 73 | }; |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 74 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 75 | |
| 76 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 77 | static const VkExtensionProperties wsi_android_surface_extension_info = { |
| 78 | .extensionName = VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, |
| 79 | .specVersion = VK_KHR_ANDROID_SURFACE_REVISION, |
| 80 | }; |
| 81 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 82 | |
| 83 | void wsi_add_instance_extensions( |
| 84 | const struct loader_instance *inst, |
| 85 | struct loader_extension_list *ext_list) |
| 86 | { |
| 87 | loader_add_to_ext_list(inst, ext_list, 1, &wsi_surface_extension_info); |
Ian Elliott | c2e9aee | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 88 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 89 | loader_add_to_ext_list(inst, ext_list, 1, &wsi_win32_surface_extension_info); |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 90 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 91 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 92 | loader_add_to_ext_list(inst, ext_list, 1, &wsi_mir_surface_extension_info); |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 93 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 94 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 95 | loader_add_to_ext_list(inst, ext_list, 1, &wsi_wayland_surface_extension_info); |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 96 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 97 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 98 | loader_add_to_ext_list(inst, ext_list, 1, &wsi_xcb_surface_extension_info); |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 99 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 100 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 101 | loader_add_to_ext_list(inst, ext_list, 1, &wsi_xlib_surface_extension_info); |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 102 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 103 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 104 | loader_add_to_ext_list(inst, ext_list, 1, &wsi_android_surface_extension_info); |
| 105 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | void wsi_create_instance( |
| 109 | struct loader_instance *ptr_instance, |
| 110 | const VkInstanceCreateInfo *pCreateInfo) |
| 111 | { |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 112 | ptr_instance->wsi_surface_enabled = false; |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 113 | |
| 114 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 115 | ptr_instance->wsi_win32_surface_enabled = true; |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 116 | #endif // VK_USE_PLATFORM_WIN32_KHR |
| 117 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 118 | ptr_instance->wsi_mir_surface_enabled = false; |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 119 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 120 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 121 | ptr_instance->wsi_wayland_surface_enabled = false; |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 122 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 123 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 124 | ptr_instance->wsi_xcb_surface_enabled = false; |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 125 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 126 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 127 | ptr_instance->wsi_xlib_surface_enabled = false; |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 128 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 129 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 130 | ptr_instance->wsi_android_surface_enabled = false; |
| 131 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 132 | |
| 133 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionNameCount; i++) { |
| 134 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SURFACE_EXTENSION_NAME) == 0) { |
| 135 | ptr_instance->wsi_surface_enabled = true; |
Ian Elliott | c2e9aee | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 136 | continue; |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 137 | } |
Ian Elliott | c2e9aee | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 138 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 139 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) { |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 140 | ptr_instance->wsi_win32_surface_enabled = true; |
Ian Elliott | c2e9aee | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 141 | continue; |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 142 | } |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 143 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 144 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 145 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) { |
| 146 | ptr_instance->wsi_mir_surface_enabled = true; |
Ian Elliott | c2e9aee | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 147 | continue; |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 148 | } |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 149 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 150 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 151 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { |
| 152 | ptr_instance->wsi_wayland_surface_enabled = true; |
Ian Elliott | c2e9aee | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 153 | continue; |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 154 | } |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 155 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 156 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 157 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { |
| 158 | ptr_instance->wsi_xcb_surface_enabled = true; |
Ian Elliott | c2e9aee | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 159 | continue; |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 160 | } |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 161 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 162 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 163 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { |
| 164 | ptr_instance->wsi_xlib_surface_enabled = true; |
Ian Elliott | c2e9aee | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 165 | continue; |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 166 | } |
Ian Elliott | af7d636 | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 167 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 168 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 169 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { |
| 170 | ptr_instance->wsi_android_surface_enabled = true; |
| 171 | continue; |
| 172 | } |
| 173 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 174 | } |
| 175 | } |
| 176 | |
| 177 | /* |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 178 | * Functions for the VK_KHR_surface extension: |
| 179 | */ |
| 180 | |
| 181 | /* |
| 182 | * This is the trampoline entrypoint |
| 183 | * for DestroySurfaceKHR |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 184 | */ |
| 185 | LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR( |
| 186 | VkInstance instance, |
| 187 | VkSurfaceKHR surface, |
| 188 | const VkAllocationCallbacks* pAllocator) |
| 189 | { |
Ian Elliott | fb42cd7 | 2015-11-25 14:43:02 -0700 | [diff] [blame] | 190 | const VkLayerInstanceDispatchTable *disp; |
| 191 | disp = loader_get_instance_dispatch(instance); |
| 192 | disp->DestroySurfaceKHR(instance, surface, pAllocator); |
| 193 | } |
| 194 | |
| 195 | /* |
| 196 | * This is the instance chain terminator function |
| 197 | * for DestroySurfaceKHR |
| 198 | */ |
| 199 | VKAPI_ATTR void VKAPI_CALL loader_DestroySurfaceKHR( |
| 200 | VkInstance instance, |
| 201 | VkSurfaceKHR surface, |
| 202 | const VkAllocationCallbacks* pAllocator) |
| 203 | { |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 204 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
| 205 | |
| 206 | loader_heap_free(ptr_instance, surface); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | /* |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 210 | * This is the trampoline entrypoint |
| 211 | * for GetPhysicalDeviceSurfaceSupportKHR |
| 212 | */ |
Ian Elliott | 83e6aa9 | 2015-11-19 12:37:51 -0700 | [diff] [blame] | 213 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR( |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 214 | VkPhysicalDevice physicalDevice, |
| 215 | uint32_t queueFamilyIndex, |
| 216 | VkSurfaceKHR surface, |
| 217 | VkBool32* pSupported) |
| 218 | { |
| 219 | const VkLayerInstanceDispatchTable *disp; |
| 220 | disp = loader_get_instance_dispatch(physicalDevice); |
| 221 | VkResult res = disp->GetPhysicalDeviceSurfaceSupportKHR( |
| 222 | physicalDevice, |
| 223 | queueFamilyIndex, |
| 224 | surface, |
| 225 | pSupported); |
| 226 | return res; |
| 227 | } |
| 228 | |
| 229 | /* |
| 230 | * This is the instance chain terminator function |
| 231 | * for GetPhysicalDeviceSurfaceSupportKHR |
| 232 | */ |
| 233 | VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceSurfaceSupportKHR( |
| 234 | VkPhysicalDevice physicalDevice, |
| 235 | uint32_t queueFamilyIndex, |
| 236 | VkSurfaceKHR surface, |
| 237 | VkBool32* pSupported) |
| 238 | { |
| 239 | struct loader_physical_device *phys_dev = (struct loader_physical_device *) physicalDevice; |
| 240 | struct loader_icd *icd = phys_dev->this_icd; |
| 241 | |
| 242 | assert(pSupported && "GetPhysicalDeviceSurfaceSupportKHR: Error, null pSupported"); |
| 243 | *pSupported = false; |
| 244 | |
| 245 | assert(icd->GetPhysicalDeviceSurfaceSupportKHR && "loader: null GetPhysicalDeviceSurfaceSupportKHR ICD pointer"); |
| 246 | |
| 247 | return icd->GetPhysicalDeviceSurfaceSupportKHR(phys_dev->phys_dev, |
| 248 | queueFamilyIndex, |
| 249 | surface, |
| 250 | pSupported); |
| 251 | } |
| 252 | |
Ian Elliott | 486c550 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 253 | /* |
| 254 | * This is the trampoline entrypoint |
| 255 | * for GetPhysicalDeviceSurfaceCapabilitiesKHR |
| 256 | */ |
| 257 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR( |
| 258 | VkPhysicalDevice physicalDevice, |
| 259 | VkSurfaceKHR surface, |
| 260 | VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) |
| 261 | { |
| 262 | const VkLayerInstanceDispatchTable *disp; |
| 263 | disp = loader_get_instance_dispatch(physicalDevice); |
| 264 | VkResult res = disp->GetPhysicalDeviceSurfaceCapabilitiesKHR( |
| 265 | physicalDevice, |
| 266 | surface, |
| 267 | pSurfaceCapabilities); |
| 268 | return res; |
| 269 | } |
| 270 | |
| 271 | /* |
| 272 | * This is the instance chain terminator function |
| 273 | * for GetPhysicalDeviceSurfaceCapabilitiesKHR |
| 274 | */ |
| 275 | VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceSurfaceCapabilitiesKHR( |
| 276 | VkPhysicalDevice physicalDevice, |
| 277 | VkSurfaceKHR surface, |
| 278 | VkSurfaceCapabilitiesKHR* pSurfaceCapabilities) |
| 279 | { |
| 280 | struct loader_physical_device *phys_dev = (struct loader_physical_device *) physicalDevice; |
| 281 | struct loader_icd *icd = phys_dev->this_icd; |
| 282 | |
| 283 | assert(pSurfaceCapabilities && "GetPhysicalDeviceSurfaceCapabilitiesKHR: Error, null pSurfaceCapabilities"); |
| 284 | |
| 285 | assert(icd->GetPhysicalDeviceSurfaceCapabilitiesKHR && "loader: null GetPhysicalDeviceSurfaceCapabilitiesKHR ICD pointer"); |
| 286 | |
| 287 | return icd->GetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev->phys_dev, |
| 288 | surface, |
| 289 | pSurfaceCapabilities); |
| 290 | } |
| 291 | |
| 292 | /* |
| 293 | * This is the trampoline entrypoint |
| 294 | * for GetPhysicalDeviceSurfaceFormatsKHR |
| 295 | */ |
| 296 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR( |
| 297 | VkPhysicalDevice physicalDevice, |
| 298 | VkSurfaceKHR surface, |
| 299 | uint32_t* pSurfaceFormatCount, |
| 300 | VkSurfaceFormatKHR* pSurfaceFormats) |
| 301 | { |
| 302 | const VkLayerInstanceDispatchTable *disp; |
| 303 | disp = loader_get_instance_dispatch(physicalDevice); |
| 304 | VkResult res = disp->GetPhysicalDeviceSurfaceFormatsKHR( |
| 305 | physicalDevice, |
| 306 | surface, |
| 307 | pSurfaceFormatCount, |
| 308 | pSurfaceFormats); |
| 309 | return res; |
| 310 | } |
| 311 | |
| 312 | /* |
| 313 | * This is the instance chain terminator function |
| 314 | * for GetPhysicalDeviceSurfaceFormatsKHR |
| 315 | */ |
| 316 | VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceSurfaceFormatsKHR( |
| 317 | VkPhysicalDevice physicalDevice, |
| 318 | VkSurfaceKHR surface, |
| 319 | uint32_t* pSurfaceFormatCount, |
| 320 | VkSurfaceFormatKHR* pSurfaceFormats) |
| 321 | { |
| 322 | struct loader_physical_device *phys_dev = (struct loader_physical_device *) physicalDevice; |
| 323 | struct loader_icd *icd = phys_dev->this_icd; |
| 324 | |
| 325 | assert(pSurfaceFormatCount && "GetPhysicalDeviceSurfaceFormatsKHR: Error, null pSurfaceFormatCount"); |
| 326 | |
| 327 | assert(icd->GetPhysicalDeviceSurfaceFormatsKHR && "loader: null GetPhysicalDeviceSurfaceFormatsKHR ICD pointer"); |
| 328 | |
| 329 | return icd->GetPhysicalDeviceSurfaceFormatsKHR(phys_dev->phys_dev, |
| 330 | surface, |
| 331 | pSurfaceFormatCount, |
| 332 | pSurfaceFormats); |
| 333 | } |
| 334 | |
| 335 | /* |
| 336 | * This is the trampoline entrypoint |
| 337 | * for GetPhysicalDeviceSurfacePresentModesKHR |
| 338 | */ |
| 339 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR( |
| 340 | VkPhysicalDevice physicalDevice, |
| 341 | VkSurfaceKHR surface, |
| 342 | uint32_t* pPresentModeCount, |
| 343 | VkPresentModeKHR* pPresentModes) |
| 344 | { |
| 345 | const VkLayerInstanceDispatchTable *disp; |
| 346 | disp = loader_get_instance_dispatch(physicalDevice); |
| 347 | VkResult res = disp->GetPhysicalDeviceSurfacePresentModesKHR( |
| 348 | physicalDevice, |
| 349 | surface, |
| 350 | pPresentModeCount, |
| 351 | pPresentModes); |
| 352 | return res; |
| 353 | } |
| 354 | |
| 355 | /* |
| 356 | * This is the instance chain terminator function |
| 357 | * for GetPhysicalDeviceSurfacePresentModesKHR |
| 358 | */ |
| 359 | VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceSurfacePresentModesKHR( |
| 360 | VkPhysicalDevice physicalDevice, |
| 361 | VkSurfaceKHR surface, |
| 362 | uint32_t* pPresentModeCount, |
| 363 | VkPresentModeKHR* pPresentModes) |
| 364 | { |
| 365 | struct loader_physical_device *phys_dev = (struct loader_physical_device *) physicalDevice; |
| 366 | struct loader_icd *icd = phys_dev->this_icd; |
| 367 | |
| 368 | assert(pPresentModeCount && "GetPhysicalDeviceSurfacePresentModesKHR: Error, null pPresentModeCount"); |
| 369 | |
| 370 | assert(icd->GetPhysicalDeviceSurfacePresentModesKHR && "loader: null GetPhysicalDeviceSurfacePresentModesKHR ICD pointer"); |
| 371 | |
| 372 | return icd->GetPhysicalDeviceSurfacePresentModesKHR(phys_dev->phys_dev, |
| 373 | surface, |
| 374 | pPresentModeCount, |
| 375 | pPresentModes); |
| 376 | } |
| 377 | |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 378 | |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 379 | /* |
| 380 | * Functions for the VK_KHR_swapchain extension: |
| 381 | */ |
| 382 | |
Ian Elliott | 934d0d5 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 383 | /* |
| 384 | * This is the trampoline entrypoint |
| 385 | * for CreateSwapchainKHR |
| 386 | */ |
| 387 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR( |
| 388 | VkDevice device, |
| 389 | const VkSwapchainCreateInfoKHR* pCreateInfo, |
| 390 | const VkAllocationCallbacks* pAllocator, |
| 391 | VkSwapchainKHR* pSwapchain) |
| 392 | { |
| 393 | const VkLayerDispatchTable *disp; |
| 394 | disp = loader_get_dispatch(device); |
| 395 | VkResult res = disp->CreateSwapchainKHR( |
| 396 | device, |
| 397 | pCreateInfo, |
| 398 | pAllocator, |
| 399 | pSwapchain); |
| 400 | return res; |
| 401 | } |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 402 | |
Ian Elliott | 934d0d5 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 403 | /* |
| 404 | * This is the trampoline entrypoint |
| 405 | * for DestroySwapchainKHR |
| 406 | */ |
| 407 | LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR( |
| 408 | VkDevice device, |
| 409 | VkSwapchainKHR swapchain, |
| 410 | const VkAllocationCallbacks* pAllocator) |
| 411 | { |
| 412 | const VkLayerDispatchTable *disp; |
| 413 | disp = loader_get_dispatch(device); |
| 414 | disp->DestroySwapchainKHR(device, swapchain, pAllocator); |
| 415 | } |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 416 | |
Ian Elliott | 934d0d5 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 417 | /* |
| 418 | * This is the trampoline entrypoint |
| 419 | * for GetSwapchainImagesKHR |
| 420 | */ |
| 421 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR( |
| 422 | VkDevice device, |
| 423 | VkSwapchainKHR swapchain, |
| 424 | uint32_t* pSwapchainImageCount, |
| 425 | VkImage* pSwapchainImages) |
| 426 | { |
| 427 | const VkLayerDispatchTable *disp; |
| 428 | disp = loader_get_dispatch(device); |
| 429 | VkResult res = disp->GetSwapchainImagesKHR( |
| 430 | device, |
| 431 | swapchain, |
| 432 | pSwapchainImageCount, |
| 433 | pSwapchainImages); |
| 434 | return res; |
| 435 | } |
| 436 | |
| 437 | /* |
| 438 | * This is the trampoline entrypoint |
| 439 | * for AcquireNextImageKHR |
| 440 | */ |
| 441 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR( |
| 442 | VkDevice device, |
| 443 | VkSwapchainKHR swapchain, |
| 444 | uint64_t timeout, |
| 445 | VkSemaphore semaphore, |
| 446 | VkFence fence, |
| 447 | uint32_t* pImageIndex) |
| 448 | { |
| 449 | const VkLayerDispatchTable *disp; |
| 450 | disp = loader_get_dispatch(device); |
| 451 | VkResult res = disp->AcquireNextImageKHR( |
| 452 | device, |
| 453 | swapchain, |
| 454 | timeout, |
| 455 | semaphore, |
| 456 | fence, |
| 457 | pImageIndex); |
| 458 | return res; |
| 459 | } |
| 460 | |
| 461 | /* |
| 462 | * This is the trampoline entrypoint |
| 463 | * for QueuePresentKHR |
| 464 | */ |
| 465 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR( |
| 466 | VkQueue queue, |
| 467 | const VkPresentInfoKHR* pPresentInfo) |
| 468 | { |
| 469 | const VkLayerDispatchTable *disp; |
| 470 | disp = loader_get_dispatch(queue); |
| 471 | VkResult res = disp->QueuePresentKHR(queue, pPresentInfo); |
| 472 | return res; |
| 473 | } |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 474 | |
| 475 | |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 476 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 477 | |
| 478 | /* |
| 479 | * Functions for the VK_KHR_win32_surface extension: |
| 480 | */ |
| 481 | |
| 482 | /* |
| 483 | * This is the trampoline entrypoint |
| 484 | * for CreateWin32SurfaceKHR |
| 485 | */ |
| 486 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR( |
| 487 | VkInstance instance, |
| 488 | HINSTANCE hinstance, |
| 489 | HWND hwnd, |
| 490 | const VkAllocationCallbacks* pAllocator, |
| 491 | VkSurfaceKHR* pSurface) |
| 492 | { |
Jon Ashburn | f72a04b | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 493 | const VkLayerInstanceDispatchTable *disp; |
| 494 | disp = loader_get_instance_dispatch(instance); |
| 495 | VkResult res; |
| 496 | |
| 497 | res = disp->CreateWin32SurfaceKHR(instance, hinstance, hwnd, pAllocator, pSurface); |
| 498 | return res; |
| 499 | } |
| 500 | |
| 501 | /* |
| 502 | * This is the instance chain terminator function |
| 503 | * for CreateWin32SurfaceKHR |
| 504 | */ |
| 505 | VKAPI_ATTR VkResult VKAPI_CALL loader_CreateWin32SurfaceKHR( |
| 506 | VkInstance instance, |
| 507 | HINSTANCE hinstance, |
| 508 | HWND hwnd, |
| 509 | const VkAllocationCallbacks* pAllocator, |
| 510 | VkSurfaceKHR* pSurface) |
| 511 | { |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 512 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 513 | VkIcdSurfaceWin32 *pIcdSurface = NULL; |
| 514 | |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 515 | pIcdSurface = loader_heap_alloc(ptr_instance, |
| 516 | sizeof(VkIcdSurfaceWin32), |
| 517 | VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 518 | if (pIcdSurface == NULL) { |
| 519 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 520 | } |
| 521 | |
| 522 | pIcdSurface->base.platform = VK_ICD_WSI_PLATFORM_WIN32; |
| 523 | pIcdSurface->hinstance = hinstance; |
| 524 | pIcdSurface->hwnd = hwnd; |
| 525 | |
| 526 | *pSurface = (VkSurfaceKHR) pIcdSurface; |
| 527 | |
| 528 | return VK_SUCCESS; |
| 529 | } |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 530 | |
| 531 | /* |
| 532 | * This is the trampoline entrypoint |
| 533 | * for GetPhysicalDeviceWin32PresentationSupportKHR |
| 534 | */ |
| 535 | LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR( |
| 536 | VkPhysicalDevice physicalDevice, |
| 537 | uint32_t queueFamilyIndex) |
| 538 | { |
| 539 | const VkLayerInstanceDispatchTable *disp; |
| 540 | disp = loader_get_instance_dispatch(physicalDevice); |
| 541 | VkBool32 res = disp->GetPhysicalDeviceWin32PresentationSupportKHR( |
| 542 | physicalDevice, |
| 543 | queueFamilyIndex); |
| 544 | return res; |
| 545 | } |
| 546 | |
| 547 | |
| 548 | /* |
| 549 | * This is the instance chain terminator function |
| 550 | * for GetPhysicalDeviceWin32PresentationSupportKHR |
| 551 | */ |
| 552 | VKAPI_ATTR VkBool32 VKAPI_CALL loader_GetPhysicalDeviceWin32PresentationSupportKHR( |
| 553 | VkPhysicalDevice physicalDevice, |
| 554 | uint32_t queueFamilyIndex) |
| 555 | { |
| 556 | struct loader_physical_device *phys_dev = (struct loader_physical_device *) physicalDevice; |
| 557 | struct loader_icd *icd = phys_dev->this_icd; |
| 558 | |
Mark Lobodzinski | 6592365 | 2015-11-24 15:49:46 -0700 | [diff] [blame] | 559 | assert(icd->GetPhysicalDeviceWin32PresentationSupportKHR && "loader: null GetPhysicalDeviceWin32PresentationSupportKHR ICD pointer"); |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 560 | |
| 561 | return icd->GetPhysicalDeviceWin32PresentationSupportKHR(phys_dev->phys_dev, |
| 562 | queueFamilyIndex); |
| 563 | } |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 564 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 565 | |
| 566 | #ifdef VK_USE_PLATFORM_MIR_KHR |
| 567 | |
| 568 | /* |
| 569 | * Functions for the VK_KHR_mir_surface extension: |
| 570 | */ |
| 571 | |
| 572 | /* |
| 573 | * This is the trampoline entrypoint |
| 574 | * for CreateMirSurfaceKHR |
| 575 | */ |
| 576 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR( |
| 577 | VkInstance instance, |
| 578 | MirConnection* connection, |
| 579 | MirSurface* mirSurface, |
| 580 | const VkAllocationCallbacks* pAllocator, |
| 581 | VkSurfaceKHR* pSurface) |
| 582 | { |
Jon Ashburn | f72a04b | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 583 | const VkLayerInstanceDispatchTable *disp; |
| 584 | disp = loader_get_instance_dispatch(instance); |
| 585 | VkResult res; |
| 586 | |
| 587 | res = disp->CreateMirSurfaceKHR(instance, connection, mirSurface, pAllocator, pSurface); |
| 588 | return res; |
| 589 | } |
| 590 | |
| 591 | /* |
| 592 | * This is the instance chain terminator function |
| 593 | * for CreateMirSurfaceKHR |
| 594 | */ |
| 595 | VKAPI_ATTR VkResult VKAPI_CALL loader_CreateMirSurfaceKHR( |
| 596 | VkInstance instance, |
| 597 | Display* dpy, |
| 598 | Window window, |
| 599 | const VkAllocationCallbacks* pAllocator, |
| 600 | VkSurfaceKHR* pSurface) |
| 601 | { |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 602 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 603 | VkIcdSurfaceMir *pIcdSurface = NULL; |
| 604 | |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 605 | pIcdSurface = loader_heap_alloc(ptr_instance, |
| 606 | sizeof(VkIcdSurfaceMir), |
| 607 | VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 608 | if (pIcdSurface == NULL) { |
| 609 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 610 | } |
| 611 | |
| 612 | pIcdSurface->base.platform = VK_ICD_WSI_PLATFORM_MIR; |
| 613 | pIcdSurface->connection = connection; |
| 614 | pIcdSurface->mirSurface = mirSurface; |
| 615 | |
| 616 | *pSurface = (VkSurfaceKHR) pIcdSurface; |
| 617 | |
| 618 | return VK_SUCCESS; |
| 619 | } |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 620 | |
| 621 | /* |
| 622 | * This is the trampoline entrypoint |
| 623 | * for GetPhysicalDeviceMirPresentationSupportKHR |
| 624 | */ |
| 625 | LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR( |
| 626 | VkPhysicalDevice physicalDevice, |
| 627 | uint32_t queueFamilyIndex, |
| 628 | MirConnection* connection) |
| 629 | { |
| 630 | const VkLayerInstanceDispatchTable *disp; |
| 631 | disp = loader_get_instance_dispatch(physicalDevice); |
| 632 | VkBool32 res = disp->GetPhysicalDeviceMirPresentationSupportKHR( |
| 633 | physicalDevice, |
| 634 | queueFamilyIndex, |
| 635 | connection); |
| 636 | return res; |
| 637 | } |
| 638 | |
| 639 | |
| 640 | /* |
| 641 | * This is the instance chain terminator function |
| 642 | * for GetPhysicalDeviceMirPresentationSupportKHR |
| 643 | */ |
| 644 | VKAPI_ATTR VkBool32 VKAPI_CALL loader_GetPhysicalDeviceMirPresentationSupportKHR( |
| 645 | VkPhysicalDevice physicalDevice, |
| 646 | uint32_t queueFamilyIndex, |
| 647 | MirConnection* connection) |
| 648 | { |
| 649 | struct loader_physical_device *phys_dev = (struct loader_physical_device *) physicalDevice; |
| 650 | struct loader_icd *icd = phys_dev->this_icd; |
| 651 | |
| 652 | assert(icd->GetPhysicalDeviceMirPresentationSupportKHR && "loader: null GetPhysicalDeviceMirPresentationSupportKHR ICD pointer"); |
| 653 | |
| 654 | return icd->GetPhysicalDeviceMirPresentationSupportKHR(phys_dev->phys_dev, |
| 655 | queueFamilyIndex, |
| 656 | connection); |
| 657 | } |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 658 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 659 | |
| 660 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 661 | |
| 662 | /* |
| 663 | * Functions for the VK_KHR_wayland_surface extension: |
| 664 | */ |
| 665 | |
| 666 | /* |
| 667 | * This is the trampoline entrypoint |
| 668 | * for CreateWaylandSurfaceKHR |
| 669 | */ |
| 670 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( |
| 671 | VkInstance instance, |
| 672 | struct wl_display* display, |
| 673 | struct wl_surface* surface, |
| 674 | const VkAllocationCallbacks* pAllocator, |
| 675 | VkSurfaceKHR* pSurface) |
| 676 | { |
Jon Ashburn | f72a04b | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 677 | const VkLayerInstanceDispatchTable *disp; |
| 678 | disp = loader_get_instance_dispatch(instance); |
| 679 | VkResult res; |
| 680 | |
| 681 | res = disp->CreateWaylandSurfaceKHR(instance, display, surface, pAllocator, pSurface); |
| 682 | return res; |
| 683 | } |
| 684 | |
| 685 | /* |
| 686 | * This is the instance chain terminator function |
| 687 | * for CreateXlibSurfaceKHR |
| 688 | */ |
| 689 | VKAPI_ATTR VkResult VKAPI_CALL loader_CreateWaylandSurfaceKHR( |
| 690 | VkInstance instance, |
| 691 | struct wl_display* display, |
| 692 | struct wl_surface* surface, |
| 693 | const VkAllocationCallbacks* pAllocator, |
| 694 | VkSurfaceKHR* pSurface) |
| 695 | { |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 696 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 697 | VkIcdSurfaceWayland *pIcdSurface = NULL; |
| 698 | |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 699 | pIcdSurface = loader_heap_alloc(ptr_instance, |
| 700 | sizeof(VkIcdSurfaceWayland), |
| 701 | VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 702 | if (pIcdSurface == NULL) { |
| 703 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 704 | } |
| 705 | |
| 706 | pIcdSurface->base.platform = VK_ICD_WSI_PLATFORM_WAYLAND; |
| 707 | pIcdSurface->display = display; |
| 708 | pIcdSurface->surface = surface; |
| 709 | |
| 710 | *pSurface = (VkSurfaceKHR) pIcdSurface; |
| 711 | |
| 712 | return VK_SUCCESS; |
| 713 | } |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 714 | |
| 715 | /* |
| 716 | * This is the trampoline entrypoint |
| 717 | * for GetPhysicalDeviceWaylandPresentationSupportKHR |
| 718 | */ |
| 719 | LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR( |
| 720 | VkPhysicalDevice physicalDevice, |
| 721 | uint32_t queueFamilyIndex, |
| 722 | struct wl_display* display) |
| 723 | { |
| 724 | const VkLayerInstanceDispatchTable *disp; |
| 725 | disp = loader_get_instance_dispatch(physicalDevice); |
| 726 | VkBool32 res = disp->GetPhysicalDeviceWaylandPresentationSupportKHR( |
| 727 | physicalDevice, |
| 728 | queueFamilyIndex, |
| 729 | display); |
| 730 | return res; |
| 731 | } |
| 732 | |
| 733 | |
| 734 | /* |
| 735 | * This is the instance chain terminator function |
| 736 | * for GetPhysicalDeviceWaylandPresentationSupportKHR |
| 737 | */ |
| 738 | VKAPI_ATTR VkBool32 VKAPI_CALL loader_GetPhysicalDeviceWaylandPresentationSupportKHR( |
| 739 | VkPhysicalDevice physicalDevice, |
| 740 | uint32_t queueFamilyIndex, |
| 741 | struct wl_display* display) |
| 742 | { |
| 743 | struct loader_physical_device *phys_dev = (struct loader_physical_device *) physicalDevice; |
| 744 | struct loader_icd *icd = phys_dev->this_icd; |
| 745 | |
| 746 | assert(icd->GetPhysicalDeviceWaylandPresentationSupportKHR && "loader: null GetPhysicalDeviceWaylandPresentationSupportKHR ICD pointer"); |
| 747 | |
| 748 | return icd->GetPhysicalDeviceWaylandPresentationSupportKHR(phys_dev->phys_dev, |
| 749 | queueFamilyIndex, |
| 750 | display); |
| 751 | } |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 752 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 753 | |
| 754 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 755 | |
| 756 | /* |
| 757 | * Functions for the VK_KHR_xcb_surface extension: |
| 758 | */ |
| 759 | |
| 760 | /* |
| 761 | * This is the trampoline entrypoint |
| 762 | * for CreateXcbSurfaceKHR |
| 763 | */ |
| 764 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( |
| 765 | VkInstance instance, |
| 766 | xcb_connection_t* connection, |
| 767 | xcb_window_t window, |
| 768 | const VkAllocationCallbacks* pAllocator, |
| 769 | VkSurfaceKHR* pSurface) |
| 770 | { |
Jon Ashburn | f72a04b | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 771 | const VkLayerInstanceDispatchTable *disp; |
| 772 | disp = loader_get_instance_dispatch(instance); |
| 773 | VkResult res; |
| 774 | |
| 775 | res = disp->CreateXcbSurfaceKHR(instance, connection, window, pAllocator, pSurface); |
| 776 | return res; |
| 777 | } |
| 778 | |
| 779 | /* |
| 780 | * This is the instance chain terminator function |
| 781 | * for CreateXcbSurfaceKHR |
| 782 | */ |
| 783 | VKAPI_ATTR VkResult VKAPI_CALL loader_CreateXcbSurfaceKHR( |
| 784 | VkInstance instance, |
| 785 | xcb_connection_t* connection, |
| 786 | xcb_window_t window, |
| 787 | const VkAllocationCallbacks* pAllocator, |
| 788 | VkSurfaceKHR* pSurface) |
| 789 | { |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 790 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 791 | VkIcdSurfaceXcb *pIcdSurface = NULL; |
| 792 | |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 793 | pIcdSurface = loader_heap_alloc(ptr_instance, |
| 794 | sizeof(VkIcdSurfaceXcb), |
| 795 | VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 796 | if (pIcdSurface == NULL) { |
| 797 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 798 | } |
| 799 | |
| 800 | pIcdSurface->base.platform = VK_ICD_WSI_PLATFORM_XCB; |
| 801 | pIcdSurface->connection = connection; |
| 802 | pIcdSurface->window = window; |
| 803 | |
| 804 | *pSurface = (VkSurfaceKHR) pIcdSurface; |
| 805 | |
| 806 | return VK_SUCCESS; |
| 807 | } |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 808 | |
| 809 | /* |
| 810 | * This is the trampoline entrypoint |
| 811 | * for GetPhysicalDeviceXcbPresentationSupportKHR |
| 812 | */ |
| 813 | LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( |
| 814 | VkPhysicalDevice physicalDevice, |
| 815 | uint32_t queueFamilyIndex, |
| 816 | xcb_connection_t* connection, |
| 817 | xcb_visualid_t visual_id) |
| 818 | { |
| 819 | const VkLayerInstanceDispatchTable *disp; |
| 820 | disp = loader_get_instance_dispatch(physicalDevice); |
| 821 | VkBool32 res = disp->GetPhysicalDeviceXcbPresentationSupportKHR( |
| 822 | physicalDevice, |
| 823 | queueFamilyIndex, |
| 824 | connection, |
| 825 | visual_id); |
| 826 | return res; |
| 827 | } |
| 828 | |
| 829 | |
| 830 | /* |
| 831 | * This is the instance chain terminator function |
| 832 | * for GetPhysicalDeviceXcbPresentationSupportKHR |
| 833 | */ |
| 834 | VKAPI_ATTR VkBool32 VKAPI_CALL loader_GetPhysicalDeviceXcbPresentationSupportKHR( |
| 835 | VkPhysicalDevice physicalDevice, |
| 836 | uint32_t queueFamilyIndex, |
| 837 | xcb_connection_t* connection, |
| 838 | xcb_visualid_t visual_id) |
| 839 | { |
| 840 | struct loader_physical_device *phys_dev = (struct loader_physical_device *) physicalDevice; |
| 841 | struct loader_icd *icd = phys_dev->this_icd; |
| 842 | |
| 843 | assert(icd->GetPhysicalDeviceXcbPresentationSupportKHR && "loader: null GetPhysicalDeviceXcbPresentationSupportKHR ICD pointer"); |
| 844 | |
| 845 | return icd->GetPhysicalDeviceXcbPresentationSupportKHR(phys_dev->phys_dev, |
| 846 | queueFamilyIndex, |
| 847 | connection, |
| 848 | visual_id); |
| 849 | } |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 850 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 851 | |
| 852 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 853 | |
| 854 | /* |
| 855 | * Functions for the VK_KHR_xlib_surface extension: |
| 856 | */ |
| 857 | |
| 858 | /* |
| 859 | * This is the trampoline entrypoint |
| 860 | * for CreateXlibSurfaceKHR |
| 861 | */ |
| 862 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( |
| 863 | VkInstance instance, |
| 864 | Display* dpy, |
| 865 | Window window, |
| 866 | const VkAllocationCallbacks* pAllocator, |
| 867 | VkSurfaceKHR* pSurface) |
| 868 | { |
Jon Ashburn | f72a04b | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 869 | const VkLayerInstanceDispatchTable *disp; |
| 870 | disp = loader_get_instance_dispatch(instance); |
| 871 | VkResult res; |
| 872 | |
| 873 | res = disp->CreateXlibSurfaceKHR(instance, dpy, window, pAllocator, pSurface); |
| 874 | return res; |
| 875 | } |
| 876 | |
| 877 | /* |
| 878 | * This is the instance chain terminator function |
| 879 | * for CreateXlibSurfaceKHR |
| 880 | */ |
| 881 | VKAPI_ATTR VkResult VKAPI_CALL loader_CreateXlibSurfaceKHR( |
| 882 | VkInstance instance, |
| 883 | Display* dpy, |
| 884 | Window window, |
| 885 | const VkAllocationCallbacks* pAllocator, |
| 886 | VkSurfaceKHR* pSurface) |
| 887 | { |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 888 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 889 | VkIcdSurfaceXlib *pIcdSurface = NULL; |
| 890 | |
Ian Elliott | db4300a | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 891 | pIcdSurface = loader_heap_alloc(ptr_instance, |
| 892 | sizeof(VkIcdSurfaceXlib), |
| 893 | VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 894 | if (pIcdSurface == NULL) { |
| 895 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 896 | } |
| 897 | |
| 898 | pIcdSurface->base.platform = VK_ICD_WSI_PLATFORM_XLIB; |
| 899 | pIcdSurface->dpy = dpy; |
| 900 | pIcdSurface->window = window; |
| 901 | |
| 902 | *pSurface = (VkSurfaceKHR) pIcdSurface; |
| 903 | |
| 904 | return VK_SUCCESS; |
| 905 | } |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 906 | |
| 907 | /* |
| 908 | * This is the trampoline entrypoint |
| 909 | * for GetPhysicalDeviceXlibPresentationSupportKHR |
| 910 | */ |
| 911 | LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR( |
| 912 | VkPhysicalDevice physicalDevice, |
| 913 | uint32_t queueFamilyIndex, |
| 914 | Display* dpy, |
| 915 | VisualID visualID) |
| 916 | { |
| 917 | const VkLayerInstanceDispatchTable *disp; |
| 918 | disp = loader_get_instance_dispatch(physicalDevice); |
| 919 | VkBool32 res = disp->GetPhysicalDeviceXlibPresentationSupportKHR( |
| 920 | physicalDevice, |
| 921 | queueFamilyIndex, |
| 922 | dpy, |
| 923 | visualID); |
| 924 | return res; |
| 925 | } |
| 926 | |
| 927 | |
| 928 | /* |
| 929 | * This is the instance chain terminator function |
| 930 | * for GetPhysicalDeviceXlibPresentationSupportKHR |
| 931 | */ |
| 932 | VKAPI_ATTR VkBool32 VKAPI_CALL loader_GetPhysicalDeviceXlibPresentationSupportKHR( |
| 933 | VkPhysicalDevice physicalDevice, |
| 934 | uint32_t queueFamilyIndex, |
| 935 | Display* dpy, |
| 936 | VisualID visualID) |
| 937 | { |
| 938 | struct loader_physical_device *phys_dev = (struct loader_physical_device *) physicalDevice; |
| 939 | struct loader_icd *icd = phys_dev->this_icd; |
| 940 | |
| 941 | assert(icd->GetPhysicalDeviceXlibPresentationSupportKHR && "loader: null GetPhysicalDeviceXlibPresentationSupportKHR ICD pointer"); |
| 942 | |
| 943 | return icd->GetPhysicalDeviceXlibPresentationSupportKHR(phys_dev->phys_dev, |
| 944 | queueFamilyIndex, |
| 945 | dpy, |
| 946 | visualID); |
| 947 | } |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 948 | #endif // VK_USE_PLATFORM_XLIB_KHR |
| 949 | |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 950 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 951 | |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 952 | /* |
| 953 | * Functions for the VK_KHR_android_surface extension: |
| 954 | */ |
| 955 | |
| 956 | /* |
| 957 | * This is the trampoline entrypoint |
| 958 | * for CreateAndroidSurfaceKHR |
| 959 | */ |
| 960 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( |
| 961 | VkInstance instance, |
| 962 | ANativeWindow* window, |
| 963 | const VkAllocationCallbacks* pAllocator, |
| 964 | VkSurfaceKHR* pSurface) |
| 965 | { |
| 966 | const VkLayerInstanceDispatchTable *disp; |
| 967 | disp = loader_get_instance_dispatch(instance); |
| 968 | VkResult res; |
| 969 | |
| 970 | res = disp->CreateAndroidSurfaceKHR(instance, window, pAllocator, pSurface); |
| 971 | return res; |
| 972 | } |
| 973 | |
| 974 | /* |
| 975 | * This is the instance chain terminator function |
| 976 | * for CreateAndroidSurfaceKHR |
| 977 | */ |
| 978 | VKAPI_ATTR VkResult VKAPI_CALL loader_CreateAndroidSurfaceKHR( |
| 979 | VkInstance instance, |
| 980 | Window window, |
| 981 | const VkAllocationCallbacks* pAllocator, |
| 982 | VkSurfaceKHR* pSurface) |
| 983 | { |
| 984 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
| 985 | VkIcdSurfaceAndroid *pIcdSurface = NULL; |
| 986 | |
| 987 | pIcdSurface = loader_heap_alloc(ptr_instance, |
| 988 | sizeof(VkIcdSurfaceAndroid), |
| 989 | VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); |
| 990 | if (pIcdSurface == NULL) { |
| 991 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 992 | } |
| 993 | |
| 994 | pIcdSurface->base.platform = VK_ICD_WSI_PLATFORM_ANDROID; |
| 995 | pIcdSurface->dpy = dpy; |
| 996 | pIcdSurface->window = window; |
| 997 | |
| 998 | *pSurface = (VkSurfaceKHR) pIcdSurface; |
| 999 | |
| 1000 | return VK_SUCCESS; |
| 1001 | } |
| 1002 | |
| 1003 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1004 | |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 1005 | bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, |
| 1006 | const char* name, void **addr) |
| 1007 | { |
| 1008 | *addr = NULL; |
| 1009 | |
Ian Elliott | 934d0d5 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 1010 | /* |
| 1011 | * Functions for the VK_KHR_surface extension: |
| 1012 | */ |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1013 | if (!strcmp("vkDestroySurfaceKHR", name)) { |
| 1014 | *addr = ptr_instance->wsi_surface_enabled ? (void *) vkDestroySurfaceKHR : NULL; |
| 1015 | return true; |
| 1016 | } |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 1017 | if (!strcmp("vkGetPhysicalDeviceSurfaceSupportKHR", name)) { |
Ian Elliott | 83e6aa9 | 2015-11-19 12:37:51 -0700 | [diff] [blame] | 1018 | *addr = ptr_instance->wsi_surface_enabled ? (void *) vkGetPhysicalDeviceSurfaceSupportKHR : NULL; |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 1019 | return true; |
| 1020 | } |
Ian Elliott | 486c550 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 1021 | if (!strcmp("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", name)) { |
| 1022 | *addr = ptr_instance->wsi_surface_enabled ? (void *) vkGetPhysicalDeviceSurfaceCapabilitiesKHR : NULL; |
| 1023 | return true; |
| 1024 | } |
| 1025 | if (!strcmp("vkGetPhysicalDeviceSurfaceFormatsKHR", name)) { |
| 1026 | *addr = ptr_instance->wsi_surface_enabled ? (void *) vkGetPhysicalDeviceSurfaceFormatsKHR : NULL; |
| 1027 | return true; |
| 1028 | } |
| 1029 | if (!strcmp("vkGetPhysicalDeviceSurfacePresentModesKHR", name)) { |
| 1030 | *addr = ptr_instance->wsi_surface_enabled ? (void *) vkGetPhysicalDeviceSurfacePresentModesKHR : NULL; |
| 1031 | return true; |
| 1032 | } |
Ian Elliott | 934d0d5 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 1033 | |
| 1034 | /* |
| 1035 | * Functions for the VK_KHR_swapchain extension: |
| 1036 | * |
| 1037 | * Note: This is a device extension, and its functions are statically |
| 1038 | * exported from the loader. Per Khronos decisions, the the loader's GIPA |
| 1039 | * function will return the trampoline function for such device-extension |
| 1040 | * functions, regardless of whether the extension has been enabled. |
| 1041 | */ |
| 1042 | if (!strcmp("vkCreateSwapchainKHR", name)) { |
| 1043 | *addr = (void *) vkCreateSwapchainKHR; |
| 1044 | return true; |
| 1045 | } |
| 1046 | if (!strcmp("vkDestroySwapchainKHR", name)) { |
| 1047 | *addr = (void *) vkDestroySwapchainKHR; |
| 1048 | return true; |
| 1049 | } |
| 1050 | if (!strcmp("vkGetSwapchainImagesKHR", name)) { |
| 1051 | *addr = (void *) vkGetSwapchainImagesKHR; |
| 1052 | return true; |
| 1053 | } |
| 1054 | if (!strcmp("vkAcquireNextImageKHR", name)) { |
| 1055 | *addr = (void *) vkAcquireNextImageKHR; |
| 1056 | return true; |
| 1057 | } |
| 1058 | if (!strcmp("vkQueuePresentKHR", name)) { |
| 1059 | *addr = (void *) vkQueuePresentKHR; |
| 1060 | return true; |
| 1061 | } |
| 1062 | |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1063 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | 934d0d5 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 1064 | /* |
| 1065 | * Functions for the VK_KHR_win32_surface extension: |
| 1066 | */ |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1067 | if (!strcmp("vkCreateWin32SurfaceKHR", name)) { |
| 1068 | *addr = ptr_instance->wsi_win32_surface_enabled ? (void *) vkCreateWin32SurfaceKHR : NULL; |
| 1069 | return true; |
| 1070 | } |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 1071 | if (!strcmp("vkGetPhysicalDeviceWin32PresentationSupportKHR", name)) { |
| 1072 | *addr = ptr_instance->wsi_win32_surface_enabled ? (void *) vkGetPhysicalDeviceWin32PresentationSupportKHR : NULL; |
| 1073 | return true; |
| 1074 | } |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1075 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1076 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Ian Elliott | 934d0d5 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 1077 | /* |
| 1078 | * Functions for the VK_KHR_mir_surface extension: |
| 1079 | */ |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1080 | if (!strcmp("vkCreateMirSurfaceKHR", name)) { |
| 1081 | *addr = ptr_instance->wsi_mir_surface_enabled ? (void *) vkCreateMirSurfaceKHR : NULL; |
| 1082 | return true; |
| 1083 | } |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 1084 | if (!strcmp("vkGetPhysicalDeviceMirPresentationSupportKHR", name)) { |
| 1085 | *addr = ptr_instance->wsi_mir_surface_enabled ? (void *) vkGetPhysicalDeviceMirPresentationSupportKHR : NULL; |
| 1086 | return true; |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1087 | #endif // VK_USE_PLATFORM_MIR_KHR |
| 1088 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 934d0d5 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 1089 | /* |
| 1090 | * Functions for the VK_KHR_wayland_surface extension: |
| 1091 | */ |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1092 | if (!strcmp("vkCreateWaylandSurfaceKHR", name)) { |
| 1093 | *addr = ptr_instance->wsi_wayland_surface_enabled ? (void *) vkCreateWaylandSurfaceKHR : NULL; |
| 1094 | return true; |
| 1095 | } |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 1096 | if (!strcmp("vkGetPhysicalDeviceWaylandPresentationSupportKHR", name)) { |
| 1097 | *addr = ptr_instance->wsi_wayland_surface_enabled ? (void *) vkGetPhysicalDeviceWaylandPresentationSupportKHR : NULL; |
| 1098 | return true; |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1099 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
| 1100 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 934d0d5 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 1101 | /* |
| 1102 | * Functions for the VK_KHR_xcb_surface extension: |
| 1103 | */ |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1104 | if (!strcmp("vkCreateXcbSurfaceKHR", name)) { |
| 1105 | *addr = ptr_instance->wsi_xcb_surface_enabled ? (void *) vkCreateXcbSurfaceKHR : NULL; |
| 1106 | return true; |
| 1107 | } |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 1108 | if (!strcmp("vkGetPhysicalDeviceXcbPresentationSupportKHR", name)) { |
| 1109 | *addr = ptr_instance->wsi_xcb_surface_enabled ? (void *) vkGetPhysicalDeviceXcbPresentationSupportKHR : NULL; |
| 1110 | return true; |
| 1111 | } |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1112 | #endif // VK_USE_PLATFORM_XCB_KHR |
| 1113 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Ian Elliott | 934d0d5 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 1114 | /* |
| 1115 | * Functions for the VK_KHR_xlib_surface extension: |
| 1116 | */ |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1117 | if (!strcmp("vkCreateXlibSurfaceKHR", name)) { |
| 1118 | *addr = ptr_instance->wsi_xlib_surface_enabled ? (void *) vkCreateXlibSurfaceKHR : NULL; |
| 1119 | return true; |
| 1120 | } |
Ian Elliott | 919fa30 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 1121 | if (!strcmp("vkGetPhysicalDeviceXlibPresentationSupportKHR", name)) { |
| 1122 | *addr = ptr_instance->wsi_xlib_surface_enabled ? (void *) vkGetPhysicalDeviceXlibPresentationSupportKHR : NULL; |
| 1123 | return true; |
Jon Ashburn | cc07f70 | 2015-11-30 08:23:10 -0700 | [diff] [blame] | 1124 | } |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1125 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | a8a5f85 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 1126 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 1127 | /* |
| 1128 | * Functions for the VK_KHR_android_surface extension: |
| 1129 | */ |
| 1130 | if (!strcmp("vkCreateAndroidSurfaceKHR", name)) { |
| 1131 | *addr = ptr_instance->wsi_xlib_surface_enabled ? (void *) vkCreateAndroidSurfaceKHR : NULL; |
| 1132 | return true; |
| 1133 | } |
| 1134 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Ian Elliott | 2c05e22 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1135 | |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 1136 | return false; |
| 1137 | } |