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