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