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