Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 1 | /* |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 2 | * |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 3 | * Copyright (c) 2014-2016 The Khronos Group Inc. |
| 4 | * Copyright (c) 2014-2016 Valve Corporation |
| 5 | * Copyright (c) 2014-2016 LunarG, Inc. |
Courtney Goeltzenleuchter | 8e1b8d9 | 2015-12-02 14:53:22 -0700 | [diff] [blame] | 6 | * Copyright (C) 2015 Google Inc. |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 7 | * |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | * of this software and/or associated documentation files (the "Materials"), to |
| 10 | * deal in the Materials without restriction, including without limitation the |
| 11 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 12 | * sell copies of the Materials, and to permit persons to whom the Materials are |
| 13 | * furnished to do so, subject to the following conditions: |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 14 | * |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 15 | * The above copyright notice(s) and this permission notice shall be included in |
| 16 | * all copies or substantial portions of the Materials. |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 17 | * |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 18 | * The Materials are Confidential Information as defined by the Khronos |
| 19 | * Membership Agreement until designated non-confidential by Khronos, at which |
| 20 | * point this condition clause shall be removed. |
| 21 | * |
| 22 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
Chia-I Wu | d8ab1e6 | 2014-09-02 08:32:09 +0800 | [diff] [blame] | 25 | * |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 26 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 27 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 28 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE |
| 29 | * USE OR OTHER DEALINGS IN THE MATERIALS. |
| 30 | * |
| 31 | * Author: Jon Ashburn <jon@lunarg.com> |
| 32 | * Author: Courtney Goeltzenleuchter <courtney@LunarG.com> |
Courtney Goeltzenleuchter | b9ce395 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 33 | * Author: Chia-I Wu <olvaffe@gmail.com> |
| 34 | * Author: Chia-I Wu <olv@lunarg.com> |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 35 | * Author: Mark Lobodzinski <mark@LunarG.com> |
Courtney Goeltzenleuchter | b9ce395 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 36 | * |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 37 | */ |
| 38 | |
| 39 | #ifndef LOADER_H |
| 40 | #define LOADER_H |
| 41 | |
David Pinedo | a503662 | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 42 | #include <vulkan/vulkan.h> |
Jon Ashburn | 3708e79 | 2015-11-06 11:02:40 -0700 | [diff] [blame] | 43 | #include <vk_loader_platform.h> |
Ian Elliott | afaf185 | 2015-11-17 17:29:40 -0700 | [diff] [blame] | 44 | |
Courtney Goeltzenleuchter | 725db94 | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 45 | #include <vulkan/vk_ext_debug_report.h> |
Ian Elliott | a77fed7 | 2015-11-18 14:57:08 -0700 | [diff] [blame] | 46 | |
David Pinedo | a503662 | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 47 | #include <vulkan/vk_layer.h> |
| 48 | #include <vulkan/vk_icd.h> |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 49 | #include <assert.h> |
| 50 | |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 51 | #if defined(__GNUC__) && __GNUC__ >= 4 |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 52 | #define LOADER_EXPORT __attribute__((visibility("default"))) |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 53 | #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 54 | #define LOADER_EXPORT __attribute__((visibility("default"))) |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 55 | #else |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 56 | #define LOADER_EXPORT |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 57 | #endif |
| 58 | |
Jon Ashburn | b2379c5 | 2015-08-04 10:22:33 -0600 | [diff] [blame] | 59 | #define MAX_STRING_SIZE 1024 |
Courtney Goeltzenleuchter | 44667cc | 2015-06-29 15:39:26 -0600 | [diff] [blame] | 60 | #define VK_MAJOR(version) (version >> 22) |
| 61 | #define VK_MINOR(version) ((version >> 12) & 0x3ff) |
| 62 | #define VK_PATCH(version) (version & 0xfff) |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 63 | |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 64 | enum layer_type { |
Jon Ashburn | 9464e77 | 2015-07-02 16:10:32 -0600 | [diff] [blame] | 65 | VK_LAYER_TYPE_DEVICE_EXPLICIT = 0x1, |
| 66 | VK_LAYER_TYPE_INSTANCE_EXPLICIT = 0x2, |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 67 | VK_LAYER_TYPE_GLOBAL_EXPLICIT = |
| 68 | 0x3, // both instance and device layer, bitwise |
Jon Ashburn | 9464e77 | 2015-07-02 16:10:32 -0600 | [diff] [blame] | 69 | VK_LAYER_TYPE_DEVICE_IMPLICIT = 0x4, |
| 70 | VK_LAYER_TYPE_INSTANCE_IMPLICIT = 0x8, |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 71 | VK_LAYER_TYPE_GLOBAL_IMPLICIT = |
| 72 | 0xc, // both instance and device layer, bitwise |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 73 | }; |
| 74 | |
Jon Ashburn | 6b00b47 | 2015-12-10 08:51:10 -0700 | [diff] [blame] | 75 | // form of all dynamic lists/arrays |
| 76 | // only the list element should be changed |
| 77 | struct loader_generic_list { |
| 78 | size_t capacity; |
| 79 | uint32_t count; |
| 80 | void *list; |
| 81 | }; |
| 82 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 83 | struct loader_extension_list { |
| 84 | size_t capacity; |
| 85 | uint32_t count; |
Jon Ashburn | b7d327c | 2015-08-04 11:14:18 -0600 | [diff] [blame] | 86 | VkExtensionProperties *list; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 87 | }; |
| 88 | |
Jon Ashburn | 92cdb01 | 2015-12-10 18:17:34 -0700 | [diff] [blame] | 89 | struct loader_dev_ext_props { |
| 90 | VkExtensionProperties props; |
| 91 | uint32_t entrypoint_count; |
| 92 | char **entrypoints; |
| 93 | }; |
| 94 | |
| 95 | struct loader_device_extension_list { |
| 96 | size_t capacity; |
| 97 | uint32_t count; |
| 98 | struct loader_dev_ext_props *list; |
| 99 | }; |
| 100 | |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 101 | struct loader_name_value { |
Jon Ashburn | b2379c5 | 2015-08-04 10:22:33 -0600 | [diff] [blame] | 102 | char name[MAX_STRING_SIZE]; |
| 103 | char value[MAX_STRING_SIZE]; |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | struct loader_lib_info { |
Jon Ashburn | b4c2423 | 2015-08-20 16:35:30 -0600 | [diff] [blame] | 107 | char lib_name[MAX_STRING_SIZE]; |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 108 | uint32_t ref_count; |
| 109 | loader_platform_dl_handle lib_handle; |
| 110 | }; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 111 | |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 112 | struct loader_layer_functions { |
Jon Ashburn | b2379c5 | 2015-08-04 10:22:33 -0600 | [diff] [blame] | 113 | char str_gipa[MAX_STRING_SIZE]; |
| 114 | char str_gdpa[MAX_STRING_SIZE]; |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 115 | PFN_vkGetInstanceProcAddr get_instance_proc_addr; |
| 116 | PFN_vkGetDeviceProcAddr get_device_proc_addr; |
| 117 | }; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 118 | |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 119 | struct loader_layer_properties { |
Courtney Goeltzenleuchter | 44667cc | 2015-06-29 15:39:26 -0600 | [diff] [blame] | 120 | VkLayerProperties info; |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 121 | enum layer_type type; |
Jon Ashburn | b4c2423 | 2015-08-20 16:35:30 -0600 | [diff] [blame] | 122 | char lib_name[MAX_STRING_SIZE]; |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 123 | struct loader_layer_functions functions; |
| 124 | struct loader_extension_list instance_extension_list; |
Jon Ashburn | 92cdb01 | 2015-12-10 18:17:34 -0700 | [diff] [blame] | 125 | struct loader_device_extension_list device_extension_list; |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 126 | struct loader_name_value disable_env_var; |
| 127 | struct loader_name_value enable_env_var; |
| 128 | }; |
| 129 | |
| 130 | struct loader_layer_list { |
| 131 | size_t capacity; |
| 132 | uint32_t count; |
| 133 | struct loader_layer_properties *list; |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 134 | }; |
| 135 | |
Courtney Goeltzenleuchter | 8aff386 | 2015-07-05 12:53:31 -0600 | [diff] [blame] | 136 | struct loader_layer_library_list { |
| 137 | size_t capacity; |
| 138 | uint32_t count; |
| 139 | struct loader_lib_info *list; |
| 140 | }; |
| 141 | |
Jon Ashburn | 6cb69f4 | 2015-11-17 15:31:02 -0700 | [diff] [blame] | 142 | struct loader_dispatch_hash_list { |
| 143 | size_t capacity; |
| 144 | uint32_t count; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 145 | uint32_t *index; // index into the dev_ext dispatch table |
Jon Ashburn | 6cb69f4 | 2015-11-17 15:31:02 -0700 | [diff] [blame] | 146 | }; |
| 147 | |
| 148 | #define MAX_NUM_DEV_EXTS 250 |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 149 | // loader_dispatch_hash_entry and loader_dev_ext_dispatch_table.DevExt have one |
| 150 | // to one |
Jon Ashburn | 6cb69f4 | 2015-11-17 15:31:02 -0700 | [diff] [blame] | 151 | // correspondence; one loader_dispatch_hash_entry for one DevExt dispatch entry. |
| 152 | // Also have a one to one correspondence with functions in dev_ext_trampoline.c |
| 153 | struct loader_dispatch_hash_entry { |
| 154 | char *func_name; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 155 | struct loader_dispatch_hash_list list; // to handle hashing collisions |
Jon Ashburn | 6cb69f4 | 2015-11-17 15:31:02 -0700 | [diff] [blame] | 156 | }; |
| 157 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 158 | typedef void(VKAPI_PTR *PFN_vkDevExt)(VkDevice device); |
Jon Ashburn | 6cb69f4 | 2015-11-17 15:31:02 -0700 | [diff] [blame] | 159 | struct loader_dev_ext_dispatch_table { |
| 160 | PFN_vkDevExt DevExt[MAX_NUM_DEV_EXTS]; |
| 161 | }; |
| 162 | |
| 163 | struct loader_dev_dispatch_table { |
| 164 | VkLayerDispatchTable core_dispatch; |
| 165 | struct loader_dev_ext_dispatch_table ext_dispatch; |
| 166 | }; |
| 167 | |
Jon Ashburn | 10f4e82 | 2015-06-10 10:06:06 -0600 | [diff] [blame] | 168 | /* per CreateDevice structure */ |
| 169 | struct loader_device { |
Jon Ashburn | 6cb69f4 | 2015-11-17 15:31:02 -0700 | [diff] [blame] | 170 | struct loader_dev_dispatch_table loader_dispatch; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 171 | VkDevice device; // device object from the icd |
Jon Ashburn | 10f4e82 | 2015-06-10 10:06:06 -0600 | [diff] [blame] | 172 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 173 | uint32_t app_extension_count; |
Jon Ashburn | 10f4e82 | 2015-06-10 10:06:06 -0600 | [diff] [blame] | 174 | VkExtensionProperties *app_extension_props; |
| 175 | |
Courtney Goeltzenleuchter | 44667cc | 2015-06-29 15:39:26 -0600 | [diff] [blame] | 176 | struct loader_layer_list activated_layer_list; |
Jon Ashburn | 10f4e82 | 2015-06-10 10:06:06 -0600 | [diff] [blame] | 177 | |
| 178 | struct loader_device *next; |
| 179 | }; |
| 180 | |
Jon Ashburn | 392c562 | 2015-06-10 16:11:42 -0600 | [diff] [blame] | 181 | /* per ICD structure */ |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 182 | struct loader_icd { |
Jon Ashburn | b4c2423 | 2015-08-20 16:35:30 -0600 | [diff] [blame] | 183 | // pointers to find other structs |
| 184 | const struct loader_scanned_icds *this_icd_lib; |
| 185 | const struct loader_instance *this_instance; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 186 | |
Jon Ashburn | 10f4e82 | 2015-06-10 10:06:06 -0600 | [diff] [blame] | 187 | struct loader_device *logical_device_list; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 188 | VkInstance instance; // instance object from the icd |
Jon Ashburn | c89dd4a | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 189 | PFN_vkGetDeviceProcAddr GetDeviceProcAddr; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 190 | PFN_vkDestroyInstance DestroyInstance; |
| 191 | PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; |
Chris Forbes | 1c946ec | 2015-06-21 22:55:02 +1200 | [diff] [blame] | 192 | PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures; |
Courtney Goeltzenleuchter | 2b6559e | 2015-07-12 12:52:09 -0600 | [diff] [blame] | 193 | PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 194 | PFN_vkGetPhysicalDeviceImageFormatProperties |
| 195 | GetPhysicalDeviceImageFormatProperties; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 196 | PFN_vkCreateDevice CreateDevice; |
Tony Barbour | 4e657ba | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 197 | PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 198 | PFN_vkGetPhysicalDeviceQueueFamilyProperties |
| 199 | GetPhysicalDeviceQueueFamilyProperties; |
Tony Barbour | 4e657ba | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 200 | PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties; |
Courtney Goeltzenleuchter | e25064c | 2015-09-14 17:22:16 -0600 | [diff] [blame] | 201 | PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 202 | PFN_vkGetPhysicalDeviceSparseImageFormatProperties |
| 203 | GetPhysicalDeviceSparseImageFormatProperties; |
Courtney Goeltzenleuchter | 725db94 | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 204 | PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT; |
| 205 | PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT; |
| 206 | PFN_vkDebugReportMessageEXT DebugReportMessageEXT; |
Ian Elliott | ec73634 | 2015-08-21 15:09:33 -0600 | [diff] [blame] | 207 | PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 208 | PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR |
| 209 | GetPhysicalDeviceSurfaceCapabilitiesKHR; |
Ian Elliott | ea666b2 | 2015-11-19 16:05:09 -0700 | [diff] [blame] | 210 | PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 211 | PFN_vkGetPhysicalDeviceSurfacePresentModesKHR |
| 212 | GetPhysicalDeviceSurfacePresentModesKHR; |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 213 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 214 | PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR |
| 215 | GetPhysicalDeviceWin32PresentationSupportKHR; |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 216 | #endif |
| 217 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 218 | PFN_vkGetPhysicalDeviceMirPresentationSupportKHR |
| 219 | GetPhysicalDeviceMirPresentvationSupportKHR; |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 220 | #endif |
| 221 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 222 | PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR |
| 223 | GetPhysicalDeviceWaylandPresentationSupportKHR; |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 224 | #endif |
| 225 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 226 | PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR |
| 227 | GetPhysicalDeviceXcbPresentationSupportKHR; |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 228 | #endif |
| 229 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 230 | PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR |
| 231 | GetPhysicalDeviceXlibPresentationSupportKHR; |
Ian Elliott | e851dd6 | 2015-11-24 15:39:10 -0700 | [diff] [blame] | 232 | #endif |
Courtney Goeltzenleuchter | 44667cc | 2015-06-29 15:39:26 -0600 | [diff] [blame] | 233 | |
Jon Ashburn | 10f4e82 | 2015-06-10 10:06:06 -0600 | [diff] [blame] | 234 | struct loader_icd *next; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 235 | }; |
| 236 | |
Jon Ashburn | e036747 | 2015-08-18 18:04:47 -0600 | [diff] [blame] | 237 | /* per ICD library structure */ |
| 238 | struct loader_icd_libs { |
| 239 | size_t capacity; |
| 240 | uint32_t count; |
| 241 | struct loader_scanned_icds *list; |
| 242 | }; |
| 243 | |
Jon Ashburn | 392c562 | 2015-06-10 16:11:42 -0600 | [diff] [blame] | 244 | /* per instance structure */ |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 245 | struct loader_instance { |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 246 | VkLayerInstanceDispatchTable *disp; // must be first entry in structure |
| 247 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 248 | uint32_t total_gpu_count; |
Jon Ashburn | 969caa4 | 2015-11-01 14:04:06 -0700 | [diff] [blame] | 249 | struct loader_physical_device *phys_devs; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 250 | uint32_t total_icd_count; |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 251 | struct loader_icd *icds; |
| 252 | struct loader_instance *next; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 253 | struct loader_extension_list ext_list; // icds and loaders extensions |
Jon Ashburn | e036747 | 2015-08-18 18:04:47 -0600 | [diff] [blame] | 254 | struct loader_icd_libs icd_libs; |
Jon Ashburn | b4c2423 | 2015-08-20 16:35:30 -0600 | [diff] [blame] | 255 | struct loader_layer_list instance_layer_list; |
| 256 | struct loader_layer_list device_layer_list; |
Jon Ashburn | 6cb69f4 | 2015-11-17 15:31:02 -0700 | [diff] [blame] | 257 | struct loader_dispatch_hash_entry disp_hash[MAX_NUM_DEV_EXTS]; |
Jon Ashburn | b4c2423 | 2015-08-20 16:35:30 -0600 | [diff] [blame] | 258 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 259 | struct loader_msg_callback_map_entry *icd_msg_callback_map; |
| 260 | |
Courtney Goeltzenleuchter | 44667cc | 2015-06-29 15:39:26 -0600 | [diff] [blame] | 261 | struct loader_layer_list activated_layer_list; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 262 | |
Courtney Goeltzenleuchter | 0bd705c | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 263 | VkInstance instance; |
| 264 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 265 | bool debug_report_enabled; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 266 | VkLayerDbgFunctionNode *DbgFunctionHead; |
Courtney Goeltzenleuchter | 71b454b | 2015-07-05 11:28:29 -0600 | [diff] [blame] | 267 | |
Chia-I Wu | 227c8b3 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 268 | VkAllocationCallbacks alloc_callbacks; |
Ian Elliott | ed33eb7 | 2015-07-06 14:36:13 -0600 | [diff] [blame] | 269 | |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 270 | bool wsi_surface_enabled; |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 271 | #ifdef VK_USE_PLATFORM_WIN32_KHR |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 272 | bool wsi_win32_surface_enabled; |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 273 | #endif |
| 274 | #ifdef VK_USE_PLATFORM_MIR_KHR |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 275 | bool wsi_mir_surface_enabled; |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 276 | #endif |
| 277 | #ifdef VK_USE_PLATFORM_WAYLAND_KHR |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 278 | bool wsi_wayland_surface_enabled; |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 279 | #endif |
| 280 | #ifdef VK_USE_PLATFORM_XCB_KHR |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 281 | bool wsi_xcb_surface_enabled; |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 282 | #endif |
| 283 | #ifdef VK_USE_PLATFORM_XLIB_KHR |
Ian Elliott | 54cea23 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 284 | bool wsi_xlib_surface_enabled; |
Mark Lobodzinski | 1ad14b4 | 2015-12-10 16:25:21 -0700 | [diff] [blame] | 285 | #endif |
| 286 | #ifdef VK_USE_PLATFORM_ANDROID_KHR |
| 287 | bool wsi_android_surface_enabled; |
| 288 | #endif |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 289 | }; |
| 290 | |
Jon Ashburn | 969caa4 | 2015-11-01 14:04:06 -0700 | [diff] [blame] | 291 | /* per enumerated PhysicalDevice structure */ |
| 292 | struct loader_physical_device { |
| 293 | VkLayerInstanceDispatchTable *disp; // must be first entry in structure |
| 294 | struct loader_instance *this_instance; |
| 295 | struct loader_icd *this_icd; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 296 | VkPhysicalDevice phys_dev; // object from ICD |
| 297 | /* |
| 298 | * Fill in the cache of available device extensions from |
| 299 | * this physical device. This cache can be used during CreateDevice |
| 300 | */ |
Jon Ashburn | 969caa4 | 2015-11-01 14:04:06 -0700 | [diff] [blame] | 301 | struct loader_extension_list device_extension_cache; |
| 302 | }; |
| 303 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 304 | struct loader_struct { |
| 305 | struct loader_instance *instances; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 306 | |
| 307 | unsigned int loaded_layer_lib_count; |
Courtney Goeltzenleuchter | 452303a | 2015-10-07 09:00:34 -0600 | [diff] [blame] | 308 | size_t loaded_layer_lib_capacity; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 309 | struct loader_lib_info *loaded_layer_lib_list; |
Jon Ashburn | e036747 | 2015-08-18 18:04:47 -0600 | [diff] [blame] | 310 | // TODO add ref counting of ICD libraries |
Jon Ashburn | 269b592 | 2015-07-06 15:40:35 -0600 | [diff] [blame] | 311 | // TODO use this struct loader_layer_library_list scanned_layer_libraries; |
Jon Ashburn | e036747 | 2015-08-18 18:04:47 -0600 | [diff] [blame] | 312 | // TODO add list of icd libraries for ref counting them for closure |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 313 | }; |
| 314 | |
| 315 | struct loader_scanned_icds { |
| 316 | char *lib_name; |
| 317 | loader_platform_dl_handle handle; |
Jon Ashburn | 27109e8 | 2015-11-17 17:35:40 -0700 | [diff] [blame] | 318 | uint32_t api_version; |
Jon Ashburn | c7ca48d | 2015-07-16 10:17:29 -0600 | [diff] [blame] | 319 | PFN_vkGetInstanceProcAddr GetInstanceProcAddr; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 320 | PFN_vkCreateInstance CreateInstance; |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 321 | PFN_vkEnumerateInstanceExtensionProperties |
| 322 | EnumerateInstanceExtensionProperties; |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 323 | }; |
| 324 | |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 325 | static inline struct loader_instance *loader_instance(VkInstance instance) { |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 326 | return (struct loader_instance *)instance; |
Jon Ashburn | 399c916 | 2015-07-02 09:40:15 -0600 | [diff] [blame] | 327 | } |
| 328 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 329 | static inline void loader_set_dispatch(void *obj, const void *data) { |
| 330 | *((const void **)obj) = data; |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 331 | } |
| 332 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 333 | static inline VkLayerDispatchTable *loader_get_dispatch(const void *obj) { |
| 334 | return *((VkLayerDispatchTable **)obj); |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 335 | } |
| 336 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 337 | static inline struct loader_dev_dispatch_table * |
| 338 | loader_get_dev_dispatch(const void *obj) { |
| 339 | return *((struct loader_dev_dispatch_table **)obj); |
Jon Ashburn | 6cb69f4 | 2015-11-17 15:31:02 -0700 | [diff] [blame] | 340 | } |
| 341 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 342 | static inline VkLayerInstanceDispatchTable * |
| 343 | loader_get_instance_dispatch(const void *obj) { |
| 344 | return *((VkLayerInstanceDispatchTable **)obj); |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 345 | } |
| 346 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 347 | static inline void loader_init_dispatch(void *obj, const void *data) { |
Jon Ashburn | 167b2b1 | 2015-04-15 13:34:33 -0600 | [diff] [blame] | 348 | #ifdef DEBUG |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 349 | assert(valid_loader_magic_value(obj) && |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 350 | "Incompatible ICD, first dword must be initialized to " |
| 351 | "ICD_LOADER_MAGIC. See loader/README.md for details."); |
Jon Ashburn | 167b2b1 | 2015-04-15 13:34:33 -0600 | [diff] [blame] | 352 | #endif |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 353 | |
Jon Ashburn | 62a54d1 | 2015-05-01 18:00:33 -0600 | [diff] [blame] | 354 | loader_set_dispatch(obj, data); |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 355 | } |
| 356 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 357 | /* global variables used across files */ |
| 358 | extern struct loader_struct loader; |
Jon Ashburn | b4dee9c | 2015-08-28 15:19:27 -0600 | [diff] [blame] | 359 | extern THREAD_LOCAL_DECL struct loader_instance *tls_instance; |
Jon Ashburn | e036747 | 2015-08-18 18:04:47 -0600 | [diff] [blame] | 360 | extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_init); |
Jon Ashburn | 7e8d8b4 | 2015-05-29 13:15:39 -0600 | [diff] [blame] | 361 | extern loader_platform_thread_mutex loader_lock; |
Jon Ashburn | 7d4d51c | 2015-09-22 13:11:00 -0600 | [diff] [blame] | 362 | extern loader_platform_thread_mutex loader_json_lock; |
Jon Ashburn | 7e8d8b4 | 2015-05-29 13:15:39 -0600 | [diff] [blame] | 363 | extern const VkLayerInstanceDispatchTable instance_disp; |
Jon Ashburn | 37e7f97 | 2015-04-06 10:58:22 -0600 | [diff] [blame] | 364 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 365 | struct loader_msg_callback_map_entry { |
Courtney Goeltzenleuchter | 725db94 | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 366 | VkDebugReportCallbackEXT icd_obj; |
| 367 | VkDebugReportCallbackEXT loader_obj; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 368 | }; |
| 369 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 370 | bool compare_vk_extension_properties(const VkExtensionProperties *op1, |
| 371 | const VkExtensionProperties *op2); |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 372 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 373 | VkResult loader_validate_layers(const uint32_t layer_count, |
| 374 | const char *const *ppEnabledLayerNames, |
| 375 | const struct loader_layer_list *list); |
Courtney Goeltzenleuchter | 76ece70 | 2015-07-06 17:45:08 -0600 | [diff] [blame] | 376 | |
| 377 | VkResult loader_validate_instance_extensions( |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 378 | const struct loader_extension_list *icd_exts, |
| 379 | const struct loader_layer_list *instance_layer, |
| 380 | const VkInstanceCreateInfo *pCreateInfo); |
Courtney Goeltzenleuchter | 76ece70 | 2015-07-06 17:45:08 -0600 | [diff] [blame] | 381 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 382 | /* instance layer chain termination entrypoint definitions */ |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 383 | VKAPI_ATTR VkResult VKAPI_CALL |
| 384 | loader_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, |
| 385 | const VkAllocationCallbacks *pAllocator, |
| 386 | VkInstance *pInstance); |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 387 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 388 | VKAPI_ATTR void VKAPI_CALL |
| 389 | loader_DestroyInstance(VkInstance instance, |
| 390 | const VkAllocationCallbacks *pAllocator); |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 391 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 392 | VKAPI_ATTR VkResult VKAPI_CALL |
| 393 | loader_EnumeratePhysicalDevices(VkInstance instance, |
| 394 | uint32_t *pPhysicalDeviceCount, |
| 395 | VkPhysicalDevice *pPhysicalDevices); |
Chris Forbes | 1c946ec | 2015-06-21 22:55:02 +1200 | [diff] [blame] | 396 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 397 | VKAPI_ATTR void VKAPI_CALL |
| 398 | loader_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, |
| 399 | VkPhysicalDeviceFeatures *pFeatures); |
Chris Forbes | 1c946ec | 2015-06-21 22:55:02 +1200 | [diff] [blame] | 400 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 401 | VKAPI_ATTR void VKAPI_CALL |
| 402 | loader_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, |
| 403 | VkFormat format, |
| 404 | VkFormatProperties *pFormatInfo); |
Chris Forbes | 1c946ec | 2015-06-21 22:55:02 +1200 | [diff] [blame] | 405 | |
Chia-I Wu | 2c56bb9 | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 406 | VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceImageFormatProperties( |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 407 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, |
| 408 | VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, |
| 409 | VkImageFormatProperties *pImageFormatProperties); |
Jon Ashburn | 25c1145 | 2015-07-23 18:49:07 -0600 | [diff] [blame] | 410 | |
Chia-I Wu | 2c56bb9 | 2015-11-06 06:42:02 +0800 | [diff] [blame] | 411 | VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceSparseImageFormatProperties( |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 412 | VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, |
| 413 | VkSampleCountFlagBits samples, VkImageUsageFlags usage, |
| 414 | VkImageTiling tiling, uint32_t *pNumProperties, |
| 415 | VkSparseImageFormatProperties *pProperties); |
Tony Barbour | 4e657ba | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 416 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 417 | VKAPI_ATTR void VKAPI_CALL |
| 418 | loader_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, |
| 419 | VkPhysicalDeviceProperties *pProperties); |
Tony Barbour | 4e657ba | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 420 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 421 | VKAPI_ATTR VkResult VKAPI_CALL |
| 422 | loader_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, |
| 423 | const char *pLayerName, |
| 424 | uint32_t *pCount, |
| 425 | VkExtensionProperties *pProperties); |
Tony Barbour | 4e657ba | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 426 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 427 | VKAPI_ATTR VkResult VKAPI_CALL |
| 428 | loader_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, |
| 429 | uint32_t *pCount, |
| 430 | VkLayerProperties *pProperties); |
Tony Barbour | 4e657ba | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 431 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 432 | VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceQueueFamilyProperties( |
| 433 | VkPhysicalDevice physicalDevice, uint32_t *pCount, |
| 434 | VkQueueFamilyProperties *pProperties); |
Tony Barbour | 4e657ba | 2015-06-24 16:06:58 -0600 | [diff] [blame] | 435 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 436 | VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceMemoryProperties( |
| 437 | VkPhysicalDevice physicalDevice, |
| 438 | VkPhysicalDeviceMemoryProperties *pProperties); |
Jon Ashburn | 7e8d8b4 | 2015-05-29 13:15:39 -0600 | [diff] [blame] | 439 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 440 | VKAPI_ATTR VkResult VKAPI_CALL |
| 441 | loader_create_device_terminator(VkPhysicalDevice physicalDevice, |
| 442 | const VkDeviceCreateInfo *pCreateInfo, |
| 443 | const VkAllocationCallbacks *pAllocator, |
| 444 | VkDevice *pDevice); |
Courtney Goeltzenleuchter | 0bd705c | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 445 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 446 | VKAPI_ATTR VkResult VKAPI_CALL |
| 447 | loader_CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo, |
| 448 | const VkAllocationCallbacks *pAllocator, VkDevice *pDevice); |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 449 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 450 | /* helper function definitions */ |
Jon Ashburn | e036747 | 2015-08-18 18:04:47 -0600 | [diff] [blame] | 451 | void loader_initialize(void); |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 452 | bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, |
| 453 | const uint32_t count, |
| 454 | const VkExtensionProperties *ext_array); |
| 455 | bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, |
| 456 | const struct loader_extension_list *ext_list); |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 457 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 458 | VkResult loader_add_to_ext_list(const struct loader_instance *inst, |
| 459 | struct loader_extension_list *ext_list, |
| 460 | uint32_t prop_list_count, |
| 461 | const VkExtensionProperties *props); |
| 462 | void loader_destroy_generic_list(const struct loader_instance *inst, |
| 463 | struct loader_generic_list *list); |
| 464 | void loader_delete_layer_properties(const struct loader_instance *inst, |
| 465 | struct loader_layer_list *layer_list); |
| 466 | void loader_add_to_layer_list(const struct loader_instance *inst, |
| 467 | struct loader_layer_list *list, |
| 468 | uint32_t prop_list_count, |
| 469 | const struct loader_layer_properties *props); |
| 470 | void loader_scanned_icd_clear(const struct loader_instance *inst, |
| 471 | struct loader_icd_libs *icd_libs); |
| 472 | void loader_icd_scan(const struct loader_instance *inst, |
| 473 | struct loader_icd_libs *icds); |
| 474 | void loader_layer_scan(const struct loader_instance *inst, |
| 475 | struct loader_layer_list *instance_layers, |
| 476 | struct loader_layer_list *device_layers); |
Jon Ashburn | e036747 | 2015-08-18 18:04:47 -0600 | [diff] [blame] | 477 | void loader_get_icd_loader_instance_extensions( |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 478 | const struct loader_instance *inst, struct loader_icd_libs *icd_libs, |
| 479 | struct loader_extension_list *inst_exts); |
| 480 | struct loader_icd *loader_get_icd_and_device(const VkDevice device, |
| 481 | struct loader_device **found_dev); |
| 482 | void *loader_dev_ext_gpa(struct loader_instance *inst, const char *funcName); |
| 483 | void *loader_get_dev_ext_trampoline(uint32_t index); |
| 484 | struct loader_instance *loader_get_instance(const VkInstance instance); |
| 485 | void loader_remove_logical_device(const struct loader_instance *inst, |
| 486 | struct loader_icd *icd, |
| 487 | struct loader_device *found_dev); |
| 488 | VkResult |
| 489 | loader_enable_instance_layers(struct loader_instance *inst, |
| 490 | const VkInstanceCreateInfo *pCreateInfo, |
| 491 | const struct loader_layer_list *instance_layers); |
Jon Ashburn | 10f4e82 | 2015-06-10 10:06:06 -0600 | [diff] [blame] | 492 | void loader_deactivate_instance_layers(struct loader_instance *instance); |
Courtney Goeltzenleuchter | 0bd705c | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 493 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 494 | VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, |
| 495 | const VkAllocationCallbacks *pAllocator, |
| 496 | struct loader_instance *inst, |
| 497 | VkInstance created_instance); |
Courtney Goeltzenleuchter | 0bd705c | 2016-01-08 12:18:43 -0700 | [diff] [blame] | 498 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 499 | void loader_activate_instance_layer_extensions(struct loader_instance *inst, |
| 500 | VkInstance created_inst); |
Courtney Goeltzenleuchter | 71b454b | 2015-07-05 11:28:29 -0600 | [diff] [blame] | 501 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 502 | void *loader_heap_alloc(const struct loader_instance *instance, size_t size, |
| 503 | VkSystemAllocationScope allocationScope); |
Courtney Goeltzenleuchter | 71b454b | 2015-07-05 11:28:29 -0600 | [diff] [blame] | 504 | |
Jon Ashburn | 1c75aec | 2016-02-02 17:47:28 -0700 | [diff] [blame^] | 505 | void loader_heap_free(const struct loader_instance *instance, void *pMemory); |
Jon Ashburn | b4dee9c | 2015-08-28 15:19:27 -0600 | [diff] [blame] | 506 | |
| 507 | void *loader_tls_heap_alloc(size_t size); |
| 508 | |
Chia-I Wu | 227c8b3 | 2015-10-27 18:04:07 +0800 | [diff] [blame] | 509 | void loader_tls_heap_free(void *pMemory); |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 510 | #endif /* LOADER_H */ |