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