Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 1 | /* |
Lenny Komow | a1b5e44 | 2019-09-16 16:14:36 -0600 | [diff] [blame] | 2 | * Copyright (c) 2015-2016, 2019 The Khronos Group Inc. |
| 3 | * Copyright (c) 2015-2016, 2019 Valve Corporation |
| 4 | * Copyright (c) 2015-2016, 2019 LunarG, Inc. |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 5 | * |
Jon Ashburn | 4f80d67 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 9 | * |
Jon Ashburn | 4f80d67 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 11 | * |
Jon Ashburn | 4f80d67 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 17 | * |
| 18 | * Author: Ian Elliott <ian@lunarg.com> |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 19 | * Author: Jon Ashburn <jon@lunarg.com> |
Ian Elliott | b184974 | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 20 | * Author: Ian Elliott <ianelliott@google.com> |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 21 | * Author: Mark Lobodzinski <mark@lunarg.com> |
Lenny Komow | a1b5e44 | 2019-09-16 16:14:36 -0600 | [diff] [blame] | 22 | * Author: Lenny Komow <lenny@lunarg.com> |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 23 | */ |
| 24 | |
Tom Anderson | a835880 | 2018-07-25 17:10:16 -0700 | [diff] [blame] | 25 | #ifndef _GNU_SOURCE |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 26 | #define _GNU_SOURCE |
Tom Anderson | a835880 | 2018-07-25 17:10:16 -0700 | [diff] [blame] | 27 | #endif |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 28 | #include <stdio.h> |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 29 | #include <stdlib.h> |
| 30 | #include <string.h> |
| 31 | #include "vk_loader_platform.h" |
| 32 | #include "loader.h" |
| 33 | #include "wsi.h" |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 34 | #include <vulkan/vk_icd.h> |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 35 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 36 | // The first ICD/Loader interface that support querying the SurfaceKHR from |
| 37 | // the ICDs. |
| 38 | #define ICD_VER_SUPPORTS_ICD_SURFACE_KHR 3 |
| 39 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 40 | void wsi_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo) { |
Ian Elliott | 5fb891a | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 41 | ptr_instance->wsi_surface_enabled = false; |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 42 | |
| 43 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 44 | ptr_instance->wsi_win32_surface_enabled = false; |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 45 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 46 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 47 | ptr_instance->wsi_wayland_surface_enabled = false; |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 48 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 49 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 50 | ptr_instance->wsi_xcb_surface_enabled = false; |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 51 | #endif // VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 52 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 53 | ptr_instance->wsi_xlib_surface_enabled = false; |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 54 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Nicolas Caramelli | fa696ca | 2020-07-04 22:53:59 +0200 | [diff] [blame] | 55 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT |
| 56 | ptr_instance->wsi_directfb_surface_enabled = false; |
| 57 | #endif // VK_USE_PLATFORM_DIRECTFB_EXT |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 58 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 59 | ptr_instance->wsi_android_surface_enabled = false; |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 60 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Karl Schultz | d81ebfb | 2017-12-12 10:33:01 -0500 | [diff] [blame] | 61 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
| 62 | ptr_instance->wsi_macos_surface_enabled = false; |
| 63 | #endif // VK_USE_PLATFORM_MACOS_MVK |
| 64 | #ifdef VK_USE_PLATFORM_IOS_MVK |
| 65 | ptr_instance->wsi_ios_surface_enabled = false; |
| 66 | #endif // VK_USE_PLATFORM_IOS_MVK |
J.D. Rouan | d7928a1 | 2020-11-16 15:36:42 -0800 | [diff] [blame^] | 67 | #ifdef VK_USE_PLATFORM_GGP |
| 68 | ptr_instance->wsi_ggp_surface_enabled = false; |
| 69 | #endif // VK_USE_PLATFORM_GGP |
Craig Stout | f3b74dc | 2020-10-26 12:05:15 -0700 | [diff] [blame] | 70 | #ifdef VK_USE_PLATFORM_FUCHSIA |
| 71 | ptr_instance->wsi_imagepipe_surface_enabled = false; |
| 72 | #endif // VK_USE_PLATFORM_FUCHSIA |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 73 | ptr_instance->wsi_display_enabled = false; |
Lenny Komow | 6113978 | 2018-05-31 11:32:31 -0600 | [diff] [blame] | 74 | ptr_instance->wsi_display_props2_enabled = false; |
Lenny Komow | a1b5e44 | 2019-09-16 16:14:36 -0600 | [diff] [blame] | 75 | #ifdef VK_USE_PLATFORM_METAL_EXT |
| 76 | ptr_instance->wsi_metal_surface_enabled = false; |
| 77 | #endif // VK_USE_PLATFORM_METAL_EXT |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 78 | |
Jon Ashburn | a0673ab | 2016-01-11 13:12:43 -0700 | [diff] [blame] | 79 | for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 80 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SURFACE_EXTENSION_NAME) == 0) { |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 81 | ptr_instance->wsi_surface_enabled = true; |
Ian Elliott | b184974 | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 82 | continue; |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 83 | } |
Ian Elliott | b184974 | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 84 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 85 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) { |
Ian Elliott | 1693f59 | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 86 | ptr_instance->wsi_win32_surface_enabled = true; |
Ian Elliott | b184974 | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 87 | continue; |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 88 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 89 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | 5fb891a | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 90 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 91 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 92 | ptr_instance->wsi_wayland_surface_enabled = true; |
Ian Elliott | b184974 | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 93 | continue; |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 94 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 95 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 5fb891a | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 96 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 97 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 98 | ptr_instance->wsi_xcb_surface_enabled = true; |
Ian Elliott | b184974 | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 99 | continue; |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 100 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 101 | #endif // VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 5fb891a | 2015-10-30 17:45:05 -0600 | [diff] [blame] | 102 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 103 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 104 | ptr_instance->wsi_xlib_surface_enabled = true; |
Ian Elliott | b184974 | 2015-11-19 11:58:08 -0700 | [diff] [blame] | 105 | continue; |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 106 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 107 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Nicolas Caramelli | fa696ca | 2020-07-04 22:53:59 +0200 | [diff] [blame] | 108 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT |
| 109 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME) == 0) { |
| 110 | ptr_instance->wsi_directfb_surface_enabled = true; |
| 111 | continue; |
| 112 | } |
| 113 | #endif // VK_USE_PLATFORM_DIRECTFB_EXT |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 114 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 115 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 116 | ptr_instance->wsi_android_surface_enabled = true; |
| 117 | continue; |
| 118 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 119 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Karl Schultz | d81ebfb | 2017-12-12 10:33:01 -0500 | [diff] [blame] | 120 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
| 121 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_MVK_MACOS_SURFACE_EXTENSION_NAME) == 0) { |
| 122 | ptr_instance->wsi_macos_surface_enabled = true; |
| 123 | continue; |
| 124 | } |
| 125 | #endif // VK_USE_PLATFORM_MACOS_MVK |
| 126 | #ifdef VK_USE_PLATFORM_IOS_MVK |
| 127 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_MVK_IOS_SURFACE_EXTENSION_NAME) == 0) { |
| 128 | ptr_instance->wsi_ios_surface_enabled = true; |
| 129 | continue; |
| 130 | } |
| 131 | #endif // VK_USE_PLATFORM_IOS_MVK |
J.D. Rouan | d7928a1 | 2020-11-16 15:36:42 -0800 | [diff] [blame^] | 132 | #ifdef VK_USE_PLATFORM_GGP |
| 133 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME) == 0) { |
| 134 | ptr_instance->wsi_ggp_surface_enabled = true; |
| 135 | continue; |
| 136 | } |
| 137 | #endif // VK_USE_PLATFORM_GGP |
Craig Stout | f3b74dc | 2020-10-26 12:05:15 -0700 | [diff] [blame] | 138 | #ifdef VK_USE_PLATFORM_FUCHSIA |
| 139 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME) == 0) { |
| 140 | ptr_instance->wsi_imagepipe_surface_enabled = true; |
| 141 | continue; |
| 142 | } |
| 143 | #endif // VK_USE_PLATFORM_FUCHSIA |
Bryan Law-Smith | 5730569 | 2019-04-01 09:45:55 +0100 | [diff] [blame] | 144 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME) == 0) { |
| 145 | ptr_instance->wsi_headless_surface_enabled = true; |
| 146 | continue; |
| 147 | } |
Lenny Komow | a1b5e44 | 2019-09-16 16:14:36 -0600 | [diff] [blame] | 148 | #if defined(VK_USE_PLATFORM_METAL_EXT) |
| 149 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_METAL_SURFACE_EXTENSION_NAME) == 0) { |
| 150 | ptr_instance->wsi_metal_surface_enabled = true; |
| 151 | continue; |
| 152 | } |
| 153 | #endif |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 154 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_EXTENSION_NAME) == 0) { |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 155 | ptr_instance->wsi_display_enabled = true; |
| 156 | continue; |
| 157 | } |
Lenny Komow | 6113978 | 2018-05-31 11:32:31 -0600 | [diff] [blame] | 158 | if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME) == 0) { |
| 159 | ptr_instance->wsi_display_props2_enabled = true; |
| 160 | continue; |
| 161 | } |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 162 | } |
| 163 | } |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 164 | |
| 165 | // Linux WSI surface extensions are not always compiled into the loader. (Assume |
| 166 | // for Windows the KHR_win32_surface is always compiled into loader). A given |
| 167 | // Linux build environment might not have the headers required for building one |
Tony-LunarG | 0366721 | 2018-10-23 14:08:03 -0600 | [diff] [blame] | 168 | // of the three extensions (Xlib, Xcb, Wayland). Thus, need to check if |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 169 | // the built loader actually supports the particular Linux surface extension. |
| 170 | // If not supported by the built loader it will not be included in the list of |
| 171 | // enumerated instance extensions. This solves the issue where an ICD or layer |
| 172 | // advertises support for a given Linux surface extension but the loader was not |
| 173 | // built to support the extension. |
Jon Ashburn | ae8f1e8 | 2016-03-25 12:49:35 -0600 | [diff] [blame] | 174 | bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop) { |
Jon Ashburn | ae8f1e8 | 2016-03-25 12:49:35 -0600 | [diff] [blame] | 175 | #ifndef VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 176 | if (!strcmp(ext_prop->extensionName, "VK_KHR_wayland_surface")) return true; |
| 177 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
Jon Ashburn | ae8f1e8 | 2016-03-25 12:49:35 -0600 | [diff] [blame] | 178 | #ifndef VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 179 | if (!strcmp(ext_prop->extensionName, "VK_KHR_xcb_surface")) return true; |
| 180 | #endif // VK_USE_PLATFORM_XCB_KHR |
Jon Ashburn | ae8f1e8 | 2016-03-25 12:49:35 -0600 | [diff] [blame] | 181 | #ifndef VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 182 | if (!strcmp(ext_prop->extensionName, "VK_KHR_xlib_surface")) return true; |
| 183 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Nicolas Caramelli | fa696ca | 2020-07-04 22:53:59 +0200 | [diff] [blame] | 184 | #ifndef VK_USE_PLATFORM_DIRECTFB_EXT |
| 185 | if (!strcmp(ext_prop->extensionName, "VK_EXT_directfb_surface")) return true; |
| 186 | #endif // VK_USE_PLATFORM_DIRECTFB_EXT |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 187 | |
Jon Ashburn | ae8f1e8 | 2016-03-25 12:49:35 -0600 | [diff] [blame] | 188 | return false; |
| 189 | } |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 190 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 191 | // Functions for the VK_KHR_surface extension: |
| 192 | |
| 193 | // This is the trampoline entrypoint for DestroySurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 194 | LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, |
| 195 | const VkAllocationCallbacks *pAllocator) { |
Ian Elliott | abf5066 | 2015-11-25 14:43:02 -0700 | [diff] [blame] | 196 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 197 | disp = loader_get_instance_layer_dispatch(instance); |
Ian Elliott | abf5066 | 2015-11-25 14:43:02 -0700 | [diff] [blame] | 198 | disp->DestroySurfaceKHR(instance, surface, pAllocator); |
| 199 | } |
| 200 | |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 201 | // TODO probably need to lock around all the loader_get_instance() calls. |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 202 | |
| 203 | // This is the instance chain terminator function for DestroySurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 204 | VKAPI_ATTR void VKAPI_CALL terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, |
| 205 | const VkAllocationCallbacks *pAllocator) { |
Ian Elliott | 1693f59 | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 206 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
| 207 | |
Karl Schultz | a9e989f | 2016-11-19 09:02:27 -0700 | [diff] [blame] | 208 | VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; |
Mark Young | 11e9d47 | 2016-10-17 12:27:36 -0600 | [diff] [blame] | 209 | if (NULL != icd_surface) { |
| 210 | if (NULL != icd_surface->real_icd_surfaces) { |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 211 | uint32_t i = 0; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 212 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 213 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 214 | if (NULL != icd_term->dispatch.DestroySurfaceKHR && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[i]) { |
| 215 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, icd_surface->real_icd_surfaces[i], pAllocator); |
Mark Young | 3eda588 | 2016-12-01 10:42:21 -0700 | [diff] [blame] | 216 | icd_surface->real_icd_surfaces[i] = (VkSurfaceKHR)NULL; |
Mark Young | 11e9d47 | 2016-10-17 12:27:36 -0600 | [diff] [blame] | 217 | } |
| 218 | } else { |
| 219 | // The real_icd_surface for any ICD not supporting the |
| 220 | // proper interface version should be NULL. If not, then |
| 221 | // we have a problem. |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 222 | assert((VkSurfaceKHR)NULL == icd_surface->real_icd_surfaces[i]); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 223 | } |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 224 | } |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 225 | loader_instance_heap_free(ptr_instance, icd_surface->real_icd_surfaces); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 226 | } |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 227 | |
Karl Schultz | a9e989f | 2016-11-19 09:02:27 -0700 | [diff] [blame] | 228 | loader_instance_heap_free(ptr_instance, (void *)(uintptr_t)surface); |
Mark Young | 11e9d47 | 2016-10-17 12:27:36 -0600 | [diff] [blame] | 229 | } |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 230 | } |
| 231 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 232 | // This is the trampoline entrypoint for GetPhysicalDeviceSurfaceSupportKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 233 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, |
| 234 | uint32_t queueFamilyIndex, VkSurfaceKHR surface, |
| 235 | VkBool32 *pSupported) { |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 236 | const VkLayerInstanceDispatchTable *disp; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 237 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 238 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 239 | VkResult res = disp->GetPhysicalDeviceSurfaceSupportKHR(unwrapped_phys_dev, queueFamilyIndex, surface, pSupported); |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 240 | return res; |
| 241 | } |
| 242 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 243 | // This is the instance chain terminator function for |
| 244 | // GetPhysicalDeviceSurfaceSupportKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 245 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, |
| 246 | uint32_t queueFamilyIndex, VkSurfaceKHR surface, |
| 247 | VkBool32 *pSupported) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 248 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 249 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 250 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 251 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 252 | if (!ptr_instance->wsi_surface_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 253 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 254 | "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceSupportKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 255 | return VK_SUCCESS; |
| 256 | } |
| 257 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 258 | if (NULL == pSupported) { |
| 259 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 260 | "NULL pointer passed into vkGetPhysicalDeviceSurfaceSupportKHR for pSupported!\n"); |
| 261 | assert(false && "GetPhysicalDeviceSurfaceSupportKHR: Error, null pSupported"); |
| 262 | } |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 263 | *pSupported = false; |
| 264 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 265 | if (NULL == icd_term->dispatch.GetPhysicalDeviceSurfaceSupportKHR) { |
| 266 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 267 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceSurfaceSupportKHR!\n"); |
| 268 | assert(false && "loader: null GetPhysicalDeviceSurfaceSupportKHR ICD pointer"); |
| 269 | } |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 270 | |
Karl Schultz | a9e989f | 2016-11-19 09:02:27 -0700 | [diff] [blame] | 271 | VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 272 | if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 273 | return icd_term->dispatch.GetPhysicalDeviceSurfaceSupportKHR( |
| 274 | phys_dev_term->phys_dev, queueFamilyIndex, icd_surface->real_icd_surfaces[phys_dev_term->icd_index], pSupported); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 275 | } |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 276 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 277 | return icd_term->dispatch.GetPhysicalDeviceSurfaceSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, surface, pSupported); |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 278 | } |
| 279 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 280 | // This is the trampoline entrypoint for GetPhysicalDeviceSurfaceCapabilitiesKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 281 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR( |
| 282 | VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 283 | const VkLayerInstanceDispatchTable *disp; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 284 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 285 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 286 | VkResult res = disp->GetPhysicalDeviceSurfaceCapabilitiesKHR(unwrapped_phys_dev, surface, pSurfaceCapabilities); |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 287 | return res; |
| 288 | } |
| 289 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 290 | // This is the instance chain terminator function for |
| 291 | // GetPhysicalDeviceSurfaceCapabilitiesKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 292 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, |
| 293 | VkSurfaceKHR surface, |
| 294 | VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 295 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 296 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 297 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 298 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 299 | if (!ptr_instance->wsi_surface_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 300 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 301 | "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceCapabilitiesKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 302 | return VK_SUCCESS; |
| 303 | } |
| 304 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 305 | if (NULL == pSurfaceCapabilities) { |
| 306 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 307 | "NULL pointer passed into vkGetPhysicalDeviceSurfaceCapabilitiesKHR for pSurfaceCapabilities!\n"); |
| 308 | assert(false && "GetPhysicalDeviceSurfaceCapabilitiesKHR: Error, null pSurfaceCapabilities"); |
| 309 | } |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 310 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 311 | if (NULL == icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilitiesKHR) { |
| 312 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 313 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceSurfaceCapabilitiesKHR!\n"); |
| 314 | assert(false && "loader: null GetPhysicalDeviceSurfaceCapabilitiesKHR ICD pointer"); |
| 315 | } |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 316 | |
Karl Schultz | a9e989f | 2016-11-19 09:02:27 -0700 | [diff] [blame] | 317 | VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 318 | if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 319 | return icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilitiesKHR( |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 320 | phys_dev_term->phys_dev, icd_surface->real_icd_surfaces[phys_dev_term->icd_index], pSurfaceCapabilities); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 321 | } |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 322 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 323 | return icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev_term->phys_dev, surface, pSurfaceCapabilities); |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 324 | } |
| 325 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 326 | // This is the trampoline entrypoint for GetPhysicalDeviceSurfaceFormatsKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 327 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, |
| 328 | VkSurfaceKHR surface, |
| 329 | uint32_t *pSurfaceFormatCount, |
| 330 | VkSurfaceFormatKHR *pSurfaceFormats) { |
| 331 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 332 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 333 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 334 | VkResult res = disp->GetPhysicalDeviceSurfaceFormatsKHR(unwrapped_phys_dev, surface, pSurfaceFormatCount, pSurfaceFormats); |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 335 | return res; |
| 336 | } |
| 337 | |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 338 | // This is the instance chain terminator function for |
| 339 | // GetPhysicalDeviceSurfaceFormatsKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 340 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, |
| 341 | uint32_t *pSurfaceFormatCount, |
| 342 | VkSurfaceFormatKHR *pSurfaceFormats) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 343 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 344 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 345 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 346 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 347 | if (!ptr_instance->wsi_surface_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 348 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 349 | "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceFormatsKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 350 | return VK_SUCCESS; |
| 351 | } |
| 352 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 353 | if (NULL == pSurfaceFormatCount) { |
| 354 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 355 | "NULL pointer passed into vkGetPhysicalDeviceSurfaceFormatsKHR for pSurfaceFormatCount!\n"); |
| 356 | assert(false && "GetPhysicalDeviceSurfaceFormatsKHR(: Error, null pSurfaceFormatCount"); |
| 357 | } |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 358 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 359 | if (NULL == icd_term->dispatch.GetPhysicalDeviceSurfaceFormatsKHR) { |
| 360 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 361 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceSurfaceCapabilitiesKHR!\n"); |
| 362 | assert(false && "loader: null GetPhysicalDeviceSurfaceFormatsKHR ICD pointer"); |
| 363 | } |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 364 | |
Karl Schultz | a9e989f | 2016-11-19 09:02:27 -0700 | [diff] [blame] | 365 | VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 366 | if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 367 | return icd_term->dispatch.GetPhysicalDeviceSurfaceFormatsKHR(phys_dev_term->phys_dev, |
| 368 | icd_surface->real_icd_surfaces[phys_dev_term->icd_index], |
| 369 | pSurfaceFormatCount, pSurfaceFormats); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 370 | } |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 371 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 372 | return icd_term->dispatch.GetPhysicalDeviceSurfaceFormatsKHR(phys_dev_term->phys_dev, surface, pSurfaceFormatCount, |
| 373 | pSurfaceFormats); |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 374 | } |
| 375 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 376 | // This is the trampoline entrypoint for GetPhysicalDeviceSurfacePresentModesKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 377 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, |
| 378 | VkSurfaceKHR surface, |
| 379 | uint32_t *pPresentModeCount, |
| 380 | VkPresentModeKHR *pPresentModes) { |
| 381 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 382 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 383 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 384 | VkResult res = disp->GetPhysicalDeviceSurfacePresentModesKHR(unwrapped_phys_dev, surface, pPresentModeCount, pPresentModes); |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 385 | return res; |
| 386 | } |
| 387 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 388 | // This is the instance chain terminator function for |
| 389 | // GetPhysicalDeviceSurfacePresentModesKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 390 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, |
| 391 | VkSurfaceKHR surface, uint32_t *pPresentModeCount, |
| 392 | VkPresentModeKHR *pPresentModes) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 393 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 394 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 395 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 396 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 397 | if (!ptr_instance->wsi_surface_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 398 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 399 | "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfacePresentModesKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 400 | return VK_SUCCESS; |
| 401 | } |
| 402 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 403 | if (NULL == pPresentModeCount) { |
| 404 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 405 | "NULL pointer passed into vkGetPhysicalDeviceSurfacePresentModesKHR for pPresentModeCount!\n"); |
| 406 | assert(false && "GetPhysicalDeviceSurfacePresentModesKHR(: Error, null pPresentModeCount"); |
| 407 | } |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 408 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 409 | if (NULL == icd_term->dispatch.GetPhysicalDeviceSurfacePresentModesKHR) { |
| 410 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 411 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceSurfacePresentModesKHR!\n"); |
| 412 | assert(false && "loader: null GetPhysicalDeviceSurfacePresentModesKHR ICD pointer"); |
| 413 | } |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 414 | |
Karl Schultz | a9e989f | 2016-11-19 09:02:27 -0700 | [diff] [blame] | 415 | VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 416 | if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 417 | return icd_term->dispatch.GetPhysicalDeviceSurfacePresentModesKHR( |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 418 | phys_dev_term->phys_dev, icd_surface->real_icd_surfaces[phys_dev_term->icd_index], pPresentModeCount, pPresentModes); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 419 | } |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 420 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 421 | return icd_term->dispatch.GetPhysicalDeviceSurfacePresentModesKHR(phys_dev_term->phys_dev, surface, pPresentModeCount, |
| 422 | pPresentModes); |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 423 | } |
| 424 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 425 | // Functions for the VK_KHR_swapchain extension: |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 426 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 427 | // This is the trampoline entrypoint for CreateSwapchainKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 428 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
| 429 | const VkAllocationCallbacks *pAllocator, |
| 430 | VkSwapchainKHR *pSwapchain) { |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 431 | const VkLayerDispatchTable *disp; |
| 432 | disp = loader_get_dispatch(device); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 433 | return disp->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 434 | } |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 435 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 436 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, |
Karl Schultz | d81ebfb | 2017-12-12 10:33:01 -0500 | [diff] [blame] | 437 | const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 438 | uint32_t icd_index = 0; |
| 439 | struct loader_device *dev; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 440 | struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 441 | if (NULL != icd_term && NULL != icd_term->dispatch.CreateSwapchainKHR) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 442 | VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pCreateInfo->surface; |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 443 | if (NULL != icd_surface->real_icd_surfaces) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 444 | if ((VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[icd_index]) { |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 445 | // We found the ICD, and there is an ICD KHR surface |
| 446 | // associated with it, so copy the CreateInfo struct |
| 447 | // and point it at the ICD's surface. |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 448 | VkSwapchainCreateInfoKHR *pCreateCopy = loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR)); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 449 | if (NULL == pCreateCopy) { |
| 450 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 451 | } |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 452 | memcpy(pCreateCopy, pCreateInfo, sizeof(VkSwapchainCreateInfoKHR)); |
| 453 | pCreateCopy->surface = icd_surface->real_icd_surfaces[icd_index]; |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 454 | return icd_term->dispatch.CreateSwapchainKHR(device, pCreateCopy, pAllocator, pSwapchain); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 455 | } |
| 456 | } |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 457 | return icd_term->dispatch.CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 458 | } |
| 459 | return VK_SUCCESS; |
| 460 | } |
| 461 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 462 | // This is the trampoline entrypoint for DestroySwapchainKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 463 | LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, |
| 464 | const VkAllocationCallbacks *pAllocator) { |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 465 | const VkLayerDispatchTable *disp; |
| 466 | disp = loader_get_dispatch(device); |
| 467 | disp->DestroySwapchainKHR(device, swapchain, pAllocator); |
| 468 | } |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 469 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 470 | // This is the trampoline entrypoint for GetSwapchainImagesKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 471 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, |
| 472 | uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) { |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 473 | const VkLayerDispatchTable *disp; |
| 474 | disp = loader_get_dispatch(device); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 475 | return disp->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 476 | } |
| 477 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 478 | // This is the trampoline entrypoint for AcquireNextImageKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 479 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, |
| 480 | VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 481 | const VkLayerDispatchTable *disp; |
| 482 | disp = loader_get_dispatch(device); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 483 | return disp->AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 484 | } |
| 485 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 486 | // This is the trampoline entrypoint for QueuePresentKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 487 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 488 | const VkLayerDispatchTable *disp; |
| 489 | disp = loader_get_dispatch(queue); |
Mark Young | 76b3fe0 | 2016-09-08 12:28:38 -0600 | [diff] [blame] | 490 | return disp->QueuePresentKHR(queue, pPresentInfo); |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 491 | } |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 492 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 493 | static VkIcdSurface *AllocateIcdSurfaceStruct(struct loader_instance *instance, size_t base_size, size_t platform_size) { |
Mark Young | f27962c | 2016-09-16 10:18:42 -0600 | [diff] [blame] | 494 | // Next, if so, proceed with the implementation of this function: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 495 | VkIcdSurface *pIcdSurface = loader_instance_heap_alloc(instance, sizeof(VkIcdSurface), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
Mark Young | f27962c | 2016-09-16 10:18:42 -0600 | [diff] [blame] | 496 | if (pIcdSurface != NULL) { |
| 497 | // Setup the new sizes and offsets so we can grow the structures in the |
| 498 | // future without having problems |
| 499 | pIcdSurface->base_size = (uint32_t)base_size; |
| 500 | pIcdSurface->platform_size = (uint32_t)platform_size; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 501 | pIcdSurface->non_platform_offset = (uint32_t)((uint8_t *)(&pIcdSurface->base_size) - (uint8_t *)pIcdSurface); |
Mark Young | f27962c | 2016-09-16 10:18:42 -0600 | [diff] [blame] | 502 | pIcdSurface->entire_size = sizeof(VkIcdSurface); |
| 503 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 504 | pIcdSurface->real_icd_surfaces = loader_instance_heap_alloc(instance, sizeof(VkSurfaceKHR) * instance->total_icd_count, |
| 505 | VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
Mark Young | 5117fdc | 2016-12-13 17:19:32 -0700 | [diff] [blame] | 506 | if (pIcdSurface->real_icd_surfaces == NULL) { |
| 507 | loader_instance_heap_free(instance, pIcdSurface); |
| 508 | pIcdSurface = NULL; |
Mark Young | f27962c | 2016-09-16 10:18:42 -0600 | [diff] [blame] | 509 | } else { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 510 | memset(pIcdSurface->real_icd_surfaces, 0, sizeof(VkSurfaceKHR) * instance->total_icd_count); |
Mark Young | f27962c | 2016-09-16 10:18:42 -0600 | [diff] [blame] | 511 | } |
| 512 | } |
| 513 | return pIcdSurface; |
| 514 | } |
| 515 | |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 516 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
| 517 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 518 | // Functions for the VK_KHR_win32_surface extension: |
| 519 | |
| 520 | // This is the trampoline entrypoint for CreateWin32SurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 521 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(VkInstance instance, |
| 522 | const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 523 | const VkAllocationCallbacks *pAllocator, |
| 524 | VkSurfaceKHR *pSurface) { |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 525 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 526 | disp = loader_get_instance_layer_dispatch(instance); |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 527 | VkResult res; |
| 528 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 529 | res = disp->CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 530 | return res; |
| 531 | } |
| 532 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 533 | // This is the instance chain terminator function for CreateWin32SurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 534 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, |
| 535 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 536 | VkResult vkRes = VK_SUCCESS; |
Mark Young | d7fb159 | 2016-10-12 14:18:44 -0600 | [diff] [blame] | 537 | VkIcdSurface *pIcdSurface = NULL; |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 538 | uint32_t i = 0; |
| 539 | |
Mark Young | f27962c | 2016-09-16 10:18:42 -0600 | [diff] [blame] | 540 | // Initialize pSurface to NULL just to be safe. |
| 541 | *pSurface = VK_NULL_HANDLE; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 542 | // First, check to ensure the appropriate extension was enabled: |
Ian Elliott | 1693f59 | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 543 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 544 | if (!ptr_instance->wsi_win32_surface_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 545 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 546 | "VK_KHR_win32_surface extension not enabled. vkCreateWin32SurfaceKHR not executed!\n"); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 547 | vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; |
| 548 | goto out; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 549 | } |
| 550 | |
| 551 | // Next, if so, proceed with the implementation of this function: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 552 | pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->win_surf.base), sizeof(pIcdSurface->win_surf)); |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 553 | if (pIcdSurface == NULL) { |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 554 | vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 555 | goto out; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 556 | } |
| 557 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 558 | pIcdSurface->win_surf.base.platform = VK_ICD_WSI_PLATFORM_WIN32; |
| 559 | pIcdSurface->win_surf.hinstance = pCreateInfo->hinstance; |
| 560 | pIcdSurface->win_surf.hwnd = pCreateInfo->hwnd; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 561 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 562 | // Loop through each ICD and determine if they need to create a surface |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 563 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 564 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 565 | if (NULL != icd_term->dispatch.CreateWin32SurfaceKHR) { |
| 566 | vkRes = icd_term->dispatch.CreateWin32SurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, |
| 567 | &pIcdSurface->real_icd_surfaces[i]); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 568 | if (VK_SUCCESS != vkRes) { |
| 569 | goto out; |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | *pSurface = (VkSurfaceKHR)(pIcdSurface); |
| 576 | |
| 577 | out: |
| 578 | |
| 579 | if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { |
| 580 | if (NULL != pIcdSurface->real_icd_surfaces) { |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 581 | i = 0; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 582 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 583 | if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { |
| 584 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 585 | } |
| 586 | } |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 587 | loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 588 | } |
| 589 | loader_instance_heap_free(ptr_instance, pIcdSurface); |
| 590 | } |
| 591 | |
| 592 | return vkRes; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 593 | } |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 594 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 595 | // This is the trampoline entrypoint for |
| 596 | // GetPhysicalDeviceWin32PresentationSupportKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 597 | LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 598 | uint32_t queueFamilyIndex) { |
| 599 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 600 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 601 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 602 | VkBool32 res = disp->GetPhysicalDeviceWin32PresentationSupportKHR(unwrapped_phys_dev, queueFamilyIndex); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 603 | return res; |
| 604 | } |
| 605 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 606 | // This is the instance chain terminator function for |
| 607 | // GetPhysicalDeviceWin32PresentationSupportKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 608 | VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 609 | uint32_t queueFamilyIndex) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 610 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 611 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 612 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 613 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 614 | if (!ptr_instance->wsi_win32_surface_enabled) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 615 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 616 | "VK_KHR_win32_surface extension not enabled. vkGetPhysicalDeviceWin32PresentationSupportKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 617 | return VK_SUCCESS; |
| 618 | } |
| 619 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 620 | if (NULL == icd_term->dispatch.GetPhysicalDeviceWin32PresentationSupportKHR) { |
| 621 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 622 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceWin32PresentationSupportKHR!\n"); |
| 623 | assert(false && "loader: null GetPhysicalDeviceWin32PresentationSupportKHR ICD pointer"); |
| 624 | } |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 625 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 626 | return icd_term->dispatch.GetPhysicalDeviceWin32PresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 627 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 628 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 629 | |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 630 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
| 631 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 632 | // This is the trampoline entrypoint for CreateWaylandSurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 633 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(VkInstance instance, |
| 634 | const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, |
| 635 | const VkAllocationCallbacks *pAllocator, |
| 636 | VkSurfaceKHR *pSurface) { |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 637 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 638 | disp = loader_get_instance_layer_dispatch(instance); |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 639 | VkResult res; |
| 640 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 641 | res = disp->CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 642 | return res; |
| 643 | } |
| 644 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 645 | // This is the instance chain terminator function for CreateWaylandSurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 646 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance instance, |
| 647 | const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, |
| 648 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 649 | VkResult vkRes = VK_SUCCESS; |
Mark Young | d7fb159 | 2016-10-12 14:18:44 -0600 | [diff] [blame] | 650 | VkIcdSurface *pIcdSurface = NULL; |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 651 | uint32_t i = 0; |
| 652 | |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 653 | // First, check to ensure the appropriate extension was enabled: |
Ian Elliott | 1693f59 | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 654 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
Jon Ashburn | 436d6a3 | 2016-03-24 17:26:59 -0600 | [diff] [blame] | 655 | if (!ptr_instance->wsi_wayland_surface_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 656 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 657 | "VK_KHR_wayland_surface extension not enabled. vkCreateWaylandSurfaceKHR not executed!\n"); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 658 | vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; |
| 659 | goto out; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 660 | } |
| 661 | |
| 662 | // Next, if so, proceed with the implementation of this function: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 663 | pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->wayland_surf.base), sizeof(pIcdSurface->wayland_surf)); |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 664 | if (pIcdSurface == NULL) { |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 665 | vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 666 | goto out; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 667 | } |
| 668 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 669 | pIcdSurface->wayland_surf.base.platform = VK_ICD_WSI_PLATFORM_WAYLAND; |
| 670 | pIcdSurface->wayland_surf.display = pCreateInfo->display; |
| 671 | pIcdSurface->wayland_surf.surface = pCreateInfo->surface; |
| 672 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 673 | // Loop through each ICD and determine if they need to create a surface |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 674 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 675 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 676 | if (NULL != icd_term->dispatch.CreateWaylandSurfaceKHR) { |
| 677 | vkRes = icd_term->dispatch.CreateWaylandSurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, |
| 678 | &pIcdSurface->real_icd_surfaces[i]); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 679 | if (VK_SUCCESS != vkRes) { |
| 680 | goto out; |
| 681 | } |
| 682 | } |
| 683 | } |
| 684 | } |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 685 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 686 | *pSurface = (VkSurfaceKHR)pIcdSurface; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 687 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 688 | out: |
| 689 | |
| 690 | if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { |
| 691 | if (NULL != pIcdSurface->real_icd_surfaces) { |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 692 | i = 0; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 693 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 694 | if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { |
| 695 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 696 | } |
| 697 | } |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 698 | loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 699 | } |
| 700 | loader_instance_heap_free(ptr_instance, pIcdSurface); |
| 701 | } |
| 702 | |
| 703 | return vkRes; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 704 | } |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 705 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 706 | // This is the trampoline entrypoint for |
| 707 | // GetPhysicalDeviceWaylandPresentationSupportKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 708 | LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 709 | uint32_t queueFamilyIndex, |
| 710 | struct wl_display *display) { |
| 711 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 712 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 713 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 714 | VkBool32 res = disp->GetPhysicalDeviceWaylandPresentationSupportKHR(unwrapped_phys_dev, queueFamilyIndex, display); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 715 | return res; |
| 716 | } |
| 717 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 718 | // This is the instance chain terminator function for |
| 719 | // GetPhysicalDeviceWaylandPresentationSupportKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 720 | VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 721 | uint32_t queueFamilyIndex, |
| 722 | struct wl_display *display) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 723 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 724 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 725 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 726 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Jon Ashburn | 436d6a3 | 2016-03-24 17:26:59 -0600 | [diff] [blame] | 727 | if (!ptr_instance->wsi_wayland_surface_enabled) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 728 | loader_log( |
| 729 | ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 730 | "VK_KHR_wayland_surface extension not enabled. vkGetPhysicalDeviceWaylandPresentationSupportKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 731 | return VK_SUCCESS; |
| 732 | } |
| 733 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 734 | if (NULL == icd_term->dispatch.GetPhysicalDeviceWaylandPresentationSupportKHR) { |
| 735 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 736 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceWaylandPresentationSupportKHR!\n"); |
| 737 | assert(false && "loader: null GetPhysicalDeviceWaylandPresentationSupportKHR ICD pointer"); |
| 738 | } |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 739 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 740 | return icd_term->dispatch.GetPhysicalDeviceWaylandPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, display); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 741 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 742 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 743 | |
| 744 | #ifdef VK_USE_PLATFORM_XCB_KHR |
| 745 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 746 | // Functions for the VK_KHR_xcb_surface extension: |
| 747 | |
| 748 | // This is the trampoline entrypoint for CreateXcbSurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 749 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(VkInstance instance, |
| 750 | const VkXcbSurfaceCreateInfoKHR *pCreateInfo, |
| 751 | const VkAllocationCallbacks *pAllocator, |
| 752 | VkSurfaceKHR *pSurface) { |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 753 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 754 | disp = loader_get_instance_layer_dispatch(instance); |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 755 | VkResult res; |
| 756 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 757 | res = disp->CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 758 | return res; |
| 759 | } |
| 760 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 761 | // This is the instance chain terminator function for CreateXcbSurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 762 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, |
| 763 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 764 | VkResult vkRes = VK_SUCCESS; |
Mark Young | d7fb159 | 2016-10-12 14:18:44 -0600 | [diff] [blame] | 765 | VkIcdSurface *pIcdSurface = NULL; |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 766 | uint32_t i = 0; |
| 767 | |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 768 | // First, check to ensure the appropriate extension was enabled: |
Ian Elliott | 1693f59 | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 769 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 770 | if (!ptr_instance->wsi_xcb_surface_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 771 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 772 | "VK_KHR_xcb_surface extension not enabled. vkCreateXcbSurfaceKHR not executed!\n"); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 773 | vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; |
| 774 | goto out; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 775 | } |
| 776 | |
| 777 | // Next, if so, proceed with the implementation of this function: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 778 | pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->xcb_surf.base), sizeof(pIcdSurface->xcb_surf)); |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 779 | if (pIcdSurface == NULL) { |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 780 | vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 781 | goto out; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 782 | } |
| 783 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 784 | pIcdSurface->xcb_surf.base.platform = VK_ICD_WSI_PLATFORM_XCB; |
| 785 | pIcdSurface->xcb_surf.connection = pCreateInfo->connection; |
| 786 | pIcdSurface->xcb_surf.window = pCreateInfo->window; |
| 787 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 788 | // Loop through each ICD and determine if they need to create a surface |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 789 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 790 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 791 | if (NULL != icd_term->dispatch.CreateXcbSurfaceKHR) { |
| 792 | vkRes = icd_term->dispatch.CreateXcbSurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, |
| 793 | &pIcdSurface->real_icd_surfaces[i]); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 794 | if (VK_SUCCESS != vkRes) { |
| 795 | goto out; |
| 796 | } |
| 797 | } |
| 798 | } |
| 799 | } |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 800 | |
Mark Young | 3eda588 | 2016-12-01 10:42:21 -0700 | [diff] [blame] | 801 | *pSurface = (VkSurfaceKHR)pIcdSurface; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 802 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 803 | out: |
| 804 | |
| 805 | if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { |
| 806 | if (NULL != pIcdSurface->real_icd_surfaces) { |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 807 | i = 0; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 808 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 809 | if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { |
| 810 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 811 | } |
| 812 | } |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 813 | loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 814 | } |
| 815 | loader_instance_heap_free(ptr_instance, pIcdSurface); |
| 816 | } |
| 817 | |
| 818 | return vkRes; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 819 | } |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 820 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 821 | // This is the trampoline entrypoint for |
| 822 | // GetPhysicalDeviceXcbPresentationSupportKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 823 | LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 824 | uint32_t queueFamilyIndex, |
| 825 | xcb_connection_t *connection, |
| 826 | xcb_visualid_t visual_id) { |
| 827 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 828 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 829 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 830 | VkBool32 res = disp->GetPhysicalDeviceXcbPresentationSupportKHR(unwrapped_phys_dev, queueFamilyIndex, connection, visual_id); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 831 | return res; |
| 832 | } |
| 833 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 834 | // This is the instance chain terminator function for |
| 835 | // GetPhysicalDeviceXcbPresentationSupportKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 836 | VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 837 | uint32_t queueFamilyIndex, |
| 838 | xcb_connection_t *connection, |
| 839 | xcb_visualid_t visual_id) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 840 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 841 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 842 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 843 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 844 | if (!ptr_instance->wsi_xcb_surface_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 845 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 846 | "VK_KHR_xcb_surface extension not enabled. vkGetPhysicalDeviceXcbPresentationSupportKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 847 | return VK_SUCCESS; |
| 848 | } |
| 849 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 850 | if (NULL == icd_term->dispatch.GetPhysicalDeviceXcbPresentationSupportKHR) { |
| 851 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 852 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceXcbPresentationSupportKHR!\n"); |
| 853 | assert(false && "loader: null GetPhysicalDeviceXcbPresentationSupportKHR ICD pointer"); |
| 854 | } |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 855 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 856 | return icd_term->dispatch.GetPhysicalDeviceXcbPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, connection, |
| 857 | visual_id); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 858 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 859 | #endif // VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 860 | |
| 861 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
| 862 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 863 | // Functions for the VK_KHR_xlib_surface extension: |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 864 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 865 | // This is the trampoline entrypoint for CreateXlibSurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 866 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance instance, |
| 867 | const VkXlibSurfaceCreateInfoKHR *pCreateInfo, |
| 868 | const VkAllocationCallbacks *pAllocator, |
| 869 | VkSurfaceKHR *pSurface) { |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 870 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 871 | disp = loader_get_instance_layer_dispatch(instance); |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 872 | VkResult res; |
| 873 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 874 | res = disp->CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Jon Ashburn | 16edfa6 | 2015-11-25 17:55:49 -0700 | [diff] [blame] | 875 | return res; |
| 876 | } |
| 877 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 878 | // This is the instance chain terminator function for CreateXlibSurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 879 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, |
| 880 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 881 | VkResult vkRes = VK_SUCCESS; |
Mark Young | d7fb159 | 2016-10-12 14:18:44 -0600 | [diff] [blame] | 882 | VkIcdSurface *pIcdSurface = NULL; |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 883 | uint32_t i = 0; |
| 884 | |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 885 | // First, check to ensure the appropriate extension was enabled: |
Ian Elliott | 1693f59 | 2015-11-23 10:17:23 -0700 | [diff] [blame] | 886 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 887 | if (!ptr_instance->wsi_xlib_surface_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 888 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 889 | "VK_KHR_xlib_surface extension not enabled. vkCreateXlibSurfaceKHR not executed!\n"); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 890 | vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; |
| 891 | goto out; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 892 | } |
| 893 | |
| 894 | // Next, if so, proceed with the implementation of this function: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 895 | pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->xlib_surf.base), sizeof(pIcdSurface->xlib_surf)); |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 896 | if (pIcdSurface == NULL) { |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 897 | vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 898 | goto out; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 899 | } |
| 900 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 901 | pIcdSurface->xlib_surf.base.platform = VK_ICD_WSI_PLATFORM_XLIB; |
| 902 | pIcdSurface->xlib_surf.dpy = pCreateInfo->dpy; |
| 903 | pIcdSurface->xlib_surf.window = pCreateInfo->window; |
| 904 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 905 | // Loop through each ICD and determine if they need to create a surface |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 906 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 907 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 908 | if (NULL != icd_term->dispatch.CreateXlibSurfaceKHR) { |
| 909 | vkRes = icd_term->dispatch.CreateXlibSurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, |
| 910 | &pIcdSurface->real_icd_surfaces[i]); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 911 | if (VK_SUCCESS != vkRes) { |
| 912 | goto out; |
| 913 | } |
| 914 | } |
| 915 | } |
| 916 | } |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 917 | |
Mark Young | 3eda588 | 2016-12-01 10:42:21 -0700 | [diff] [blame] | 918 | *pSurface = (VkSurfaceKHR)pIcdSurface; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 919 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 920 | out: |
| 921 | |
| 922 | if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { |
| 923 | if (NULL != pIcdSurface->real_icd_surfaces) { |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 924 | i = 0; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 925 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 926 | if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { |
| 927 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 928 | } |
| 929 | } |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 930 | loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 931 | } |
| 932 | loader_instance_heap_free(ptr_instance, pIcdSurface); |
| 933 | } |
| 934 | |
| 935 | return vkRes; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 936 | } |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 937 | |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 938 | // This is the trampoline entrypoint for |
| 939 | // GetPhysicalDeviceXlibPresentationSupportKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 940 | LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 941 | uint32_t queueFamilyIndex, Display *dpy, |
| 942 | VisualID visualID) { |
| 943 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 944 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 945 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 946 | VkBool32 res = disp->GetPhysicalDeviceXlibPresentationSupportKHR(unwrapped_phys_dev, queueFamilyIndex, dpy, visualID); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 947 | return res; |
| 948 | } |
| 949 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 950 | // This is the instance chain terminator function for |
| 951 | // GetPhysicalDeviceXlibPresentationSupportKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 952 | VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, |
| 953 | uint32_t queueFamilyIndex, Display *dpy, |
| 954 | VisualID visualID) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 955 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 956 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 957 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 958 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 959 | if (!ptr_instance->wsi_xlib_surface_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 960 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 961 | "VK_KHR_xlib_surface extension not enabled. vkGetPhysicalDeviceXlibPresentationSupportKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 962 | return VK_SUCCESS; |
| 963 | } |
| 964 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 965 | if (NULL == icd_term->dispatch.GetPhysicalDeviceXlibPresentationSupportKHR) { |
| 966 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 967 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceXlibPresentationSupportKHR!\n"); |
| 968 | assert(false && "loader: null GetPhysicalDeviceXlibPresentationSupportKHR ICD pointer"); |
| 969 | } |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 970 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 971 | return icd_term->dispatch.GetPhysicalDeviceXlibPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, dpy, visualID); |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 972 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 973 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 974 | |
Nicolas Caramelli | fa696ca | 2020-07-04 22:53:59 +0200 | [diff] [blame] | 975 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT |
| 976 | |
| 977 | // Functions for the VK_EXT_directfb_surface extension: |
| 978 | |
| 979 | // This is the trampoline entrypoint for CreateDirectFBSurfaceEXT |
| 980 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDirectFBSurfaceEXT(VkInstance instance, |
| 981 | const VkDirectFBSurfaceCreateInfoEXT *pCreateInfo, |
| 982 | const VkAllocationCallbacks *pAllocator, |
| 983 | VkSurfaceKHR *pSurface) { |
| 984 | const VkLayerInstanceDispatchTable *disp; |
| 985 | disp = loader_get_instance_layer_dispatch(instance); |
| 986 | VkResult res; |
| 987 | |
| 988 | res = disp->CreateDirectFBSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface); |
| 989 | return res; |
| 990 | } |
| 991 | |
| 992 | // This is the instance chain terminator function for CreateDirectFBSurfaceEXT |
| 993 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDirectFBSurfaceEXT(VkInstance instance, |
| 994 | const VkDirectFBSurfaceCreateInfoEXT *pCreateInfo, |
| 995 | const VkAllocationCallbacks *pAllocator, |
| 996 | VkSurfaceKHR *pSurface) { |
| 997 | VkResult vkRes = VK_SUCCESS; |
| 998 | VkIcdSurface *pIcdSurface = NULL; |
| 999 | uint32_t i = 0; |
| 1000 | |
| 1001 | // First, check to ensure the appropriate extension was enabled: |
| 1002 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
| 1003 | if (!ptr_instance->wsi_directfb_surface_enabled) { |
| 1004 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1005 | "VK_EXT_directfb_surface extension not enabled. vkCreateDirectFBSurfaceEXT not executed!\n"); |
| 1006 | vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; |
| 1007 | goto out; |
| 1008 | } |
| 1009 | |
| 1010 | // Next, if so, proceed with the implementation of this function: |
| 1011 | pIcdSurface = |
| 1012 | AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->directfb_surf.base), sizeof(pIcdSurface->directfb_surf)); |
| 1013 | if (pIcdSurface == NULL) { |
| 1014 | vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1015 | goto out; |
| 1016 | } |
| 1017 | |
| 1018 | pIcdSurface->directfb_surf.base.platform = VK_ICD_WSI_PLATFORM_DIRECTFB; |
| 1019 | pIcdSurface->directfb_surf.dfb = pCreateInfo->dfb; |
| 1020 | pIcdSurface->directfb_surf.surface = pCreateInfo->surface; |
| 1021 | |
| 1022 | // Loop through each ICD and determine if they need to create a surface |
| 1023 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 1024 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
| 1025 | if (NULL != icd_term->dispatch.CreateDirectFBSurfaceEXT) { |
| 1026 | vkRes = icd_term->dispatch.CreateDirectFBSurfaceEXT(icd_term->instance, pCreateInfo, pAllocator, |
| 1027 | &pIcdSurface->real_icd_surfaces[i]); |
| 1028 | if (VK_SUCCESS != vkRes) { |
| 1029 | goto out; |
| 1030 | } |
| 1031 | } |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | *pSurface = (VkSurfaceKHR)pIcdSurface; |
| 1036 | |
| 1037 | out: |
| 1038 | |
| 1039 | if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { |
| 1040 | if (NULL != pIcdSurface->real_icd_surfaces) { |
| 1041 | i = 0; |
| 1042 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 1043 | if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { |
| 1044 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); |
| 1045 | } |
| 1046 | } |
| 1047 | loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); |
| 1048 | } |
| 1049 | loader_instance_heap_free(ptr_instance, pIcdSurface); |
| 1050 | } |
| 1051 | |
| 1052 | return vkRes; |
| 1053 | } |
| 1054 | |
| 1055 | // This is the trampoline entrypoint for |
| 1056 | // GetPhysicalDeviceDirectFBPresentationSupportEXT |
| 1057 | LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceDirectFBPresentationSupportEXT(VkPhysicalDevice physicalDevice, |
| 1058 | uint32_t queueFamilyIndex, |
| 1059 | IDirectFB *dfb) { |
| 1060 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
| 1061 | const VkLayerInstanceDispatchTable *disp; |
| 1062 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
| 1063 | VkBool32 res = disp->GetPhysicalDeviceDirectFBPresentationSupportEXT(unwrapped_phys_dev, queueFamilyIndex, dfb); |
| 1064 | return res; |
| 1065 | } |
| 1066 | |
| 1067 | // This is the instance chain terminator function for |
| 1068 | // GetPhysicalDeviceDirectFBPresentationSupportEXT |
| 1069 | VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceDirectFBPresentationSupportEXT(VkPhysicalDevice physicalDevice, |
| 1070 | uint32_t queueFamilyIndex, |
| 1071 | IDirectFB *dfb) { |
| 1072 | // First, check to ensure the appropriate extension was enabled: |
| 1073 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
| 1074 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
| 1075 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
| 1076 | if (!ptr_instance->wsi_directfb_surface_enabled) { |
| 1077 | loader_log( |
| 1078 | ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1079 | "VK_EXT_directfb_surface extension not enabled. vkGetPhysicalDeviceWaylandPresentationSupportKHR not executed!\n"); |
| 1080 | return VK_SUCCESS; |
| 1081 | } |
| 1082 | |
| 1083 | if (NULL == icd_term->dispatch.GetPhysicalDeviceDirectFBPresentationSupportEXT) { |
| 1084 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1085 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceDirectFBPresentationSupportEXT!\n"); |
| 1086 | assert(false && "loader: null GetPhysicalDeviceDirectFBPresentationSupportEXT ICD pointer"); |
| 1087 | } |
| 1088 | |
| 1089 | return icd_term->dispatch.GetPhysicalDeviceDirectFBPresentationSupportEXT(phys_dev_term->phys_dev, queueFamilyIndex, dfb); |
| 1090 | } |
| 1091 | #endif // VK_USE_PLATFORM_DIRECTFB_EXT |
| 1092 | |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 1093 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1094 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 1095 | // Functions for the VK_KHR_android_surface extension: |
| 1096 | |
| 1097 | // This is the trampoline entrypoint for CreateAndroidSurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1098 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(VkInstance instance, ANativeWindow *window, |
| 1099 | const VkAllocationCallbacks *pAllocator, |
| 1100 | VkSurfaceKHR *pSurface) { |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 1101 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1102 | disp = loader_get_instance_layer_dispatch(instance); |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 1103 | VkResult res; |
| 1104 | |
| 1105 | res = disp->CreateAndroidSurfaceKHR(instance, window, pAllocator, pSurface); |
| 1106 | return res; |
| 1107 | } |
| 1108 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 1109 | // This is the instance chain terminator function for CreateAndroidSurfaceKHR |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1110 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR(VkInstance instance, Window window, |
| 1111 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1112 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 1113 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1114 | if (!ptr_instance->wsi_display_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 1115 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1116 | "VK_KHR_display extension not enabled. vkCreateAndroidSurfaceKHR not executed!\n"); |
Jeremy Hayes | 0231e1c | 2016-06-14 11:50:02 -0600 | [diff] [blame] | 1117 | return VK_ERROR_EXTENSION_NOT_PRESENT; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1118 | } |
| 1119 | |
| 1120 | // Next, if so, proceed with the implementation of this function: |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 1121 | VkIcdSurfaceAndroid *pIcdSurface = |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1122 | loader_instance_heap_alloc(ptr_instance, sizeof(VkIcdSurfaceAndroid), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 1123 | if (pIcdSurface == NULL) { |
| 1124 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1125 | } |
| 1126 | |
| 1127 | pIcdSurface->base.platform = VK_ICD_WSI_PLATFORM_ANDROID; |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 1128 | pIcdSurface->window = window; |
| 1129 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame] | 1130 | *pSurface = (VkSurfaceKHR)pIcdSurface; |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 1131 | |
| 1132 | return VK_SUCCESS; |
| 1133 | } |
| 1134 | |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 1135 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 1136 | |
Bryan Law-Smith | 5730569 | 2019-04-01 09:45:55 +0100 | [diff] [blame] | 1137 | // Functions for the VK_EXT_headless_surface extension: |
| 1138 | |
| 1139 | VKAPI_ATTR VkResult VKAPI_CALL vkCreateHeadlessSurfaceEXT(VkInstance instance, const VkHeadlessSurfaceCreateInfoEXT *pCreateInfo, |
| 1140 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 1141 | const VkLayerInstanceDispatchTable *disp; |
| 1142 | disp = loader_get_instance_layer_dispatch(instance); |
| 1143 | VkResult res; |
| 1144 | |
| 1145 | res = disp->CreateHeadlessSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface); |
| 1146 | return res; |
| 1147 | } |
| 1148 | |
| 1149 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateHeadlessSurfaceEXT(VkInstance instance, |
| 1150 | const VkHeadlessSurfaceCreateInfoEXT *pCreateInfo, |
| 1151 | const VkAllocationCallbacks *pAllocator, |
| 1152 | VkSurfaceKHR *pSurface) { |
| 1153 | struct loader_instance *inst = loader_get_instance(instance); |
| 1154 | VkIcdSurface *pIcdSurface = NULL; |
| 1155 | VkResult vkRes = VK_SUCCESS; |
| 1156 | uint32_t i = 0; |
| 1157 | |
| 1158 | if (!inst->wsi_headless_surface_enabled) { |
| 1159 | loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1160 | "VK_EXT_headless_surface extension not enabled. " |
| 1161 | "vkCreateHeadlessSurfaceEXT not executed!\n"); |
| 1162 | return VK_SUCCESS; |
| 1163 | } |
| 1164 | |
| 1165 | // Next, if so, proceed with the implementation of this function: |
| 1166 | pIcdSurface = AllocateIcdSurfaceStruct(inst, sizeof(pIcdSurface->headless_surf.base), sizeof(pIcdSurface->headless_surf)); |
| 1167 | if (pIcdSurface == NULL) { |
| 1168 | vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1169 | goto out; |
| 1170 | } |
| 1171 | |
| 1172 | pIcdSurface->headless_surf.base.platform = VK_ICD_WSI_PLATFORM_HEADLESS; |
| 1173 | // Loop through each ICD and determine if they need to create a surface |
| 1174 | for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 1175 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
| 1176 | if (NULL != icd_term->dispatch.CreateHeadlessSurfaceEXT) { |
| 1177 | vkRes = icd_term->dispatch.CreateHeadlessSurfaceEXT(icd_term->instance, pCreateInfo, pAllocator, |
| 1178 | &pIcdSurface->real_icd_surfaces[i]); |
| 1179 | if (VK_SUCCESS != vkRes) { |
| 1180 | goto out; |
| 1181 | } |
| 1182 | } |
| 1183 | } |
| 1184 | } |
| 1185 | |
| 1186 | *pSurface = (VkSurfaceKHR)pIcdSurface; |
| 1187 | |
| 1188 | out: |
| 1189 | |
| 1190 | if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { |
| 1191 | if (NULL != pIcdSurface->real_icd_surfaces) { |
| 1192 | i = 0; |
| 1193 | for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 1194 | if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { |
| 1195 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); |
| 1196 | } |
| 1197 | } |
| 1198 | loader_instance_heap_free(inst, pIcdSurface->real_icd_surfaces); |
| 1199 | } |
| 1200 | loader_instance_heap_free(inst, pIcdSurface); |
| 1201 | } |
| 1202 | |
| 1203 | return vkRes; |
| 1204 | } |
| 1205 | |
Karl Schultz | d81ebfb | 2017-12-12 10:33:01 -0500 | [diff] [blame] | 1206 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
| 1207 | |
| 1208 | // Functions for the VK_MVK_macos_surface extension: |
| 1209 | |
| 1210 | // This is the trampoline entrypoint for CreateMacOSSurfaceMVK |
| 1211 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(VkInstance instance, |
| 1212 | const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, |
| 1213 | const VkAllocationCallbacks *pAllocator, |
| 1214 | VkSurfaceKHR *pSurface) { |
| 1215 | const VkLayerInstanceDispatchTable *disp; |
| 1216 | disp = loader_get_instance_layer_dispatch(instance); |
| 1217 | VkResult res; |
| 1218 | |
| 1219 | res = disp->CreateMacOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); |
| 1220 | return res; |
| 1221 | } |
| 1222 | |
| 1223 | // This is the instance chain terminator function for CreateMacOSSurfaceKHR |
| 1224 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, |
| 1225 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 1226 | VkResult vkRes = VK_SUCCESS; |
| 1227 | VkIcdSurface *pIcdSurface = NULL; |
| 1228 | uint32_t i = 0; |
| 1229 | |
| 1230 | // First, check to ensure the appropriate extension was enabled: |
| 1231 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
| 1232 | if (!ptr_instance->wsi_macos_surface_enabled) { |
| 1233 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1234 | "VK_MVK_macos_surface extension not enabled. vkCreateMacOSSurfaceMVK not executed!\n"); |
| 1235 | vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; |
| 1236 | goto out; |
| 1237 | } |
| 1238 | |
| 1239 | // Next, if so, proceed with the implementation of this function: |
| 1240 | pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->macos_surf.base), sizeof(pIcdSurface->macos_surf)); |
| 1241 | if (pIcdSurface == NULL) { |
| 1242 | vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1243 | goto out; |
| 1244 | } |
| 1245 | |
| 1246 | pIcdSurface->macos_surf.base.platform = VK_ICD_WSI_PLATFORM_MACOS; |
| 1247 | pIcdSurface->macos_surf.pView = pCreateInfo->pView; |
| 1248 | |
| 1249 | // Loop through each ICD and determine if they need to create a surface |
| 1250 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 1251 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
| 1252 | if (NULL != icd_term->dispatch.CreateMacOSSurfaceMVK) { |
| 1253 | vkRes = icd_term->dispatch.CreateMacOSSurfaceMVK(icd_term->instance, pCreateInfo, pAllocator, |
| 1254 | &pIcdSurface->real_icd_surfaces[i]); |
| 1255 | if (VK_SUCCESS != vkRes) { |
| 1256 | goto out; |
| 1257 | } |
| 1258 | } |
| 1259 | } |
| 1260 | } |
| 1261 | |
| 1262 | *pSurface = (VkSurfaceKHR)pIcdSurface; |
| 1263 | |
| 1264 | out: |
| 1265 | |
| 1266 | if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { |
| 1267 | if (NULL != pIcdSurface->real_icd_surfaces) { |
| 1268 | i = 0; |
| 1269 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 1270 | if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { |
| 1271 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); |
| 1272 | } |
| 1273 | } |
| 1274 | loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); |
| 1275 | } |
| 1276 | loader_instance_heap_free(ptr_instance, pIcdSurface); |
| 1277 | } |
| 1278 | |
| 1279 | return vkRes; |
| 1280 | } |
| 1281 | |
| 1282 | #endif // VK_USE_PLATFORM_MACOS_MVK |
| 1283 | |
| 1284 | #ifdef VK_USE_PLATFORM_IOS_MVK |
| 1285 | |
| 1286 | // Functions for the VK_MVK_ios_surface extension: |
| 1287 | |
| 1288 | // This is the trampoline entrypoint for CreateIOSSurfaceMVK |
| 1289 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK(VkInstance instance, |
| 1290 | const VkIOSSurfaceCreateInfoMVK *pCreateInfo, |
| 1291 | const VkAllocationCallbacks *pAllocator, |
| 1292 | VkSurfaceKHR *pSurface) { |
| 1293 | const VkLayerInstanceDispatchTable *disp; |
| 1294 | disp = loader_get_instance_layer_dispatch(instance); |
| 1295 | VkResult res; |
| 1296 | |
| 1297 | res = disp->CreateIOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); |
| 1298 | return res; |
| 1299 | } |
| 1300 | |
| 1301 | // This is the instance chain terminator function for CreateIOSSurfaceKHR |
| 1302 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateIOSSurfaceMVK(VkInstance instance, const VkIOSSurfaceCreateInfoMVK *pCreateInfo, |
| 1303 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 1304 | // First, check to ensure the appropriate extension was enabled: |
| 1305 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
| 1306 | if (!ptr_instance->wsi_ios_surface_enabled) { |
| 1307 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1308 | "VK_MVK_ios_surface extension not enabled. vkCreateIOSSurfaceMVK not executed!\n"); |
| 1309 | return VK_ERROR_EXTENSION_NOT_PRESENT; |
| 1310 | } |
| 1311 | |
| 1312 | // Next, if so, proceed with the implementation of this function: |
| 1313 | VkIcdSurfaceIOS *pIcdSurface = |
| 1314 | loader_instance_heap_alloc(ptr_instance, sizeof(VkIcdSurfaceIOS), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); |
| 1315 | if (pIcdSurface == NULL) { |
| 1316 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1317 | } |
| 1318 | |
| 1319 | pIcdSurface->base.platform = VK_ICD_WSI_PLATFORM_IOS; |
| 1320 | pIcdSurface->pView = pCreateInfo->pView; |
| 1321 | |
| 1322 | *pSurface = (VkSurfaceKHR)pIcdSurface; |
| 1323 | |
| 1324 | return VK_SUCCESS; |
| 1325 | } |
| 1326 | |
| 1327 | #endif // VK_USE_PLATFORM_IOS_MVK |
| 1328 | |
J.D. Rouan | d7928a1 | 2020-11-16 15:36:42 -0800 | [diff] [blame^] | 1329 | #ifdef VK_USE_PLATFORM_GGP |
| 1330 | |
| 1331 | // Functions for the VK_GGP_stream_descriptor_surface extension: |
| 1332 | |
| 1333 | // This is the trampoline entrypoint for CreateStreamDescriptorSurfaceGGP |
| 1334 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 1335 | vkCreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP *pCreateInfo, |
| 1336 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 1337 | const VkLayerInstanceDispatchTable *disp; |
| 1338 | disp = loader_get_instance_layer_dispatch(instance); |
| 1339 | VkResult res; |
| 1340 | |
| 1341 | res = disp->CreateStreamDescriptorSurfaceGGP(instance, pCreateInfo, pAllocator, pSurface); |
| 1342 | return res; |
| 1343 | } |
| 1344 | |
| 1345 | // This is the instance chain terminator function for CreateStreamDescriptorSurfaceGGP |
| 1346 | VKAPI_ATTR VkResult VKAPI_CALL |
| 1347 | terminator_CreateStreamDescriptorSurfaceGGP(VkInstance instance, const VkStreamDescriptorSurfaceCreateInfoGGP *pCreateInfo, |
| 1348 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 1349 | VkResult vkRes = VK_SUCCESS; |
| 1350 | VkIcdSurface *pIcdSurface = NULL; |
| 1351 | uint32_t i = 0; |
| 1352 | |
| 1353 | // First, check to ensure the appropriate extension was enabled: |
| 1354 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
| 1355 | if (!ptr_instance->wsi_ggp_surface_enabled) { |
| 1356 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1357 | "VK_GGP_stream_descriptor_surface extension not enabled. vkCreateStreamDescriptorSurfaceGGP not executed!\n"); |
| 1358 | vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; |
| 1359 | goto out; |
| 1360 | } |
| 1361 | |
| 1362 | // Next, if so, proceed with the implementation of this function: |
| 1363 | pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->ggp_surf.base), sizeof(pIcdSurface->ggp_surf)); |
| 1364 | if (pIcdSurface == NULL) { |
| 1365 | vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1366 | goto out; |
| 1367 | } |
| 1368 | |
| 1369 | pIcdSurface->ggp_surf.base.platform = VK_ICD_WSI_PLATFORM_GGP; |
| 1370 | pIcdSurface->ggp_surf.streamDescriptor = pCreateInfo->streamDescriptor; |
| 1371 | |
| 1372 | // Loop through each ICD and determine if they need to create a surface |
| 1373 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 1374 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
| 1375 | if (NULL != icd_term->dispatch.CreateStreamDescriptorSurfaceGGP) { |
| 1376 | vkRes = icd_term->dispatch.CreateStreamDescriptorSurfaceGGP(icd_term->instance, pCreateInfo, pAllocator, |
| 1377 | &pIcdSurface->real_icd_surfaces[i]); |
| 1378 | if (VK_SUCCESS != vkRes) { |
| 1379 | goto out; |
| 1380 | } |
| 1381 | } |
| 1382 | } |
| 1383 | } |
| 1384 | |
| 1385 | *pSurface = (VkSurfaceKHR)pIcdSurface; |
| 1386 | |
| 1387 | out: |
| 1388 | |
| 1389 | if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { |
| 1390 | if (NULL != pIcdSurface->real_icd_surfaces) { |
| 1391 | i = 0; |
| 1392 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 1393 | if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { |
| 1394 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); |
| 1395 | } |
| 1396 | } |
| 1397 | loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); |
| 1398 | } |
| 1399 | loader_instance_heap_free(ptr_instance, pIcdSurface); |
| 1400 | } |
| 1401 | return vkRes; |
| 1402 | } |
| 1403 | |
| 1404 | #endif // VK_USE_PLATFORM_GGP |
| 1405 | |
Lenny Komow | a1b5e44 | 2019-09-16 16:14:36 -0600 | [diff] [blame] | 1406 | #if defined(VK_USE_PLATFORM_METAL_EXT) |
| 1407 | |
| 1408 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT(VkInstance instance, |
| 1409 | const VkMetalSurfaceCreateInfoEXT *pCreateInfo, |
| 1410 | const VkAllocationCallbacks *pAllocator, |
| 1411 | VkSurfaceKHR *pSurface) { |
| 1412 | const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(instance); |
| 1413 | return disp->CreateMetalSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface); |
| 1414 | } |
| 1415 | |
| 1416 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMetalSurfaceEXT(VkInstance instance, const VkMetalSurfaceCreateInfoEXT *pCreateInfo, |
| 1417 | const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { |
| 1418 | VkResult result = VK_SUCCESS; |
| 1419 | VkIcdSurface *icd_surface = NULL; |
| 1420 | uint32_t i; |
| 1421 | |
| 1422 | // First, check to ensure the appropriate extension was enabled: |
| 1423 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
| 1424 | if (!ptr_instance->wsi_metal_surface_enabled) { |
| 1425 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1426 | "VK_EXT_metal_surface extension not enabled. vkCreateMetalSurfaceEXT will not be executed.\n"); |
| 1427 | } |
| 1428 | |
| 1429 | // Next, if so, proceed with the implementation of this function: |
| 1430 | icd_surface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(icd_surface->metal_surf.base), sizeof(icd_surface->metal_surf)); |
| 1431 | if (icd_surface == NULL) { |
| 1432 | result = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1433 | goto out; |
| 1434 | } |
| 1435 | |
| 1436 | icd_surface->metal_surf.base.platform = VK_ICD_WSI_PLATFORM_METAL; |
| 1437 | icd_surface->metal_surf.pLayer = pCreateInfo->pLayer; |
| 1438 | |
| 1439 | // Loop through each ICD and determine if they need to create a surface |
| 1440 | i = 0; |
| 1441 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, ++i) { |
| 1442 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
| 1443 | if (icd_term->dispatch.CreateMetalSurfaceEXT != NULL) { |
| 1444 | result = icd_term->dispatch.CreateMetalSurfaceEXT(icd_term->instance, pCreateInfo, pAllocator, |
| 1445 | &icd_surface->real_icd_surfaces[i]); |
| 1446 | if (result != VK_SUCCESS) { |
| 1447 | goto out; |
| 1448 | } |
| 1449 | } |
| 1450 | } |
| 1451 | } |
| 1452 | *pSurface = (VkSurfaceKHR)icd_surface; |
| 1453 | |
| 1454 | out: |
| 1455 | if (result != VK_SUCCESS && icd_surface != NULL) { |
| 1456 | if (icd_surface->real_icd_surfaces != NULL) { |
| 1457 | i = 0; |
| 1458 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, ++i) { |
| 1459 | if (icd_surface->real_icd_surfaces[i] == VK_NULL_HANDLE && icd_term->dispatch.DestroySurfaceKHR != NULL) { |
| 1460 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, icd_surface->real_icd_surfaces[i], pAllocator); |
| 1461 | } |
| 1462 | } |
| 1463 | loader_instance_heap_free(ptr_instance, icd_surface->real_icd_surfaces); |
| 1464 | } |
| 1465 | loader_instance_heap_free(ptr_instance, icd_surface); |
| 1466 | } |
| 1467 | return result; |
| 1468 | } |
| 1469 | |
| 1470 | #endif |
| 1471 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 1472 | // Functions for the VK_KHR_display instance extension: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1473 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, |
| 1474 | uint32_t *pPropertyCount, |
| 1475 | VkDisplayPropertiesKHR *pProperties) { |
| 1476 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1477 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1478 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1479 | VkResult res = disp->GetPhysicalDeviceDisplayPropertiesKHR(unwrapped_phys_dev, pPropertyCount, pProperties); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1480 | return res; |
| 1481 | } |
| 1482 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1483 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, |
| 1484 | uint32_t *pPropertyCount, |
| 1485 | VkDisplayPropertiesKHR *pProperties) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1486 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1487 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 1488 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1489 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1490 | if (!ptr_instance->wsi_display_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 1491 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1492 | "VK_KHR_display extension not enabled. vkGetPhysicalDeviceDisplayPropertiesKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1493 | return VK_SUCCESS; |
| 1494 | } |
| 1495 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1496 | if (NULL == icd_term->dispatch.GetPhysicalDeviceDisplayPropertiesKHR) { |
| 1497 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1498 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceDisplayPropertiesKHR!\n"); |
| 1499 | assert(false && "loader: null GetPhysicalDeviceDisplayPropertiesKHR ICD pointer"); |
| 1500 | } |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1501 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1502 | return icd_term->dispatch.GetPhysicalDeviceDisplayPropertiesKHR(phys_dev_term->phys_dev, pPropertyCount, pProperties); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1503 | } |
| 1504 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1505 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlanePropertiesKHR( |
| 1506 | VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayPlanePropertiesKHR *pProperties) { |
| 1507 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1508 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1509 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1510 | VkResult res = disp->GetPhysicalDeviceDisplayPlanePropertiesKHR(unwrapped_phys_dev, pPropertyCount, pProperties); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1511 | return res; |
| 1512 | } |
| 1513 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1514 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, |
| 1515 | uint32_t *pPropertyCount, |
| 1516 | VkDisplayPlanePropertiesKHR *pProperties) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1517 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1518 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 1519 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1520 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1521 | if (!ptr_instance->wsi_display_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 1522 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1523 | "VK_KHR_display extension not enabled. vkGetPhysicalDeviceDisplayPlanePropertiesKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1524 | return VK_SUCCESS; |
| 1525 | } |
| 1526 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1527 | if (NULL == icd_term->dispatch.GetPhysicalDeviceDisplayPlanePropertiesKHR) { |
| 1528 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1529 | "ICD for selected physical device is not exporting vkGetPhysicalDeviceDisplayPlanePropertiesKHR!\n"); |
| 1530 | assert(false && "loader: null GetPhysicalDeviceDisplayPlanePropertiesKHR ICD pointer"); |
| 1531 | } |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1532 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1533 | return icd_term->dispatch.GetPhysicalDeviceDisplayPlanePropertiesKHR(phys_dev_term->phys_dev, pPropertyCount, pProperties); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1534 | } |
| 1535 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1536 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, |
| 1537 | uint32_t planeIndex, uint32_t *pDisplayCount, |
| 1538 | VkDisplayKHR *pDisplays) { |
| 1539 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1540 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1541 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1542 | VkResult res = disp->GetDisplayPlaneSupportedDisplaysKHR(unwrapped_phys_dev, planeIndex, pDisplayCount, pDisplays); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1543 | return res; |
| 1544 | } |
| 1545 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1546 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, |
| 1547 | uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1548 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1549 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 1550 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1551 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1552 | if (!ptr_instance->wsi_display_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 1553 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1554 | "VK_KHR_display extension not enabled. vkGetDisplayPlaneSupportedDisplaysKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1555 | return VK_SUCCESS; |
| 1556 | } |
| 1557 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1558 | if (NULL == icd_term->dispatch.GetDisplayPlaneSupportedDisplaysKHR) { |
| 1559 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1560 | "ICD for selected physical device is not exporting vkGetDisplayPlaneSupportedDisplaysKHR!\n"); |
| 1561 | assert(false && "loader: null GetDisplayPlaneSupportedDisplaysKHR ICD pointer"); |
| 1562 | } |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1563 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1564 | return icd_term->dispatch.GetDisplayPlaneSupportedDisplaysKHR(phys_dev_term->phys_dev, planeIndex, pDisplayCount, pDisplays); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1565 | } |
| 1566 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1567 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 1568 | uint32_t *pPropertyCount, |
| 1569 | VkDisplayModePropertiesKHR *pProperties) { |
| 1570 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1571 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1572 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1573 | VkResult res = disp->GetDisplayModePropertiesKHR(unwrapped_phys_dev, display, pPropertyCount, pProperties); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1574 | return res; |
| 1575 | } |
| 1576 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1577 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 1578 | uint32_t *pPropertyCount, |
| 1579 | VkDisplayModePropertiesKHR *pProperties) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1580 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1581 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 1582 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1583 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1584 | if (!ptr_instance->wsi_display_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 1585 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1586 | "VK_KHR_display extension not enabled. vkGetDisplayModePropertiesKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1587 | return VK_SUCCESS; |
| 1588 | } |
| 1589 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1590 | if (NULL == icd_term->dispatch.GetDisplayModePropertiesKHR) { |
| 1591 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1592 | "ICD for selected physical device is not exporting vkGetDisplayModePropertiesKHR!\n"); |
| 1593 | assert(false && "loader: null GetDisplayModePropertiesKHR ICD pointer"); |
| 1594 | } |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1595 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1596 | return icd_term->dispatch.GetDisplayModePropertiesKHR(phys_dev_term->phys_dev, display, pPropertyCount, pProperties); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1597 | } |
| 1598 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1599 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 1600 | const VkDisplayModeCreateInfoKHR *pCreateInfo, |
| 1601 | const VkAllocationCallbacks *pAllocator, |
| 1602 | VkDisplayModeKHR *pMode) { |
| 1603 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1604 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1605 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1606 | VkResult res = disp->CreateDisplayModeKHR(unwrapped_phys_dev, display, pCreateInfo, pAllocator, pMode); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1607 | return res; |
| 1608 | } |
| 1609 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1610 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 1611 | const VkDisplayModeCreateInfoKHR *pCreateInfo, |
| 1612 | const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1613 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1614 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 1615 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1616 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1617 | if (!ptr_instance->wsi_display_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 1618 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1619 | "VK_KHR_display extension not enabled. vkCreateDisplayModeKHR not executed!\n"); |
Jeremy Hayes | 0231e1c | 2016-06-14 11:50:02 -0600 | [diff] [blame] | 1620 | return VK_ERROR_EXTENSION_NOT_PRESENT; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1621 | } |
| 1622 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1623 | if (NULL == icd_term->dispatch.CreateDisplayModeKHR) { |
| 1624 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1625 | "ICD for selected physical device is not exporting vkCreateDisplayModeKHR!\n"); |
| 1626 | assert(false && "loader: null CreateDisplayModeKHR ICD pointer"); |
| 1627 | } |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1628 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1629 | return icd_term->dispatch.CreateDisplayModeKHR(phys_dev_term->phys_dev, display, pCreateInfo, pAllocator, pMode); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1630 | } |
| 1631 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1632 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, |
| 1633 | VkDisplayModeKHR mode, uint32_t planeIndex, |
| 1634 | VkDisplayPlaneCapabilitiesKHR *pCapabilities) { |
| 1635 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1636 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1637 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1638 | VkResult res = disp->GetDisplayPlaneCapabilitiesKHR(unwrapped_phys_dev, mode, planeIndex, pCapabilities); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1639 | return res; |
| 1640 | } |
| 1641 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1642 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, |
| 1643 | uint32_t planeIndex, |
| 1644 | VkDisplayPlaneCapabilitiesKHR *pCapabilities) { |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1645 | // First, check to ensure the appropriate extension was enabled: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1646 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
Mark Young | 26c1937 | 2016-11-03 14:27:13 -0600 | [diff] [blame] | 1647 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1648 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1649 | if (!ptr_instance->wsi_display_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 1650 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1651 | "VK_KHR_display extension not enabled. vkGetDisplayPlaneCapabilitiesKHR not executed!\n"); |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 1652 | return VK_SUCCESS; |
| 1653 | } |
| 1654 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1655 | if (NULL == icd_term->dispatch.GetDisplayPlaneCapabilitiesKHR) { |
| 1656 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1657 | "ICD for selected physical device is not exporting vkGetDisplayPlaneCapabilitiesKHR!\n"); |
| 1658 | assert(false && "loader: null GetDisplayPlaneCapabilitiesKHR ICD pointer"); |
| 1659 | } |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1660 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1661 | return icd_term->dispatch.GetDisplayPlaneCapabilitiesKHR(phys_dev_term->phys_dev, mode, planeIndex, pCapabilities); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1662 | } |
| 1663 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1664 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR(VkInstance instance, |
| 1665 | const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, |
| 1666 | const VkAllocationCallbacks *pAllocator, |
| 1667 | VkSurfaceKHR *pSurface) { |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1668 | const VkLayerInstanceDispatchTable *disp; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1669 | disp = loader_get_instance_layer_dispatch(instance); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1670 | VkResult res; |
| 1671 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1672 | res = disp->CreateDisplayPlaneSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1673 | return res; |
| 1674 | } |
| 1675 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1676 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(VkInstance instance, |
| 1677 | const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, |
| 1678 | const VkAllocationCallbacks *pAllocator, |
| 1679 | VkSurfaceKHR *pSurface) { |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1680 | struct loader_instance *inst = loader_get_instance(instance); |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 1681 | VkIcdSurface *pIcdSurface = NULL; |
Mark Young | f06def9 | 2016-11-01 19:20:41 -0600 | [diff] [blame] | 1682 | VkResult vkRes = VK_SUCCESS; |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 1683 | uint32_t i = 0; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1684 | |
Mark Young | f06def9 | 2016-11-01 19:20:41 -0600 | [diff] [blame] | 1685 | if (!inst->wsi_display_enabled) { |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 1686 | loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1687 | "VK_KHR_surface extension not enabled. vkCreateDisplayPlaneSurfaceKHR not executed!\n"); |
Mark Young | f06def9 | 2016-11-01 19:20:41 -0600 | [diff] [blame] | 1688 | vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; |
| 1689 | goto out; |
Petros Bantolas | f309586 | 2016-04-14 12:50:42 +0100 | [diff] [blame] | 1690 | } |
| 1691 | |
Piers Daniell | c21fde5 | 2016-12-13 16:51:49 -0700 | [diff] [blame] | 1692 | // Next, if so, proceed with the implementation of this function: |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1693 | pIcdSurface = AllocateIcdSurfaceStruct(inst, sizeof(pIcdSurface->display_surf.base), sizeof(pIcdSurface->display_surf)); |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1694 | if (pIcdSurface == NULL) { |
Mark Young | f06def9 | 2016-11-01 19:20:41 -0600 | [diff] [blame] | 1695 | vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1696 | goto out; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1697 | } |
| 1698 | |
Mark Young | 5467d67 | 2016-06-28 10:52:43 -0600 | [diff] [blame] | 1699 | pIcdSurface->display_surf.base.platform = VK_ICD_WSI_PLATFORM_DISPLAY; |
| 1700 | pIcdSurface->display_surf.displayMode = pCreateInfo->displayMode; |
| 1701 | pIcdSurface->display_surf.planeIndex = pCreateInfo->planeIndex; |
| 1702 | pIcdSurface->display_surf.planeStackIndex = pCreateInfo->planeStackIndex; |
| 1703 | pIcdSurface->display_surf.transform = pCreateInfo->transform; |
| 1704 | pIcdSurface->display_surf.globalAlpha = pCreateInfo->globalAlpha; |
| 1705 | pIcdSurface->display_surf.alphaMode = pCreateInfo->alphaMode; |
| 1706 | pIcdSurface->display_surf.imageExtent = pCreateInfo->imageExtent; |
| 1707 | |
Mark Young | f06def9 | 2016-11-01 19:20:41 -0600 | [diff] [blame] | 1708 | // Loop through each ICD and determine if they need to create a surface |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1709 | for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 1710 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1711 | if (NULL != icd_term->dispatch.CreateDisplayPlaneSurfaceKHR) { |
| 1712 | vkRes = icd_term->dispatch.CreateDisplayPlaneSurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, |
| 1713 | &pIcdSurface->real_icd_surfaces[i]); |
Mark Young | f06def9 | 2016-11-01 19:20:41 -0600 | [diff] [blame] | 1714 | if (VK_SUCCESS != vkRes) { |
| 1715 | goto out; |
| 1716 | } |
| 1717 | } |
| 1718 | } |
| 1719 | } |
| 1720 | |
Mark Young | 3eda588 | 2016-12-01 10:42:21 -0700 | [diff] [blame] | 1721 | *pSurface = (VkSurfaceKHR)pIcdSurface; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1722 | |
Mark Young | f06def9 | 2016-11-01 19:20:41 -0600 | [diff] [blame] | 1723 | out: |
| 1724 | |
| 1725 | if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { |
| 1726 | if (NULL != pIcdSurface->real_icd_surfaces) { |
Mark Young | 573a7a1 | 2016-11-02 09:37:08 -0600 | [diff] [blame] | 1727 | i = 0; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1728 | for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1729 | if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { |
| 1730 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); |
Mark Young | f06def9 | 2016-11-01 19:20:41 -0600 | [diff] [blame] | 1731 | } |
| 1732 | } |
| 1733 | loader_instance_heap_free(inst, pIcdSurface->real_icd_surfaces); |
| 1734 | } |
| 1735 | loader_instance_heap_free(inst, pIcdSurface); |
| 1736 | } |
| 1737 | |
| 1738 | return vkRes; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 1739 | } |
| 1740 | |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1741 | // EXT_display_swapchain Extension command |
| 1742 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1743 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, |
| 1744 | const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 1745 | const VkAllocationCallbacks *pAllocator, |
| 1746 | VkSwapchainKHR *pSwapchains) { |
Mark Young | 2a2122f | 2016-09-08 18:36:32 -0600 | [diff] [blame] | 1747 | const VkLayerDispatchTable *disp; |
| 1748 | disp = loader_get_dispatch(device); |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1749 | return disp->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); |
Mark Young | f2eabea | 2016-07-01 15:18:27 -0600 | [diff] [blame] | 1750 | } |
| 1751 | |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1752 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, |
| 1753 | const VkSwapchainCreateInfoKHR *pCreateInfos, |
| 1754 | const VkAllocationCallbacks *pAllocator, |
| 1755 | VkSwapchainKHR *pSwapchains) { |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1756 | uint32_t icd_index = 0; |
| 1757 | struct loader_device *dev; |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1758 | struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1759 | if (NULL != icd_term && NULL != icd_term->dispatch.CreateSharedSwapchainsKHR) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1760 | VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pCreateInfos->surface; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1761 | if (NULL != icd_surface->real_icd_surfaces) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1762 | if ((VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[icd_index]) { |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1763 | // We found the ICD, and there is an ICD KHR surface |
| 1764 | // associated with it, so copy the CreateInfo struct |
| 1765 | // and point it at the ICD's surface. |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1766 | VkSwapchainCreateInfoKHR *pCreateCopy = loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR) * swapchainCount); |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1767 | if (NULL == pCreateCopy) { |
| 1768 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1769 | } |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1770 | memcpy(pCreateCopy, pCreateInfos, sizeof(VkSwapchainCreateInfoKHR) * swapchainCount); |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1771 | for (uint32_t sc = 0; sc < swapchainCount; sc++) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 1772 | pCreateCopy[sc].surface = icd_surface->real_icd_surfaces[icd_index]; |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1773 | } |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1774 | return icd_term->dispatch.CreateSharedSwapchainsKHR(device, swapchainCount, pCreateCopy, pAllocator, pSwapchains); |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1775 | } |
| 1776 | } |
Mark Young | d4e5ba4 | 2017-02-28 09:58:04 -0700 | [diff] [blame] | 1777 | return icd_term->dispatch.CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); |
Mark Young | 274e4bc | 2017-01-19 21:10:49 -0700 | [diff] [blame] | 1778 | } |
| 1779 | return VK_SUCCESS; |
| 1780 | } |
| 1781 | |
Lenny Komow | dbaaad6 | 2017-10-02 15:08:53 -0600 | [diff] [blame] | 1782 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHR( |
| 1783 | VkDevice device, |
| 1784 | VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities) { |
| 1785 | const VkLayerDispatchTable *disp = loader_get_dispatch(device); |
| 1786 | return disp->GetDeviceGroupPresentCapabilitiesKHR(device, pDeviceGroupPresentCapabilities); |
| 1787 | } |
Lenny Komow | 3121743 | 2017-10-02 15:08:53 -0600 | [diff] [blame] | 1788 | |
Lenny Komow | dbaaad6 | 2017-10-02 15:08:53 -0600 | [diff] [blame] | 1789 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHR( |
| 1790 | VkDevice device, |
| 1791 | VkSurfaceKHR surface, |
| 1792 | VkDeviceGroupPresentModeFlagsKHR* pModes) { |
| 1793 | const VkLayerDispatchTable *disp = loader_get_dispatch(device); |
| 1794 | return disp->GetDeviceGroupSurfacePresentModesKHR(device, surface, pModes); |
| 1795 | } |
| 1796 | |
Lenny Komow | 7871f78 | 2017-10-11 15:39:38 -0600 | [diff] [blame] | 1797 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDeviceGroupSurfacePresentModesKHR( |
| 1798 | VkDevice device, |
| 1799 | VkSurfaceKHR surface, |
| 1800 | VkDeviceGroupPresentModeFlagsKHR* pModes) { |
| 1801 | uint32_t icd_index = 0; |
| 1802 | struct loader_device *dev; |
| 1803 | struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); |
| 1804 | if (NULL != icd_term && NULL != icd_term->dispatch.GetDeviceGroupSurfacePresentModesKHR) { |
| 1805 | VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; |
| 1806 | if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[icd_index]) { |
| 1807 | return icd_term->dispatch.GetDeviceGroupSurfacePresentModesKHR(device, icd_surface->real_icd_surfaces[icd_index], pModes); |
| 1808 | } |
| 1809 | return icd_term->dispatch.GetDeviceGroupSurfacePresentModesKHR(device, surface, pModes); |
| 1810 | } |
| 1811 | return VK_SUCCESS; |
| 1812 | } |
| 1813 | |
Lenny Komow | dbaaad6 | 2017-10-02 15:08:53 -0600 | [diff] [blame] | 1814 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHR( |
Lenny Komow | 3121743 | 2017-10-02 15:08:53 -0600 | [diff] [blame] | 1815 | VkPhysicalDevice physicalDevice, |
| 1816 | VkSurfaceKHR surface, |
| 1817 | uint32_t* pRectCount, |
| 1818 | VkRect2D* pRects) { |
| 1819 | const VkLayerInstanceDispatchTable *disp; |
| 1820 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
| 1821 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
| 1822 | return disp->GetPhysicalDevicePresentRectanglesKHR(unwrapped_phys_dev, surface, pRectCount, pRects); |
| 1823 | } |
| 1824 | |
| 1825 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDevicePresentRectanglesKHR( |
| 1826 | VkPhysicalDevice physicalDevice, |
| 1827 | VkSurfaceKHR surface, |
| 1828 | uint32_t* pRectCount, |
| 1829 | VkRect2D* pRects) { |
| 1830 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
| 1831 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
| 1832 | if (NULL == icd_term->dispatch.GetPhysicalDevicePresentRectanglesKHR) { |
| 1833 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 1834 | "ICD associated with VkPhysicalDevice does not support GetPhysicalDevicePresentRectanglesKHX"); |
| 1835 | } |
| 1836 | VkIcdSurface *icd_surface = (VkIcdSurface *)(surface); |
| 1837 | uint8_t icd_index = phys_dev_term->icd_index; |
| 1838 | if (NULL != icd_surface->real_icd_surfaces && NULL != (void *)icd_surface->real_icd_surfaces[icd_index]) { |
| 1839 | return icd_term->dispatch.GetPhysicalDevicePresentRectanglesKHR(phys_dev_term->phys_dev, icd_surface->real_icd_surfaces[icd_index], pRectCount, pRects); |
| 1840 | } |
| 1841 | return icd_term->dispatch.GetPhysicalDevicePresentRectanglesKHR(phys_dev_term->phys_dev, surface, pRectCount, pRects); |
| 1842 | } |
| 1843 | |
Lenny Komow | dbaaad6 | 2017-10-02 15:08:53 -0600 | [diff] [blame] | 1844 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHR( |
| 1845 | VkDevice device, |
| 1846 | const VkAcquireNextImageInfoKHR* pAcquireInfo, |
| 1847 | uint32_t* pImageIndex) { |
| 1848 | const VkLayerDispatchTable *disp = loader_get_dispatch(device); |
| 1849 | return disp->AcquireNextImage2KHR(device, pAcquireInfo, pImageIndex); |
| 1850 | } |
| 1851 | |
Lenny Komow | 6113978 | 2018-05-31 11:32:31 -0600 | [diff] [blame] | 1852 | // ---- VK_KHR_get_display_properties2 extension trampoline/terminators |
| 1853 | |
| 1854 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice, |
| 1855 | uint32_t *pPropertyCount, |
| 1856 | VkDisplayProperties2KHR *pProperties) { |
| 1857 | const VkLayerInstanceDispatchTable *disp; |
| 1858 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
| 1859 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
| 1860 | return disp->GetPhysicalDeviceDisplayProperties2KHR(unwrapped_phys_dev, pPropertyCount, pProperties); |
| 1861 | } |
| 1862 | |
| 1863 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice, |
| 1864 | uint32_t *pPropertyCount, |
| 1865 | VkDisplayProperties2KHR *pProperties) { |
| 1866 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
| 1867 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
| 1868 | |
| 1869 | // If the function is available in the driver, just call into it |
| 1870 | if (icd_term->dispatch.GetPhysicalDeviceDisplayProperties2KHR != NULL) { |
| 1871 | return icd_term->dispatch.GetPhysicalDeviceDisplayProperties2KHR(phys_dev_term->phys_dev, pPropertyCount, pProperties); |
| 1872 | } |
| 1873 | |
| 1874 | // We have to emulate the function. |
| 1875 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, |
| 1876 | "vkGetPhysicalDeviceDisplayProperties2KHR: Emulating call in ICD \"%s\"", icd_term->scanned_icd->lib_name); |
| 1877 | |
| 1878 | // If the icd doesn't support VK_KHR_display, then no properties are available |
| 1879 | if (icd_term->dispatch.GetPhysicalDeviceDisplayPropertiesKHR == NULL) { |
| 1880 | *pPropertyCount = 0; |
| 1881 | return VK_SUCCESS; |
| 1882 | } |
| 1883 | |
| 1884 | // If we aren't writing to pProperties, then emulation is straightforward |
| 1885 | if (pProperties == NULL || *pPropertyCount == 0) { |
| 1886 | return icd_term->dispatch.GetPhysicalDeviceDisplayPropertiesKHR(phys_dev_term->phys_dev, pPropertyCount, NULL); |
| 1887 | } |
| 1888 | |
| 1889 | // If we do have to write to pProperties, then we need to write to a temporary array of VkDisplayPropertiesKHR and copy it |
| 1890 | VkDisplayPropertiesKHR *properties = loader_stack_alloc(*pPropertyCount * sizeof(VkDisplayPropertiesKHR)); |
| 1891 | if (properties == NULL) { |
| 1892 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1893 | } |
| 1894 | VkResult res = icd_term->dispatch.GetPhysicalDeviceDisplayPropertiesKHR(phys_dev_term->phys_dev, pPropertyCount, properties); |
| 1895 | if (res < 0) { |
| 1896 | return res; |
| 1897 | } |
| 1898 | for (uint32_t i = 0; i < *pPropertyCount; ++i) { |
| 1899 | memcpy(&pProperties[i].displayProperties, &properties[i], sizeof(VkDisplayPropertiesKHR)); |
| 1900 | } |
| 1901 | return res; |
| 1902 | } |
| 1903 | |
| 1904 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlaneProperties2KHR( |
| 1905 | VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayPlaneProperties2KHR *pProperties) { |
| 1906 | const VkLayerInstanceDispatchTable *disp; |
| 1907 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
| 1908 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
| 1909 | return disp->GetPhysicalDeviceDisplayPlaneProperties2KHR(unwrapped_phys_dev, pPropertyCount, pProperties); |
| 1910 | } |
| 1911 | |
| 1912 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlaneProperties2KHR(VkPhysicalDevice physicalDevice, |
| 1913 | uint32_t *pPropertyCount, |
| 1914 | VkDisplayPlaneProperties2KHR *pProperties) { |
| 1915 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
| 1916 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
| 1917 | |
| 1918 | // If the function is available in the driver, just call into it |
| 1919 | if (icd_term->dispatch.GetPhysicalDeviceDisplayPlaneProperties2KHR != NULL) { |
| 1920 | return icd_term->dispatch.GetPhysicalDeviceDisplayPlaneProperties2KHR(phys_dev_term->phys_dev, pPropertyCount, pProperties); |
| 1921 | } |
| 1922 | |
| 1923 | // We have to emulate the function. |
| 1924 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, |
| 1925 | "vkGetPhysicalDeviceDisplayPlaneProperties2KHR: Emulating call in ICD \"%s\"", icd_term->scanned_icd->lib_name); |
| 1926 | |
| 1927 | // If the icd doesn't support VK_KHR_display, then no properties are available |
| 1928 | if (icd_term->dispatch.GetPhysicalDeviceDisplayPlanePropertiesKHR == NULL) { |
| 1929 | *pPropertyCount = 0; |
| 1930 | return VK_SUCCESS; |
| 1931 | } |
| 1932 | |
| 1933 | // If we aren't writing to pProperties, then emulation is straightforward |
| 1934 | if (pProperties == NULL || *pPropertyCount == 0) { |
| 1935 | return icd_term->dispatch.GetPhysicalDeviceDisplayPlanePropertiesKHR(phys_dev_term->phys_dev, pPropertyCount, NULL); |
| 1936 | } |
| 1937 | |
| 1938 | // If we do have to write to pProperties, then we need to write to a temporary array of VkDisplayPlanePropertiesKHR and copy it |
| 1939 | VkDisplayPlanePropertiesKHR *properties = loader_stack_alloc(*pPropertyCount * sizeof(VkDisplayPlanePropertiesKHR)); |
| 1940 | if (properties == NULL) { |
| 1941 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1942 | } |
| 1943 | VkResult res = |
| 1944 | icd_term->dispatch.GetPhysicalDeviceDisplayPlanePropertiesKHR(phys_dev_term->phys_dev, pPropertyCount, properties); |
| 1945 | if (res < 0) { |
| 1946 | return res; |
| 1947 | } |
| 1948 | for (uint32_t i = 0; i < *pPropertyCount; ++i) { |
| 1949 | memcpy(&pProperties[i].displayPlaneProperties, &properties[i], sizeof(VkDisplayPlanePropertiesKHR)); |
| 1950 | } |
| 1951 | return res; |
| 1952 | } |
| 1953 | |
| 1954 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModeProperties2KHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 1955 | uint32_t *pPropertyCount, |
| 1956 | VkDisplayModeProperties2KHR *pProperties) { |
| 1957 | const VkLayerInstanceDispatchTable *disp; |
| 1958 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
| 1959 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
| 1960 | return disp->GetDisplayModeProperties2KHR(unwrapped_phys_dev, display, pPropertyCount, pProperties); |
| 1961 | } |
| 1962 | |
| 1963 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModeProperties2KHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, |
| 1964 | uint32_t *pPropertyCount, |
| 1965 | VkDisplayModeProperties2KHR *pProperties) { |
| 1966 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
| 1967 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
| 1968 | |
| 1969 | // If the function is available in the driver, just call into it |
| 1970 | if (icd_term->dispatch.GetDisplayModeProperties2KHR != NULL) { |
| 1971 | return icd_term->dispatch.GetDisplayModeProperties2KHR(phys_dev_term->phys_dev, display, pPropertyCount, pProperties); |
| 1972 | } |
| 1973 | |
| 1974 | // We have to emulate the function. |
| 1975 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, |
| 1976 | "vkGetDisplayModeProperties2KHR: Emulating call in ICD \"%s\"", icd_term->scanned_icd->lib_name); |
| 1977 | |
| 1978 | // If the icd doesn't support VK_KHR_display, then no properties are available |
| 1979 | if (icd_term->dispatch.GetDisplayModePropertiesKHR == NULL) { |
| 1980 | *pPropertyCount = 0; |
| 1981 | return VK_SUCCESS; |
| 1982 | } |
| 1983 | |
| 1984 | // If we aren't writing to pProperties, then emulation is straightforward |
| 1985 | if (pProperties == NULL || *pPropertyCount == 0) { |
| 1986 | return icd_term->dispatch.GetDisplayModePropertiesKHR(phys_dev_term->phys_dev, display, pPropertyCount, NULL); |
| 1987 | } |
| 1988 | |
| 1989 | // If we do have to write to pProperties, then we need to write to a temporary array of VkDisplayModePropertiesKHR and copy it |
| 1990 | VkDisplayModePropertiesKHR *properties = loader_stack_alloc(*pPropertyCount * sizeof(VkDisplayModePropertiesKHR)); |
| 1991 | if (properties == NULL) { |
| 1992 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 1993 | } |
| 1994 | VkResult res = icd_term->dispatch.GetDisplayModePropertiesKHR(phys_dev_term->phys_dev, display, pPropertyCount, properties); |
| 1995 | if (res < 0) { |
| 1996 | return res; |
| 1997 | } |
| 1998 | for (uint32_t i = 0; i < *pPropertyCount; ++i) { |
| 1999 | memcpy(&pProperties[i].displayModeProperties, &properties[i], sizeof(VkDisplayModePropertiesKHR)); |
| 2000 | } |
| 2001 | return res; |
| 2002 | } |
| 2003 | |
| 2004 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physicalDevice, |
| 2005 | const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo, |
| 2006 | VkDisplayPlaneCapabilities2KHR *pCapabilities) { |
| 2007 | const VkLayerInstanceDispatchTable *disp; |
| 2008 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
| 2009 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
| 2010 | return disp->GetDisplayPlaneCapabilities2KHR(unwrapped_phys_dev, pDisplayPlaneInfo, pCapabilities); |
| 2011 | } |
| 2012 | |
| 2013 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physicalDevice, |
| 2014 | const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo, |
| 2015 | VkDisplayPlaneCapabilities2KHR *pCapabilities) { |
| 2016 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
| 2017 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
| 2018 | |
| 2019 | // If the function is abailable in the driver, just call into it |
| 2020 | if (icd_term->dispatch.GetDisplayPlaneCapabilities2KHR != NULL) { |
| 2021 | return icd_term->dispatch.GetDisplayPlaneCapabilities2KHR(phys_dev_term->phys_dev, pDisplayPlaneInfo, pCapabilities); |
| 2022 | } |
| 2023 | |
| 2024 | // We have to emulate the function. |
| 2025 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, |
| 2026 | "vkGetDisplayPlaneCapabilities2KHR: Emulating call in ICD \"%s\"", icd_term->scanned_icd->lib_name); |
| 2027 | |
| 2028 | // Just call into the old version of the function. |
| 2029 | // If the icd doesn't support VK_KHR_display, there are zero planes and this call is invalid (and will crash) |
| 2030 | return icd_term->dispatch.GetDisplayPlaneCapabilitiesKHR(phys_dev_term->phys_dev, pDisplayPlaneInfo->mode, |
| 2031 | pDisplayPlaneInfo->planeIndex, &pCapabilities->capabilities); |
| 2032 | } |
| 2033 | |
Craig Stout | f3b74dc | 2020-10-26 12:05:15 -0700 | [diff] [blame] | 2034 | #ifdef VK_USE_PLATFORM_FUCHSIA |
| 2035 | |
| 2036 | // This is the trampoline entrypoint for CreateImagePipeSurfaceFUCHSIA |
| 2037 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA(VkInstance instance, |
| 2038 | const VkImagePipeSurfaceCreateInfoFUCHSIA *pCreateInfo, |
| 2039 | const VkAllocationCallbacks *pAllocator, |
| 2040 | VkSurfaceKHR *pSurface) { |
| 2041 | const VkLayerInstanceDispatchTable *disp; |
| 2042 | disp = loader_get_instance_layer_dispatch(instance); |
| 2043 | VkResult res; |
| 2044 | |
| 2045 | res = disp->CreateImagePipeSurfaceFUCHSIA(instance, pCreateInfo, pAllocator, pSurface); |
| 2046 | return res; |
| 2047 | } |
| 2048 | |
| 2049 | // This is the instance chain terminator function for CreateImagePipeSurfaceFUCHSIA |
| 2050 | VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateImagePipeSurfaceFUCHSIA(VkInstance instance, |
| 2051 | const VkImagePipeSurfaceCreateInfoFUCHSIA *pCreateInfo, |
| 2052 | const VkAllocationCallbacks *pAllocator, |
| 2053 | VkSurfaceKHR *pSurface) { |
| 2054 | VkResult vkRes = VK_SUCCESS; |
| 2055 | VkIcdSurface *pIcdSurface = NULL; |
| 2056 | uint32_t i = 0; |
| 2057 | |
| 2058 | // Initialize pSurface to NULL just to be safe. |
| 2059 | *pSurface = VK_NULL_HANDLE; |
| 2060 | // First, check to ensure the appropriate extension was enabled: |
| 2061 | struct loader_instance *ptr_instance = loader_get_instance(instance); |
| 2062 | if (!ptr_instance->wsi_imagepipe_surface_enabled) { |
| 2063 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 2064 | "VK_FUCHSIA_imagepipe_surface extension not enabled. " |
| 2065 | "vkCreateImagePipeSurfaceFUCHSIA not executed!\n"); |
| 2066 | vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; |
| 2067 | goto out; |
| 2068 | } |
| 2069 | |
| 2070 | // Next, if so, proceed with the implementation of this function: |
| 2071 | pIcdSurface = |
| 2072 | AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->imagepipe_surf.base), sizeof(pIcdSurface->imagepipe_surf)); |
| 2073 | if (pIcdSurface == NULL) { |
| 2074 | vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; |
| 2075 | goto out; |
| 2076 | } |
| 2077 | |
| 2078 | pIcdSurface->imagepipe_surf.base.platform = VK_ICD_WSI_PLATFORM_FUCHSIA; |
| 2079 | |
| 2080 | // Loop through each ICD and determine if they need to create a surface |
| 2081 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 2082 | if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { |
| 2083 | if (NULL != icd_term->dispatch.CreateImagePipeSurfaceFUCHSIA) { |
| 2084 | vkRes = icd_term->dispatch.CreateImagePipeSurfaceFUCHSIA(icd_term->instance, pCreateInfo, pAllocator, |
| 2085 | &pIcdSurface->real_icd_surfaces[i]); |
| 2086 | if (VK_SUCCESS != vkRes) { |
| 2087 | goto out; |
| 2088 | } |
| 2089 | } |
| 2090 | } |
| 2091 | } |
| 2092 | |
| 2093 | *pSurface = (VkSurfaceKHR)(pIcdSurface); |
| 2094 | |
| 2095 | out: |
| 2096 | |
| 2097 | if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { |
| 2098 | if (NULL != pIcdSurface->real_icd_surfaces) { |
| 2099 | i = 0; |
| 2100 | for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { |
| 2101 | if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->dispatch.DestroySurfaceKHR) { |
| 2102 | icd_term->dispatch.DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); |
| 2103 | } |
| 2104 | } |
| 2105 | loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); |
| 2106 | } |
| 2107 | loader_instance_heap_free(ptr_instance, pIcdSurface); |
| 2108 | } |
| 2109 | |
| 2110 | return vkRes; |
| 2111 | } |
| 2112 | #endif // VK_USE_PLATFORM_FUCHSIA |
| 2113 | |
Joshua Ashton | 03cc64b | 2020-03-12 04:42:26 +0000 | [diff] [blame] | 2114 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2115 | vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, |
| 2116 | VkSurfaceCapabilities2KHR *pSurfaceCapabilities) { |
| 2117 | const VkLayerInstanceDispatchTable *disp; |
| 2118 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
| 2119 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
| 2120 | return disp->GetPhysicalDeviceSurfaceCapabilities2KHR(unwrapped_phys_dev, pSurfaceInfo, pSurfaceCapabilities); |
| 2121 | } |
| 2122 | |
| 2123 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2KHR( |
| 2124 | VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, |
| 2125 | VkSurfaceCapabilities2KHR *pSurfaceCapabilities) { |
| 2126 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
| 2127 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Joshua Ashton | 64c3693 | 2020-03-12 22:57:49 +0000 | [diff] [blame] | 2128 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
| 2129 | |
| 2130 | if (!ptr_instance->wsi_surface_enabled) { |
| 2131 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 2132 | "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceCapabilities2KHR not executed!\n"); |
| 2133 | return VK_SUCCESS; |
| 2134 | } |
Joshua Ashton | 03cc64b | 2020-03-12 04:42:26 +0000 | [diff] [blame] | 2135 | |
| 2136 | VkIcdSurface *icd_surface = (VkIcdSurface *)(pSurfaceInfo->surface); |
| 2137 | uint8_t icd_index = phys_dev_term->icd_index; |
| 2138 | |
| 2139 | if (icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilities2KHR != NULL) { |
| 2140 | VkBaseOutStructure *pNext = (VkBaseOutStructure *)pSurfaceCapabilities->pNext; |
| 2141 | while (pNext != NULL) { |
| 2142 | if ((int)pNext->sType == VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR) { |
| 2143 | // Not all ICDs may be supporting VK_KHR_surface_protected_capabilities |
| 2144 | // Initialize VkSurfaceProtectedCapabilitiesKHR.supportsProtected to false and |
| 2145 | // if an ICD supports protected surfaces, it will reset it to true accordingly. |
| 2146 | ((VkSurfaceProtectedCapabilitiesKHR *)pNext)->supportsProtected = VK_FALSE; |
| 2147 | } |
| 2148 | pNext = (VkBaseOutStructure *)pNext->pNext; |
| 2149 | } |
| 2150 | |
| 2151 | // Pass the call to the driver, possibly unwrapping the ICD surface |
| 2152 | if (icd_surface->real_icd_surfaces != NULL && (void *)icd_surface->real_icd_surfaces[icd_index] != NULL) { |
| 2153 | VkPhysicalDeviceSurfaceInfo2KHR info_copy = *pSurfaceInfo; |
| 2154 | info_copy.surface = icd_surface->real_icd_surfaces[icd_index]; |
| 2155 | return icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilities2KHR(phys_dev_term->phys_dev, &info_copy, |
| 2156 | pSurfaceCapabilities); |
| 2157 | } else { |
| 2158 | return icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilities2KHR(phys_dev_term->phys_dev, pSurfaceInfo, |
| 2159 | pSurfaceCapabilities); |
| 2160 | } |
| 2161 | } else { |
| 2162 | // Emulate the call |
| 2163 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, |
| 2164 | "vkGetPhysicalDeviceSurfaceCapabilities2KHR: Emulating call in ICD \"%s\" using " |
| 2165 | "vkGetPhysicalDeviceSurfaceCapabilitiesKHR", |
| 2166 | icd_term->scanned_icd->lib_name); |
| 2167 | |
| 2168 | if (pSurfaceInfo->pNext != NULL) { |
| 2169 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, |
| 2170 | "vkGetPhysicalDeviceSurfaceCapabilities2KHR: Emulation found unrecognized structure type in " |
| 2171 | "pSurfaceInfo->pNext - this struct will be ignored"); |
| 2172 | } |
| 2173 | |
| 2174 | // Write to the VkSurfaceCapabilities2KHR struct |
| 2175 | VkSurfaceKHR surface = pSurfaceInfo->surface; |
| 2176 | if (icd_surface->real_icd_surfaces != NULL && (void *)icd_surface->real_icd_surfaces[icd_index] != NULL) { |
| 2177 | surface = icd_surface->real_icd_surfaces[icd_index]; |
| 2178 | } |
| 2179 | VkResult res = icd_term->dispatch.GetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev_term->phys_dev, surface, |
| 2180 | &pSurfaceCapabilities->surfaceCapabilities); |
| 2181 | |
| 2182 | if (pSurfaceCapabilities->pNext != NULL) { |
| 2183 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, |
| 2184 | "vkGetPhysicalDeviceSurfaceCapabilities2KHR: Emulation found unrecognized structure type in " |
| 2185 | "pSurfaceCapabilities->pNext - this struct will be ignored"); |
| 2186 | } |
| 2187 | return res; |
| 2188 | } |
| 2189 | } |
| 2190 | |
| 2191 | LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL |
| 2192 | vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, |
| 2193 | uint32_t *pSurfaceFormatCount, VkSurfaceFormat2KHR *pSurfaceFormats) { |
| 2194 | const VkLayerInstanceDispatchTable *disp; |
| 2195 | VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); |
| 2196 | disp = loader_get_instance_layer_dispatch(physicalDevice); |
| 2197 | return disp->GetPhysicalDeviceSurfaceFormats2KHR(unwrapped_phys_dev, pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats); |
| 2198 | } |
| 2199 | |
| 2200 | VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, |
| 2201 | const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, |
| 2202 | uint32_t *pSurfaceFormatCount, |
| 2203 | VkSurfaceFormat2KHR *pSurfaceFormats) { |
| 2204 | struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; |
| 2205 | struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; |
Joshua Ashton | 64c3693 | 2020-03-12 22:57:49 +0000 | [diff] [blame] | 2206 | struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; |
| 2207 | |
| 2208 | if (!ptr_instance->wsi_surface_enabled) { |
| 2209 | loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, |
| 2210 | "VK_KHR_surface extension not enabled. vkGetPhysicalDeviceSurfaceFormats2KHR not executed!\n"); |
| 2211 | return VK_SUCCESS; |
| 2212 | } |
Joshua Ashton | 03cc64b | 2020-03-12 04:42:26 +0000 | [diff] [blame] | 2213 | |
| 2214 | VkIcdSurface *icd_surface = (VkIcdSurface *)(pSurfaceInfo->surface); |
| 2215 | uint8_t icd_index = phys_dev_term->icd_index; |
| 2216 | |
| 2217 | if (icd_term->dispatch.GetPhysicalDeviceSurfaceFormats2KHR != NULL) { |
| 2218 | // Pass the call to the driver, possibly unwrapping the ICD surface |
| 2219 | if (icd_surface->real_icd_surfaces != NULL && (void *)icd_surface->real_icd_surfaces[icd_index] != NULL) { |
| 2220 | VkPhysicalDeviceSurfaceInfo2KHR info_copy = *pSurfaceInfo; |
| 2221 | info_copy.surface = icd_surface->real_icd_surfaces[icd_index]; |
| 2222 | return icd_term->dispatch.GetPhysicalDeviceSurfaceFormats2KHR(phys_dev_term->phys_dev, &info_copy, pSurfaceFormatCount, |
| 2223 | pSurfaceFormats); |
| 2224 | } else { |
| 2225 | return icd_term->dispatch.GetPhysicalDeviceSurfaceFormats2KHR(phys_dev_term->phys_dev, pSurfaceInfo, |
| 2226 | pSurfaceFormatCount, pSurfaceFormats); |
| 2227 | } |
| 2228 | } else { |
| 2229 | // Emulate the call |
| 2230 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, |
| 2231 | "vkGetPhysicalDeviceSurfaceFormats2KHR: Emulating call in ICD \"%s\" using vkGetPhysicalDeviceSurfaceFormatsKHR", |
| 2232 | icd_term->scanned_icd->lib_name); |
| 2233 | |
| 2234 | if (pSurfaceInfo->pNext != NULL) { |
| 2235 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, |
| 2236 | "vkGetPhysicalDeviceSurfaceFormats2KHR: Emulation found unrecognized structure type in pSurfaceInfo->pNext " |
| 2237 | "- this struct will be ignored"); |
| 2238 | } |
| 2239 | |
| 2240 | VkSurfaceKHR surface = pSurfaceInfo->surface; |
| 2241 | if (icd_surface->real_icd_surfaces != NULL && (void *)icd_surface->real_icd_surfaces[icd_index] != NULL) { |
| 2242 | surface = icd_surface->real_icd_surfaces[icd_index]; |
| 2243 | } |
| 2244 | |
| 2245 | if (*pSurfaceFormatCount == 0 || pSurfaceFormats == NULL) { |
| 2246 | // Write to pSurfaceFormatCount |
| 2247 | return icd_term->dispatch.GetPhysicalDeviceSurfaceFormatsKHR(phys_dev_term->phys_dev, surface, pSurfaceFormatCount, |
| 2248 | NULL); |
| 2249 | } else { |
| 2250 | // Allocate a temporary array for the output of the old function |
| 2251 | VkSurfaceFormatKHR *formats = loader_stack_alloc(*pSurfaceFormatCount * sizeof(VkSurfaceFormatKHR)); |
| 2252 | if (formats == NULL) { |
| 2253 | return VK_ERROR_OUT_OF_HOST_MEMORY; |
| 2254 | } |
| 2255 | |
| 2256 | VkResult res = icd_term->dispatch.GetPhysicalDeviceSurfaceFormatsKHR(phys_dev_term->phys_dev, surface, |
| 2257 | pSurfaceFormatCount, formats); |
| 2258 | for (uint32_t i = 0; i < *pSurfaceFormatCount; ++i) { |
| 2259 | pSurfaceFormats[i].surfaceFormat = formats[i]; |
| 2260 | if (pSurfaceFormats[i].pNext != NULL) { |
| 2261 | loader_log(icd_term->this_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, |
| 2262 | "vkGetPhysicalDeviceSurfaceFormats2KHR: Emulation found unrecognized structure type in " |
| 2263 | "pSurfaceFormats[%d].pNext - this struct will be ignored", |
| 2264 | i); |
| 2265 | } |
| 2266 | } |
| 2267 | return res; |
| 2268 | } |
| 2269 | } |
| 2270 | } |
| 2271 | |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2272 | bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr) { |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 2273 | *addr = NULL; |
| 2274 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 2275 | // Functions for the VK_KHR_surface extension: |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 2276 | if (!strcmp("vkDestroySurfaceKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2277 | *addr = ptr_instance->wsi_surface_enabled ? (void *)vkDestroySurfaceKHR : NULL; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 2278 | return true; |
| 2279 | } |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 2280 | if (!strcmp("vkGetPhysicalDeviceSurfaceSupportKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2281 | *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDeviceSurfaceSupportKHR : NULL; |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 2282 | return true; |
| 2283 | } |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 2284 | if (!strcmp("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2285 | *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDeviceSurfaceCapabilitiesKHR : NULL; |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 2286 | return true; |
| 2287 | } |
| 2288 | if (!strcmp("vkGetPhysicalDeviceSurfaceFormatsKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2289 | *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDeviceSurfaceFormatsKHR : NULL; |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 2290 | return true; |
| 2291 | } |
| 2292 | if (!strcmp("vkGetPhysicalDeviceSurfacePresentModesKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2293 | *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDeviceSurfacePresentModesKHR : NULL; |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 2294 | return true; |
| 2295 | } |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 2296 | |
Lenny Komow | dbaaad6 | 2017-10-02 15:08:53 -0600 | [diff] [blame] | 2297 | if (!strcmp("vkGetDeviceGroupPresentCapabilitiesKHR", name)) { |
| 2298 | *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetDeviceGroupPresentCapabilitiesKHR : NULL; |
| 2299 | return true; |
| 2300 | } |
| 2301 | |
| 2302 | if (!strcmp("vkGetDeviceGroupSurfacePresentModesKHR", name)) { |
| 2303 | *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetDeviceGroupSurfacePresentModesKHR : NULL; |
| 2304 | return true; |
| 2305 | } |
| 2306 | |
| 2307 | if (!strcmp("vkGetPhysicalDevicePresentRectanglesKHR", name)) { |
| 2308 | *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDevicePresentRectanglesKHR : NULL; |
| 2309 | return true; |
| 2310 | } |
| 2311 | |
Joshua Ashton | 03cc64b | 2020-03-12 04:42:26 +0000 | [diff] [blame] | 2312 | // Functions for VK_KHR_get_surface_capabilities2 extension: |
| 2313 | if (!strcmp("vkGetPhysicalDeviceSurfaceCapabilities2KHR", name)) { |
| 2314 | *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDeviceSurfaceCapabilities2KHR : NULL; |
| 2315 | return true; |
| 2316 | } |
| 2317 | |
| 2318 | if (!strcmp("vkGetPhysicalDeviceSurfaceFormats2KHR", name)) { |
| 2319 | *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDeviceSurfaceFormats2KHR : NULL; |
| 2320 | return true; |
| 2321 | } |
| 2322 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 2323 | // Functions for the VK_KHR_swapchain extension: |
| 2324 | |
| 2325 | // Note: This is a device extension, and its functions are statically |
| 2326 | // exported from the loader. Per Khronos decisions, the loader's GIPA |
| 2327 | // function will return the trampoline function for such device-extension |
| 2328 | // functions, regardless of whether the extension has been enabled. |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 2329 | if (!strcmp("vkCreateSwapchainKHR", name)) { |
Lenny Komow | f1872d8 | 2018-02-23 11:28:38 -0700 | [diff] [blame] | 2330 | *addr = (void *)vkCreateSwapchainKHR; |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 2331 | return true; |
| 2332 | } |
| 2333 | if (!strcmp("vkDestroySwapchainKHR", name)) { |
Lenny Komow | f1872d8 | 2018-02-23 11:28:38 -0700 | [diff] [blame] | 2334 | *addr = (void *)vkDestroySwapchainKHR; |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 2335 | return true; |
| 2336 | } |
| 2337 | if (!strcmp("vkGetSwapchainImagesKHR", name)) { |
Lenny Komow | f1872d8 | 2018-02-23 11:28:38 -0700 | [diff] [blame] | 2338 | *addr = (void *)vkGetSwapchainImagesKHR; |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 2339 | return true; |
| 2340 | } |
| 2341 | if (!strcmp("vkAcquireNextImageKHR", name)) { |
Lenny Komow | f1872d8 | 2018-02-23 11:28:38 -0700 | [diff] [blame] | 2342 | *addr = (void *)vkAcquireNextImageKHR; |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 2343 | return true; |
| 2344 | } |
| 2345 | if (!strcmp("vkQueuePresentKHR", name)) { |
Lenny Komow | f1872d8 | 2018-02-23 11:28:38 -0700 | [diff] [blame] | 2346 | *addr = (void *)vkQueuePresentKHR; |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 2347 | return true; |
| 2348 | } |
Lenny Komow | dbaaad6 | 2017-10-02 15:08:53 -0600 | [diff] [blame] | 2349 | if (!strcmp("vkAcquireNextImage2KHR", name)) { |
Lenny Komow | f1872d8 | 2018-02-23 11:28:38 -0700 | [diff] [blame] | 2350 | *addr = (void *)vkAcquireNextImage2KHR; |
Lenny Komow | dbaaad6 | 2017-10-02 15:08:53 -0600 | [diff] [blame] | 2351 | return true; |
| 2352 | } |
Ian Elliott | 9b89a47 | 2015-11-19 16:39:21 -0700 | [diff] [blame] | 2353 | |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 2354 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 2355 | |
| 2356 | // Functions for the VK_KHR_win32_surface extension: |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 2357 | if (!strcmp("vkCreateWin32SurfaceKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2358 | *addr = ptr_instance->wsi_win32_surface_enabled ? (void *)vkCreateWin32SurfaceKHR : NULL; |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 2359 | return true; |
| 2360 | } |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 2361 | if (!strcmp("vkGetPhysicalDeviceWin32PresentationSupportKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2362 | *addr = ptr_instance->wsi_win32_surface_enabled ? (void *)vkGetPhysicalDeviceWin32PresentationSupportKHR : NULL; |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 2363 | return true; |
| 2364 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2365 | #endif // VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 2366 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 2367 | |
| 2368 | // Functions for the VK_KHR_wayland_surface extension: |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2369 | if (!strcmp("vkCreateWaylandSurfaceKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2370 | *addr = ptr_instance->wsi_wayland_surface_enabled ? (void *)vkCreateWaylandSurfaceKHR : NULL; |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2371 | return true; |
| 2372 | } |
| 2373 | if (!strcmp("vkGetPhysicalDeviceWaylandPresentationSupportKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2374 | *addr = ptr_instance->wsi_wayland_surface_enabled ? (void *)vkGetPhysicalDeviceWaylandPresentationSupportKHR : NULL; |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2375 | return true; |
| 2376 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2377 | #endif // VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 2378 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 2379 | |
| 2380 | // Functions for the VK_KHR_xcb_surface extension: |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2381 | if (!strcmp("vkCreateXcbSurfaceKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2382 | *addr = ptr_instance->wsi_xcb_surface_enabled ? (void *)vkCreateXcbSurfaceKHR : NULL; |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2383 | return true; |
| 2384 | } |
| 2385 | if (!strcmp("vkGetPhysicalDeviceXcbPresentationSupportKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2386 | *addr = ptr_instance->wsi_xcb_surface_enabled ? (void *)vkGetPhysicalDeviceXcbPresentationSupportKHR : NULL; |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2387 | return true; |
| 2388 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2389 | #endif // VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 2390 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 2391 | |
| 2392 | // Functions for the VK_KHR_xlib_surface extension: |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2393 | if (!strcmp("vkCreateXlibSurfaceKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2394 | *addr = ptr_instance->wsi_xlib_surface_enabled ? (void *)vkCreateXlibSurfaceKHR : NULL; |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2395 | return true; |
| 2396 | } |
| 2397 | if (!strcmp("vkGetPhysicalDeviceXlibPresentationSupportKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2398 | *addr = ptr_instance->wsi_xlib_surface_enabled ? (void *)vkGetPhysicalDeviceXlibPresentationSupportKHR : NULL; |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2399 | return true; |
| 2400 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2401 | #endif // VK_USE_PLATFORM_XLIB_KHR |
Nicolas Caramelli | fa696ca | 2020-07-04 22:53:59 +0200 | [diff] [blame] | 2402 | #ifdef VK_USE_PLATFORM_DIRECTFB_EXT |
| 2403 | |
| 2404 | // Functions for the VK_EXT_directfb_surface extension: |
| 2405 | if (!strcmp("vkCreateDirectFBSurfaceEXT", name)) { |
| 2406 | *addr = ptr_instance->wsi_directfb_surface_enabled ? (void *)vkCreateDirectFBSurfaceEXT : NULL; |
| 2407 | return true; |
| 2408 | } |
| 2409 | if (!strcmp("vkGetPhysicalDeviceDirectFBPresentationSupportEXT", name)) { |
| 2410 | *addr = ptr_instance->wsi_directfb_surface_enabled ? (void *)vkGetPhysicalDeviceDirectFBPresentationSupportEXT : NULL; |
| 2411 | return true; |
| 2412 | } |
| 2413 | #endif // VK_USE_PLATFORM_DIRECTFB_EXT |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 2414 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 2415 | |
| 2416 | // Functions for the VK_KHR_android_surface extension: |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2417 | if (!strcmp("vkCreateAndroidSurfaceKHR", name)) { |
Karl Schultz | d81ebfb | 2017-12-12 10:33:01 -0500 | [diff] [blame] | 2418 | *addr = ptr_instance->wsi_android_surface_enabled ? (void *)vkCreateAndroidSurfaceKHR : NULL; |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2419 | return true; |
| 2420 | } |
Mark Lobodzinski | e2859eb | 2017-01-26 13:34:13 -0700 | [diff] [blame] | 2421 | #endif // VK_USE_PLATFORM_ANDROID_KHR |
Bryan Law-Smith | 5730569 | 2019-04-01 09:45:55 +0100 | [diff] [blame] | 2422 | |
Karl Schultz | d81ebfb | 2017-12-12 10:33:01 -0500 | [diff] [blame] | 2423 | #ifdef VK_USE_PLATFORM_MACOS_MVK |
| 2424 | |
| 2425 | // Functions for the VK_MVK_macos_surface extension: |
| 2426 | if (!strcmp("vkCreateMacOSSurfaceMVK", name)) { |
| 2427 | *addr = ptr_instance->wsi_macos_surface_enabled ? (void *)vkCreateMacOSSurfaceMVK : NULL; |
| 2428 | return true; |
| 2429 | } |
| 2430 | #endif // VK_USE_PLATFORM_MACOS_MVK |
| 2431 | #ifdef VK_USE_PLATFORM_IOS_MVK |
| 2432 | |
| 2433 | // Functions for the VK_MVK_ios_surface extension: |
| 2434 | if (!strcmp("vkCreateIOSSurfaceMVK", name)) { |
| 2435 | *addr = ptr_instance->wsi_ios_surface_enabled ? (void *)vkCreateIOSSurfaceMVK : NULL; |
| 2436 | return true; |
| 2437 | } |
| 2438 | #endif // VK_USE_PLATFORM_IOS_MVK |
J.D. Rouan | d7928a1 | 2020-11-16 15:36:42 -0800 | [diff] [blame^] | 2439 | #ifdef VK_USE_PLATFORM_GGP |
| 2440 | |
| 2441 | // Functions for the VK_GGP_stream_descriptor_surface extension: |
| 2442 | if (!strcmp("vkCreateStreamDescriptorSurfaceGGP", name)) { |
| 2443 | *addr = ptr_instance->wsi_ggp_surface_enabled ? (void *)vkCreateStreamDescriptorSurfaceGGP : NULL; |
| 2444 | return true; |
| 2445 | } |
| 2446 | #endif // VK_USE_PLATFORM_GGP |
Craig Stout | f3b74dc | 2020-10-26 12:05:15 -0700 | [diff] [blame] | 2447 | #ifdef VK_USE_PLATFORM_FUCHSIA |
| 2448 | |
| 2449 | // Functions for the VK_FUCHSIA_imagepipe_surface extension: |
| 2450 | if (!strcmp("vkCreateImagePipeSurfaceFUCHSIA", name)) { |
| 2451 | *addr = ptr_instance->wsi_imagepipe_surface_enabled ? (void *)vkCreateImagePipeSurfaceFUCHSIA : NULL; |
| 2452 | return true; |
| 2453 | } |
| 2454 | |
| 2455 | #endif // VK_USE_PLATFORM_FUCHSIA |
Ian Elliott | 7c35255 | 2015-11-19 13:14:05 -0700 | [diff] [blame] | 2456 | |
Bryan Law-Smith | 5730569 | 2019-04-01 09:45:55 +0100 | [diff] [blame] | 2457 | // Functions for the VK_EXT_headless_surface extension: |
| 2458 | if (!strcmp("vkCreateHeadlessSurfaceEXT", name)) { |
| 2459 | *addr = ptr_instance->wsi_headless_surface_enabled ? (void *)vkCreateHeadlessSurfaceEXT : NULL; |
| 2460 | return true; |
| 2461 | } |
| 2462 | |
Lenny Komow | a1b5e44 | 2019-09-16 16:14:36 -0600 | [diff] [blame] | 2463 | #if defined(VK_USE_PLATFORM_METAL_EXT) |
| 2464 | // Functions for the VK_MVK_macos_surface extension: |
| 2465 | if (!strcmp("vkCreateMetalSurfaceEXT", name)) { |
| 2466 | *addr = ptr_instance->wsi_metal_surface_enabled ? (void *)vkCreateMetalSurfaceEXT : NULL; |
| 2467 | return true; |
| 2468 | } |
| 2469 | #endif // VK_USE_PLATFORM_METAL_EXT |
| 2470 | |
Mark Lobodzinski | b16da05 | 2016-08-31 09:31:29 -0600 | [diff] [blame] | 2471 | // Functions for VK_KHR_display extension: |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 2472 | if (!strcmp("vkGetPhysicalDeviceDisplayPropertiesKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2473 | *addr = ptr_instance->wsi_display_enabled ? (void *)vkGetPhysicalDeviceDisplayPropertiesKHR : NULL; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 2474 | return true; |
| 2475 | } |
| 2476 | if (!strcmp("vkGetPhysicalDeviceDisplayPlanePropertiesKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2477 | *addr = ptr_instance->wsi_display_enabled ? (void *)vkGetPhysicalDeviceDisplayPlanePropertiesKHR : NULL; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 2478 | return true; |
| 2479 | } |
| 2480 | if (!strcmp("vkGetDisplayPlaneSupportedDisplaysKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2481 | *addr = ptr_instance->wsi_display_enabled ? (void *)vkGetDisplayPlaneSupportedDisplaysKHR : NULL; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 2482 | return true; |
| 2483 | } |
| 2484 | if (!strcmp("vkGetDisplayModePropertiesKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2485 | *addr = ptr_instance->wsi_display_enabled ? (void *)vkGetDisplayModePropertiesKHR : NULL; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 2486 | return true; |
| 2487 | } |
| 2488 | if (!strcmp("vkCreateDisplayModeKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2489 | *addr = ptr_instance->wsi_display_enabled ? (void *)vkCreateDisplayModeKHR : NULL; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 2490 | return true; |
| 2491 | } |
| 2492 | if (!strcmp("vkGetDisplayPlaneCapabilitiesKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2493 | *addr = ptr_instance->wsi_display_enabled ? (void *)vkGetDisplayPlaneCapabilitiesKHR : NULL; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 2494 | return true; |
| 2495 | } |
| 2496 | if (!strcmp("vkCreateDisplayPlaneSurfaceKHR", name)) { |
Mark Lobodzinski | 91c1075 | 2017-01-26 12:16:30 -0700 | [diff] [blame] | 2497 | *addr = ptr_instance->wsi_display_enabled ? (void *)vkCreateDisplayPlaneSurfaceKHR : NULL; |
Jon Ashburn | cc370d0 | 2016-03-08 09:30:30 -0700 | [diff] [blame] | 2498 | return true; |
| 2499 | } |
Mark Young | f2eabea | 2016-07-01 15:18:27 -0600 | [diff] [blame] | 2500 | |
| 2501 | // Functions for KHR_display_swapchain extension: |
| 2502 | if (!strcmp("vkCreateSharedSwapchainsKHR", name)) { |
Lenny Komow | f1872d8 | 2018-02-23 11:28:38 -0700 | [diff] [blame] | 2503 | *addr = (void *)vkCreateSharedSwapchainsKHR; |
Mark Young | f2eabea | 2016-07-01 15:18:27 -0600 | [diff] [blame] | 2504 | return true; |
| 2505 | } |
| 2506 | |
Lenny Komow | 6113978 | 2018-05-31 11:32:31 -0600 | [diff] [blame] | 2507 | // Functions for KHR_get_display_properties2 |
| 2508 | if (!strcmp("vkGetPhysicalDeviceDisplayProperties2KHR", name)) { |
| 2509 | *addr = ptr_instance->wsi_display_props2_enabled ? (void *)vkGetPhysicalDeviceDisplayProperties2KHR : NULL; |
| 2510 | return true; |
| 2511 | } |
| 2512 | if (!strcmp("vkGetPhysicalDeviceDisplayPlaneProperties2KHR", name)) { |
| 2513 | *addr = ptr_instance->wsi_display_props2_enabled ? (void *)vkGetPhysicalDeviceDisplayPlaneProperties2KHR : NULL; |
| 2514 | return true; |
| 2515 | } |
| 2516 | if (!strcmp("vkGetDisplayModeProperties2KHR", name)) { |
| 2517 | *addr = ptr_instance->wsi_display_props2_enabled ? (void *)vkGetDisplayModeProperties2KHR : NULL; |
| 2518 | return true; |
| 2519 | } |
| 2520 | if (!strcmp("vkGetDisplayPlaneCapabilities2KHR", name)) { |
| 2521 | *addr = ptr_instance->wsi_display_props2_enabled ? (void *)vkGetDisplayPlaneCapabilities2KHR : NULL; |
| 2522 | return true; |
| 2523 | } |
| 2524 | |
Jon Ashburn | c4e9ae6 | 2016-02-26 13:14:27 -0700 | [diff] [blame] | 2525 | return false; |
Ian Elliott | 0d4ffa3 | 2016-03-24 13:59:22 -0600 | [diff] [blame] | 2526 | } |