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