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