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