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