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