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