Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 1 | /* |
Courtney Goeltzenleuchter | 0b01860 | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 2 | * Vulkan |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2014 LunarG, Inc. |
| 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 | * |
| 24 | * Authors: |
| 25 | * Chia-I Wu <olv@lunarg.com> |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #ifndef LOADER_H |
| 29 | #define LOADER_H |
| 30 | |
Courtney Goeltzenleuchter | 0b01860 | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 31 | #include <vulkan.h> |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 32 | #include <vk_debug_report_lunarg.h> |
Chia-I Wu | 73e9db3 | 2015-04-16 22:02:10 +0800 | [diff] [blame] | 33 | #include <vk_wsi_lunarg.h> |
Courtney Goeltzenleuchter | 0b01860 | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 34 | #include <vkLayer.h> |
| 35 | #include <vkIcd.h> |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 36 | #include <assert.h> |
| 37 | |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 38 | #if defined(__GNUC__) && __GNUC__ >= 4 |
| 39 | # define LOADER_EXPORT __attribute__((visibility("default"))) |
| 40 | #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) |
| 41 | # define LOADER_EXPORT __attribute__((visibility("default"))) |
| 42 | #else |
| 43 | # define LOADER_EXPORT |
| 44 | #endif |
| 45 | |
Courtney Goeltzenleuchter | 48403a9 | 2015-06-07 18:24:30 -0600 | [diff] [blame] | 46 | #define MAX_EXTENSION_NAME_SIZE 255 |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 47 | #define MAX_LAYER_LIBRARIES 64 |
| 48 | #define MAX_GPUS_FOR_LAYER 16 |
| 49 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 50 | enum extension_origin { |
| 51 | VK_EXTENSION_ORIGIN_ICD, |
| 52 | VK_EXTENSION_ORIGIN_LAYER, |
| 53 | VK_EXTENSION_ORIGIN_LOADER |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 54 | }; |
| 55 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 56 | struct loader_extension_property { |
| 57 | VkExtensionProperties info; |
| 58 | const char *lib_name; |
| 59 | enum extension_origin origin; |
Courtney Goeltzenleuchter | 99ad448 | 2015-06-07 17:28:17 -0600 | [diff] [blame] | 60 | // An extension library can export the same extension |
| 61 | // under different names. Handy to provide a "grouping" |
| 62 | // such as Validation. However, the loader requires |
| 63 | // that a layer be included only once in a chain. |
| 64 | // During layer scanning the loader will check if |
| 65 | // the vkGet*ProcAddr is the same as an existing extension |
| 66 | // If so, it will link them together via the alias pointer. |
| 67 | // At initialization time we'll follow the alias pointer |
| 68 | // to the "base" extension and then use that extension |
| 69 | // internally to ensure we reject duplicates |
| 70 | char get_extension_info_name[MAX_EXTENSION_NAME_SIZE+1]; |
| 71 | struct loader_extension_property *alias; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 72 | bool hosted; // does the extension reside in one driver/layer |
| 73 | }; |
| 74 | |
| 75 | struct loader_extension_list { |
| 76 | size_t capacity; |
| 77 | uint32_t count; |
| 78 | struct loader_extension_property *list; |
| 79 | }; |
| 80 | |
| 81 | struct loader_scanned_layers { |
| 82 | char *lib_name; |
| 83 | |
| 84 | /* cache of global extensions for a specific layer */ |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 85 | struct loader_extension_list global_extension_list; |
| 86 | |
Courtney Goeltzenleuchter | 1c51240 | 2015-06-17 20:51:59 -0600 | [diff] [blame] | 87 | bool physical_device_extensions_supported; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 88 | /* |
| 89 | * cache of device extensions for a specific layer, |
| 90 | * filled in at CreateInstance time |
| 91 | */ |
Courtney Goeltzenleuchter | 1c51240 | 2015-06-17 20:51:59 -0600 | [diff] [blame] | 92 | struct loader_extension_list physical_device_extension_list; |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 93 | }; |
| 94 | |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 95 | struct loader_icd { |
| 96 | const struct loader_scanned_icds *scanned_icds; |
| 97 | |
| 98 | VkLayerDispatchTable *loader_dispatch; |
| 99 | uint32_t layer_count[MAX_GPUS_FOR_LAYER]; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 100 | uint32_t gpu_count; |
Jon Ashburn | 540a90d | 2015-05-28 19:16:58 -0600 | [diff] [blame] | 101 | VkPhysicalDevice *gpus; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 102 | VkInstance instance; // instance object from the icd |
Jon Ashburn | c89dd4a | 2015-05-18 13:20:15 -0600 | [diff] [blame] | 103 | PFN_vkGetDeviceProcAddr GetDeviceProcAddr; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 104 | PFN_vkDestroyInstance DestroyInstance; |
| 105 | PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; |
| 106 | PFN_vkGetPhysicalDeviceInfo GetPhysicalDeviceInfo; |
| 107 | PFN_vkCreateDevice CreateDevice; |
| 108 | PFN_vkGetPhysicalDeviceExtensionInfo GetPhysicalDeviceExtensionInfo; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 109 | PFN_vkGetMultiDeviceCompatibility GetMultiDeviceCompatibility; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 110 | PFN_vkGetDisplayInfoWSI GetDisplayInfoWSI; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 111 | PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback; |
| 112 | PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 113 | struct loader_icd *next; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 114 | |
| 115 | uint32_t app_extension_count[MAX_GPUS_FOR_LAYER]; |
| 116 | VkExtensionProperties *app_extension_props[MAX_GPUS_FOR_LAYER]; |
| 117 | |
Courtney Goeltzenleuchter | 1c51240 | 2015-06-17 20:51:59 -0600 | [diff] [blame] | 118 | /* |
| 119 | * Fill in the cache of available extensions from all layers that |
| 120 | * operate with this physical device. |
| 121 | * This cache will be used to satisfy calls to GetPhysicalDeviceExtensionInfo |
| 122 | */ |
| 123 | struct loader_extension_list device_extension_cache[MAX_GPUS_FOR_LAYER]; |
| 124 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 125 | struct loader_extension_list enabled_device_extensions[MAX_GPUS_FOR_LAYER]; |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 126 | }; |
| 127 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 128 | struct loader_instance { |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 129 | VkLayerInstanceDispatchTable *disp; // must be first entry in structure |
| 130 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 131 | uint32_t layer_count; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 132 | // struct loader_layers layer_libs[MAX_LAYER_LIBRARIES]; |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 133 | uint32_t total_gpu_count; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 134 | uint32_t total_icd_count; |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 135 | struct loader_icd *icds; |
| 136 | struct loader_instance *next; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 137 | |
| 138 | /* TODO: Should keep track of application provided allocation functions */ |
| 139 | |
| 140 | /* |
| 141 | * CreateMsgCallback is global and needs to be |
| 142 | * applied to all layers and ICDs. |
| 143 | * What happens if a layer is enabled on both the instance chain |
| 144 | * as well as the device chain and a call to CreateMsgCallback is made? |
| 145 | * Do we need to make sure that each layer / driver only gets called once? |
| 146 | * Should a layer implementing support for CreateMsgCallback only be allowed (?) |
| 147 | * to live on one chain? Or maybe make it the application's responsibility. |
| 148 | * If the app enables DRAW_STATE on at both CreateInstance time and CreateDevice |
| 149 | * time, CreateMsgCallback will call the DRAW_STATE layer twice. Once via |
| 150 | * the instance chain and once via the device chain. |
| 151 | * The loader should only return the DEBUG_REPORT extension as supported |
| 152 | * for the GetGlobalExtensionSupport call. That should help eliminate one |
| 153 | * duplication. |
| 154 | * Since the instance chain requires us iterating over the available ICDs |
| 155 | * and each ICD will have it's own unique MsgCallback object we need to |
| 156 | * track those objects to give back the right one. |
| 157 | * This also implies that the loader has to intercept vkDestroyObject and |
| 158 | * if the extension is enabled and the object type is a MsgCallback then |
| 159 | * we must translate the object into the proper ICD specific ones. |
| 160 | * DestroyObject works on a device chain. Should not be what's destroying |
| 161 | * the MsgCallback object. That needs to be an instance thing. So, since |
| 162 | * we used an instance to create it, we need a custom Destroy that also |
| 163 | * takes an instance. That way we can iterate over the ICDs properly. |
| 164 | * Example use: |
| 165 | * CreateInstance: DEBUG_REPORT |
| 166 | * Loader will create instance chain with enabled extensions. |
| 167 | * TODO: Should validation layers be enabled here? If not, they will not be in the instance chain. |
| 168 | * fn = GetProcAddr(INSTANCE, "vkCreateMsgCallback") -> point to loader's vkCreateMsgCallback |
| 169 | * App creates a callback object: fn(..., &MsgCallbackObject1) |
| 170 | * Have only established the instance chain so far. Loader will call the instance chain. |
| 171 | * Each layer in the instance chain will call down to the next layer, terminating with |
| 172 | * the CreateMsgCallback loader terminator function that creates the actual MsgCallbackObject1 object. |
| 173 | * The loader CreateMsgCallback terminator will iterate over the ICDs. |
| 174 | * Calling each ICD that supports vkCreateMsgCallback and collect answers in icd_msg_callback_map here. |
| 175 | * As result is sent back up the chain each layer has opportunity to record the callback operation and |
| 176 | * appropriate MsgCallback object. |
| 177 | * ... |
| 178 | * Any reports matching the flags set in MsgCallbackObject1 will generate the defined callback behavior |
| 179 | * in the layer / ICD that initiated that report. |
| 180 | * ... |
| 181 | * CreateDevice: MemTracker:... |
| 182 | * App does not include DEBUG_REPORT as that is a global extension. |
| 183 | * TODO: GetExtensionSupport must not report DEBUG_REPORT when using instance. |
| 184 | * App MUST include any desired validation layers or they will not participate in the device call chain. |
| 185 | * App creates a callback object: fn(..., &MsgCallbackObject2) |
| 186 | * Loader's vkCreateMsgCallback is called. |
| 187 | * Loader sends call down instance chain - this is a global extension - any validation layer that was |
| 188 | * enabled at CreateInstance will be able to register the callback. Loader will iterate over the ICDs and |
| 189 | * will record the ICD's version of the MsgCallback2 object here. |
| 190 | * ... |
| 191 | * Any report will go to the layer's report function and it will check the flags for MsgCallbackObject1 |
| 192 | * and MsgCallbackObject2 and take the appropriate action as indicated by the app. |
| 193 | * ... |
| 194 | * App calls vkDestroyMsgCallback( MsgCallbackObject1 ) |
| 195 | * Loader's DestroyMsgCallback is where call starts. DestroyMsgCallback will be sent down instance chain |
| 196 | * ending in the loader's DestroyMsgCallback terminator which will iterate over the ICD's destroying each |
| 197 | * ICD version of that MsgCallback object and then destroy the loader's version of the object. |
| 198 | * Any reports generated after this will only have MsgCallbackObject2 available. |
| 199 | */ |
| 200 | struct loader_msg_callback_map_entry *icd_msg_callback_map; |
| 201 | |
| 202 | struct loader_extension_list enabled_instance_extensions; |
Courtney Goeltzenleuchter | 99ad448 | 2015-06-07 17:28:17 -0600 | [diff] [blame] | 203 | struct loader_extension_list activated_layer_list; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 204 | |
| 205 | uint32_t app_extension_count; |
| 206 | VkExtensionProperties *app_extension_props; |
| 207 | |
| 208 | bool debug_report_enabled; |
| 209 | bool wsi_lunarg_enabled; |
| 210 | VkLayerDbgFunctionNode *DbgFunctionHead; |
| 211 | }; |
| 212 | |
Courtney Goeltzenleuchter | 5391923 | 2015-06-08 15:04:02 -0600 | [diff] [blame] | 213 | static inline struct loader_instance *loader_instance(VkInstance instance) { |
| 214 | return (struct loader_instance *) instance; |
| 215 | } |
| 216 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 217 | struct loader_lib_info { |
| 218 | const char *lib_name; |
| 219 | uint32_t ref_count; |
| 220 | loader_platform_dl_handle lib_handle; |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 221 | }; |
| 222 | |
| 223 | struct loader_struct { |
| 224 | struct loader_instance *instances; |
| 225 | bool icds_scanned; |
| 226 | struct loader_scanned_icds *scanned_icd_list; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 227 | bool layers_scanned; |
| 228 | |
| 229 | unsigned int loaded_layer_lib_count; |
| 230 | struct loader_lib_info *loaded_layer_lib_list; |
| 231 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 232 | char *layer_dirs; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 233 | |
| 234 | /* TODO: eliminate fixed limit */ |
| 235 | unsigned int scanned_layer_count; // indicate number of scanned layers |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 236 | size_t scanned_ext_list_capacity; |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 237 | struct loader_scanned_layers scanned_layers[MAX_LAYER_LIBRARIES]; |
| 238 | |
| 239 | /* Keep track of all the extensions available via GetGlobalExtensionInfo */ |
| 240 | struct loader_extension_list global_extensions; |
| 241 | }; |
| 242 | |
| 243 | struct loader_scanned_icds { |
| 244 | char *lib_name; |
| 245 | loader_platform_dl_handle handle; |
| 246 | |
| 247 | PFN_vkCreateInstance CreateInstance; |
| 248 | PFN_vkDestroyInstance DestroyInstance; |
| 249 | PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; |
| 250 | PFN_vkGetGlobalExtensionInfo GetGlobalExtensionInfo; |
| 251 | PFN_vkGetPhysicalDeviceExtensionInfo GetPhysicalDeviceExtensionInfo; |
| 252 | VkInstance instance; |
| 253 | struct loader_scanned_icds *next; |
| 254 | |
| 255 | /* cache of global extensions for specific ICD */ |
| 256 | struct loader_extension_list global_extension_list; |
| 257 | |
| 258 | /* |
| 259 | * cache of device extensions for specific ICD, |
| 260 | * filled in at CreateInstance time |
| 261 | */ |
Courtney Goeltzenleuchter | 1c51240 | 2015-06-17 20:51:59 -0600 | [diff] [blame] | 262 | struct loader_extension_list device_extension_list; |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 263 | }; |
| 264 | |
Jon Ashburn | 62a54d1 | 2015-05-01 18:00:33 -0600 | [diff] [blame] | 265 | static inline void loader_set_dispatch(VkObject obj, const void *data) |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 266 | { |
| 267 | *((const void **) obj) = data; |
| 268 | } |
| 269 | |
Jon Ashburn | 62a54d1 | 2015-05-01 18:00:33 -0600 | [diff] [blame] | 270 | static inline VkLayerDispatchTable *loader_get_dispatch(const VkObject obj) |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 271 | { |
Jon Ashburn | 62a54d1 | 2015-05-01 18:00:33 -0600 | [diff] [blame] | 272 | return *((VkLayerDispatchTable **) obj); |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 273 | } |
| 274 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 275 | static inline VkLayerInstanceDispatchTable *loader_get_instance_dispatch(const VkObject obj) |
| 276 | { |
| 277 | return *((VkLayerInstanceDispatchTable **) obj); |
| 278 | } |
| 279 | |
Jon Ashburn | 62a54d1 | 2015-05-01 18:00:33 -0600 | [diff] [blame] | 280 | static inline void loader_init_dispatch(VkObject obj, const void *data) |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 281 | { |
Jon Ashburn | 167b2b1 | 2015-04-15 13:34:33 -0600 | [diff] [blame] | 282 | #ifdef DEBUG |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 283 | assert(valid_loader_magic_value(obj) && |
| 284 | "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] | 285 | #endif |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 286 | |
Jon Ashburn | 62a54d1 | 2015-05-01 18:00:33 -0600 | [diff] [blame] | 287 | loader_set_dispatch(obj, data); |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 288 | } |
| 289 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 290 | /* global variables used across files */ |
| 291 | extern struct loader_struct loader; |
| 292 | extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_icd); |
| 293 | extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_layer); |
| 294 | extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_exts); |
| 295 | extern VkLayerInstanceDispatchTable instance_disp; |
Jon Ashburn | 37e7f97 | 2015-04-06 10:58:22 -0600 | [diff] [blame] | 296 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 297 | struct loader_msg_callback_map_entry { |
| 298 | VkDbgMsgCallback icd_obj; |
| 299 | VkDbgMsgCallback loader_obj; |
| 300 | }; |
| 301 | |
| 302 | bool compare_vk_extension_properties( |
| 303 | const VkExtensionProperties* op1, |
| 304 | const VkExtensionProperties* op2); |
| 305 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 306 | /* instance layer chain termination entrypoint definitions */ |
| 307 | VkResult loader_CreateInstance( |
| 308 | const VkInstanceCreateInfo* pCreateInfo, |
| 309 | VkInstance* pInstance); |
Chia-I Wu | fe333ed | 2015-04-11 15:34:07 +0800 | [diff] [blame] | 310 | |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 311 | VkResult loader_DestroyInstance( |
| 312 | VkInstance instance); |
| 313 | |
| 314 | VkResult loader_EnumeratePhysicalDevices( |
| 315 | VkInstance instance, |
| 316 | uint32_t* pPhysicalDeviceCount, |
| 317 | VkPhysicalDevice* pPhysicalDevices); |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 318 | VkResult loader_GetPhysicalDeviceInfo( |
| 319 | VkPhysicalDevice gpu, |
| 320 | VkPhysicalDeviceInfoType infoType, |
| 321 | size_t* pDataSize, |
| 322 | void* pData); |
| 323 | |
| 324 | VkResult loader_CreateDevice( |
| 325 | VkPhysicalDevice gpu, |
| 326 | const VkDeviceCreateInfo* pCreateInfo, |
| 327 | VkDevice* pDevice); |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 328 | |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 329 | VkResult loader_GetMultiDeviceCompatibility( |
| 330 | VkPhysicalDevice gpu0, |
| 331 | VkPhysicalDevice gpu1, |
| 332 | VkPhysicalDeviceCompatibilityInfo* pInfo); |
| 333 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 334 | /* helper function definitions */ |
| 335 | bool has_vk_extension_property( |
| 336 | const VkExtensionProperties *vk_ext_prop, |
| 337 | const struct loader_extension_list *ext_list); |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 338 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 339 | void loader_add_to_ext_list( |
| 340 | struct loader_extension_list *ext_list, |
| 341 | uint32_t prop_list_count, |
| 342 | const struct loader_extension_property *props); |
Courtney Goeltzenleuchter | 54fcee1 | 2015-06-08 15:09:22 -0600 | [diff] [blame] | 343 | void loader_destroy_ext_list(struct loader_extension_list *ext_info); |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 344 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 345 | void loader_enable_instance_layers(struct loader_instance *inst); |
Courtney Goeltzenleuchter | 54fcee1 | 2015-06-08 15:09:22 -0600 | [diff] [blame] | 346 | void loader_deactivate_instance_layers(struct loader_instance *instance); |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 347 | |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 348 | bool loader_is_extension_scanned(const VkExtensionProperties *ext_prop); |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 349 | void loader_icd_scan(void); |
| 350 | void layer_lib_scan(void); |
| 351 | void loader_coalesce_extensions(void); |
Courtney Goeltzenleuchter | 67146d0 | 2015-06-10 17:39:03 -0600 | [diff] [blame] | 352 | |
Jon Ashburn | 540a90d | 2015-05-28 19:16:58 -0600 | [diff] [blame] | 353 | struct loader_icd * loader_get_icd(const VkPhysicalDevice gpu, |
Jon Ashburn | ebfa25e | 2015-05-15 15:09:35 -0600 | [diff] [blame] | 354 | uint32_t *gpu_index); |
Jon Ashburn | 1348245 | 2015-05-12 17:26:48 -0600 | [diff] [blame] | 355 | uint32_t loader_activate_instance_layers(struct loader_instance *inst); |
Courtney Goeltzenleuchter | 1c51240 | 2015-06-17 20:51:59 -0600 | [diff] [blame] | 356 | void loader_activate_instance_layer_extensions(struct loader_instance *inst); |
Chia-I Wu | c1e0f96 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 357 | #endif /* LOADER_H */ |