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