1 /* 2 * 3 * Copyright (c) 2014-2016 The Khronos Group Inc. 4 * Copyright (c) 2014-2016 Valve Corporation 5 * Copyright (c) 2014-2016 LunarG, Inc. 6 * Copyright (C) 2015 Google Inc. 7 * 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: 14 * 15 * The above copyright notice(s) and this permission notice shall be included in 16 * all copies or substantial portions of the Materials. 17 * 18 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 * 22 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 23 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 24 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE 25 * USE OR OTHER DEALINGS IN THE MATERIALS. 26 * 27 * Author: Jon Ashburn <jon (at) lunarg.com> 28 * Author: Courtney Goeltzenleuchter <courtney (at) LunarG.com> 29 * Author: Chia-I Wu <olvaffe (at) gmail.com> 30 * Author: Chia-I Wu <olv (at) lunarg.com> 31 * Author: Mark Lobodzinski <mark (at) LunarG.com> 32 * 33 */ 34 35 #ifndef LOADER_H 36 #define LOADER_H 37 38 #include <vulkan/vulkan.h> 39 #include "vk_loader_platform.h" 40 41 #include <vulkan/vk_layer.h> 42 #include <vulkan/vk_icd.h> 43 #include <assert.h> 44 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 53 #define MAX_STRING_SIZE 1024 54 #define VK_MAJOR(version) (version >> 22) 55 #define VK_MINOR(version) ((version >> 12) & 0x3ff) 56 #define VK_PATCH(version) (version & 0xfff) 57 58 enum layer_type { 59 VK_LAYER_TYPE_DEVICE_EXPLICIT = 0x1, 60 VK_LAYER_TYPE_INSTANCE_EXPLICIT = 0x2, 61 VK_LAYER_TYPE_GLOBAL_EXPLICIT = 0x3, // 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, // instance and device layer, bitwise 65 VK_LAYER_TYPE_META_EXPLICT = 0x10, 66 }; 67 68 typedef enum VkStringErrorFlagBits { 69 VK_STRING_ERROR_NONE = 0x00000000, 70 VK_STRING_ERROR_LENGTH = 0x00000001, 71 VK_STRING_ERROR_BAD_DATA = 0x00000002, 72 } VkStringErrorFlagBits; 73 typedef VkFlags VkStringErrorFlags; 74 75 static const int MaxLoaderStringLength = 256; 76 static const char UTF8_ONE_BYTE_CODE = 0xC0; 77 static const char UTF8_ONE_BYTE_MASK = 0xE0; 78 static const char UTF8_TWO_BYTE_CODE = 0xE0; 79 static const char UTF8_TWO_BYTE_MASK = 0xF0; 80 static const char UTF8_THREE_BYTE_CODE = 0xF0; 81 static const char UTF8_THREE_BYTE_MASK = 0xF8; 82 static const char UTF8_DATA_BYTE_CODE = 0x80; 83 static const char UTF8_DATA_BYTE_MASK = 0xC0; 84 85 static const char std_validation_names[8][VK_MAX_EXTENSION_NAME_SIZE] = { 86 "VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation", 87 "VK_LAYER_LUNARG_device_limits", "VK_LAYER_LUNARG_object_tracker", 88 "VK_LAYER_LUNARG_image", "VK_LAYER_LUNARG_core_validation", 89 "VK_LAYER_LUNARG_swapchain", "VK_LAYER_GOOGLE_unique_objects"}; 90 91 // form of all dynamic lists/arrays 92 // only the list element should be changed 93 struct loader_generic_list { 94 size_t capacity; 95 uint32_t count; 96 void *list; 97 }; 98 99 struct loader_extension_list { 100 size_t capacity; 101 uint32_t count; 102 VkExtensionProperties *list; 103 }; 104 105 struct loader_dev_ext_props { 106 VkExtensionProperties props; 107 uint32_t entrypoint_count; 108 char **entrypoints; 109 }; 110 111 struct loader_device_extension_list { 112 size_t capacity; 113 uint32_t count; 114 struct loader_dev_ext_props *list; 115 }; 116 117 struct loader_name_value { 118 char name[MAX_STRING_SIZE]; 119 char value[MAX_STRING_SIZE]; 120 }; 121 122 struct loader_lib_info { 123 char lib_name[MAX_STRING_SIZE]; 124 uint32_t ref_count; 125 loader_platform_dl_handle lib_handle; 126 }; 127 128 struct loader_layer_functions { 129 char str_gipa[MAX_STRING_SIZE]; 130 char str_gdpa[MAX_STRING_SIZE]; 131 PFN_vkGetInstanceProcAddr get_instance_proc_addr; 132 PFN_vkGetDeviceProcAddr get_device_proc_addr; 133 }; 134 135 struct loader_layer_properties { 136 VkLayerProperties info; 137 enum layer_type type; 138 char lib_name[MAX_STRING_SIZE]; 139 struct loader_layer_functions functions; 140 struct loader_extension_list instance_extension_list; 141 struct loader_device_extension_list device_extension_list; 142 struct loader_name_value disable_env_var; 143 struct loader_name_value enable_env_var; 144 }; 145 146 struct loader_layer_list { 147 size_t capacity; 148 uint32_t count; 149 struct loader_layer_properties *list; 150 }; 151 152 struct loader_layer_library_list { 153 size_t capacity; 154 uint32_t count; 155 struct loader_lib_info *list; 156 }; 157 158 struct loader_dispatch_hash_list { 159 size_t capacity; 160 uint32_t count; 161 uint32_t *index; // index into the dev_ext dispatch table 162 }; 163 164 #define MAX_NUM_DEV_EXTS 250 165 // loader_dispatch_hash_entry and loader_dev_ext_dispatch_table.DevExt have one 166 // to one 167 // correspondence; one loader_dispatch_hash_entry for one DevExt dispatch entry. 168 // Also have a one to one correspondence with functions in dev_ext_trampoline.c 169 struct loader_dispatch_hash_entry { 170 char *func_name; 171 struct loader_dispatch_hash_list list; // to handle hashing collisions 172 }; 173 174 typedef void(VKAPI_PTR *PFN_vkDevExt)(VkDevice device); 175 struct loader_dev_ext_dispatch_table { 176 PFN_vkDevExt DevExt[MAX_NUM_DEV_EXTS]; 177 }; 178 179 struct loader_dev_dispatch_table { 180 VkLayerDispatchTable core_dispatch; 181 struct loader_dev_ext_dispatch_table ext_dispatch; 182 }; 183 184 /* per CreateDevice structure */ 185 struct loader_device { 186 struct loader_dev_dispatch_table loader_dispatch; 187 VkDevice device; // device object from the icd 188 189 uint32_t app_extension_count; 190 VkExtensionProperties *app_extension_props; 191 192 struct loader_layer_list activated_layer_list; 193 194 struct loader_device *next; 195 }; 196 197 /* per ICD structure */ 198 struct loader_icd { 199 // pointers to find other structs 200 const struct loader_scanned_icds *this_icd_lib; 201 const struct loader_instance *this_instance; 202 VkPhysicalDevice *phys_devs; // physicalDevice object from icd 203 struct loader_device *logical_device_list; 204 VkInstance instance; // instance object from the icd 205 PFN_vkGetDeviceProcAddr GetDeviceProcAddr; 206 PFN_vkDestroyInstance DestroyInstance; 207 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; 208 PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures; 209 PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties; 210 PFN_vkGetPhysicalDeviceImageFormatProperties 211 GetPhysicalDeviceImageFormatProperties; 212 PFN_vkCreateDevice CreateDevice; 213 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties; 214 PFN_vkGetPhysicalDeviceQueueFamilyProperties 215 GetPhysicalDeviceQueueFamilyProperties; 216 PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties; 217 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties; 218 PFN_vkGetPhysicalDeviceSparseImageFormatProperties 219 GetPhysicalDeviceSparseImageFormatProperties; 220 PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT; 221 PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT; 222 PFN_vkDebugReportMessageEXT DebugReportMessageEXT; 223 PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR; 224 PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR 225 GetPhysicalDeviceSurfaceCapabilitiesKHR; 226 PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR; 227 PFN_vkGetPhysicalDeviceSurfacePresentModesKHR 228 GetPhysicalDeviceSurfacePresentModesKHR; 229 #ifdef VK_USE_PLATFORM_WIN32_KHR 230 PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR 231 GetPhysicalDeviceWin32PresentationSupportKHR; 232 #endif 233 #ifdef VK_USE_PLATFORM_MIR_KHR 234 PFN_vkGetPhysicalDeviceMirPresentationSupportKHR 235 GetPhysicalDeviceMirPresentvationSupportKHR; 236 #endif 237 #ifdef VK_USE_PLATFORM_WAYLAND_KHR 238 PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR 239 GetPhysicalDeviceWaylandPresentationSupportKHR; 240 #endif 241 #ifdef VK_USE_PLATFORM_XCB_KHR 242 PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR 243 GetPhysicalDeviceXcbPresentationSupportKHR; 244 #endif 245 #ifdef VK_USE_PLATFORM_XLIB_KHR 246 PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR 247 GetPhysicalDeviceXlibPresentationSupportKHR; 248 #endif 249 PFN_vkGetPhysicalDeviceDisplayPropertiesKHR 250 GetPhysicalDeviceDisplayPropertiesKHR; 251 PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR 252 GetPhysicalDeviceDisplayPlanePropertiesKHR; 253 PFN_vkGetDisplayPlaneSupportedDisplaysKHR 254 GetDisplayPlaneSupportedDisplaysKHR; 255 PFN_vkGetDisplayModePropertiesKHR 256 GetDisplayModePropertiesKHR; 257 PFN_vkCreateDisplayModeKHR 258 CreateDisplayModeKHR; 259 PFN_vkGetDisplayPlaneCapabilitiesKHR 260 GetDisplayPlaneCapabilitiesKHR; 261 PFN_vkCreateDisplayPlaneSurfaceKHR 262 CreateDisplayPlaneSurfaceKHR; 263 struct loader_icd *next; 264 }; 265 266 /* per ICD library structure */ 267 struct loader_icd_libs { 268 size_t capacity; 269 uint32_t count; 270 struct loader_scanned_icds *list; 271 }; 272 273 /* per instance structure */ 274 struct loader_instance { 275 VkLayerInstanceDispatchTable *disp; // must be first entry in structure 276 277 uint32_t total_gpu_count; // count of the next two arrays 278 struct loader_physical_device *phys_devs_term; 279 struct loader_physical_device *phys_devs; // tramp wrapped physDev obj list 280 uint32_t total_icd_count; 281 struct loader_icd *icds; 282 struct loader_instance *next; 283 struct loader_extension_list ext_list; // icds and loaders extensions 284 struct loader_icd_libs icd_libs; 285 struct loader_layer_list instance_layer_list; 286 struct loader_layer_list device_layer_list; 287 struct loader_dispatch_hash_entry disp_hash[MAX_NUM_DEV_EXTS]; 288 289 struct loader_msg_callback_map_entry *icd_msg_callback_map; 290 291 struct loader_layer_list activated_layer_list; 292 293 VkInstance instance; // layers/ICD instance returned to trampoline 294 295 bool debug_report_enabled; 296 VkLayerDbgFunctionNode *DbgFunctionHead; 297 298 VkAllocationCallbacks alloc_callbacks; 299 300 bool wsi_surface_enabled; 301 #ifdef VK_USE_PLATFORM_WIN32_KHR 302 bool wsi_win32_surface_enabled; 303 #endif 304 #ifdef VK_USE_PLATFORM_MIR_KHR 305 bool wsi_mir_surface_enabled; 306 #endif 307 #ifdef VK_USE_PLATFORM_WAYLAND_KHR 308 bool wsi_wayland_surface_enabled; 309 #endif 310 #ifdef VK_USE_PLATFORM_XCB_KHR 311 bool wsi_xcb_surface_enabled; 312 #endif 313 #ifdef VK_USE_PLATFORM_XLIB_KHR 314 bool wsi_xlib_surface_enabled; 315 #endif 316 #ifdef VK_USE_PLATFORM_ANDROID_KHR 317 bool wsi_android_surface_enabled; 318 #endif 319 bool wsi_display_enabled; 320 }; 321 322 /* VkPhysicalDevice requires special treatment by loader. Firstly, terminator 323 * code must be able to get the struct loader_icd to call into the proper 324 * driver (multiple ICD/gpu case). This can be accomplished by wrapping the 325 * created VkPhysicalDevice in loader terminate_EnumeratePhysicalDevices(). 326 * Secondly, loader must be able to find the instance and icd in trampoline 327 * code. 328 * Thirdly, the loader must be able to handle wrapped by layer VkPhysicalDevice 329 * in trampoline code. This implies, that the loader trampoline code must also 330 * wrap the VkPhysicalDevice object in trampoline code. Thus, loader has to 331 * wrap the VkPhysicalDevice created object twice. In trampoline code it can't 332 * rely on the terminator object wrapping since a layer may also wrap. Since 333 * trampoline code wraps the VkPhysicalDevice this means all loader trampoline 334 * code that passes a VkPhysicalDevice should unwrap it. */ 335 336 /* per enumerated PhysicalDevice structure, used to wrap in trampoline code and 337 also same structure used to wrap in terminator code */ 338 struct loader_physical_device { 339 VkLayerInstanceDispatchTable *disp; // must be first entry in structure 340 struct loader_icd *this_icd; 341 VkPhysicalDevice phys_dev; // object from ICD/layers/loader terminator 342 }; 343 344 struct loader_struct { 345 struct loader_instance *instances; 346 347 unsigned int loaded_layer_lib_count; 348 size_t loaded_layer_lib_capacity; 349 struct loader_lib_info *loaded_layer_lib_list; 350 // TODO add ref counting of ICD libraries 351 // TODO use this struct loader_layer_library_list scanned_layer_libraries; 352 // TODO add list of icd libraries for ref counting them for closure 353 }; 354 355 struct loader_scanned_icds { 356 char *lib_name; 357 loader_platform_dl_handle handle; 358 uint32_t api_version; 359 PFN_vkGetInstanceProcAddr GetInstanceProcAddr; 360 PFN_vkCreateInstance CreateInstance; 361 PFN_vkEnumerateInstanceExtensionProperties 362 EnumerateInstanceExtensionProperties; 363 }; 364 365 static inline struct loader_instance *loader_instance(VkInstance instance) { 366 return (struct loader_instance *)instance; 367 } 368 369 static inline VkPhysicalDevice 370 loader_unwrap_physical_device(VkPhysicalDevice physicalDevice) { 371 struct loader_physical_device *phys_dev = 372 (struct loader_physical_device *)physicalDevice; 373 return phys_dev->phys_dev; 374 } 375 376 static inline void loader_set_dispatch(void *obj, const void *data) { 377 *((const void **)obj) = data; 378 } 379 380 static inline VkLayerDispatchTable *loader_get_dispatch(const void *obj) { 381 return *((VkLayerDispatchTable **)obj); 382 } 383 384 static inline struct loader_dev_dispatch_table * 385 loader_get_dev_dispatch(const void *obj) { 386 return *((struct loader_dev_dispatch_table **)obj); 387 } 388 389 static inline VkLayerInstanceDispatchTable * 390 loader_get_instance_dispatch(const void *obj) { 391 return *((VkLayerInstanceDispatchTable **)obj); 392 } 393 394 static inline void loader_init_dispatch(void *obj, const void *data) { 395 #ifdef DEBUG 396 assert(valid_loader_magic_value(obj) && 397 "Incompatible ICD, first dword must be initialized to " 398 "ICD_LOADER_MAGIC. See loader/README.md for details."); 399 #endif 400 401 loader_set_dispatch(obj, data); 402 } 403 404 /* global variables used across files */ 405 extern struct loader_struct loader; 406 extern THREAD_LOCAL_DECL struct loader_instance *tls_instance; 407 extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_init); 408 extern loader_platform_thread_mutex loader_lock; 409 extern loader_platform_thread_mutex loader_json_lock; 410 extern const VkLayerInstanceDispatchTable instance_disp; 411 extern const char *std_validation_str; 412 413 struct loader_msg_callback_map_entry { 414 VkDebugReportCallbackEXT icd_obj; 415 VkDebugReportCallbackEXT loader_obj; 416 }; 417 418 /* helper function definitions */ 419 void *loader_heap_alloc(const struct loader_instance *instance, size_t size, 420 VkSystemAllocationScope allocationScope); 421 422 void loader_heap_free(const struct loader_instance *instance, void *pMemory); 423 424 void *loader_tls_heap_alloc(size_t size); 425 426 void loader_tls_heap_free(void *pMemory); 427 428 void loader_log(const struct loader_instance *inst, VkFlags msg_type, 429 int32_t msg_code, const char *format, ...); 430 431 bool compare_vk_extension_properties(const VkExtensionProperties *op1, 432 const VkExtensionProperties *op2); 433 434 VkResult loader_validate_layers(const struct loader_instance *inst, 435 const uint32_t layer_count, 436 const char *const *ppEnabledLayerNames, 437 const struct loader_layer_list *list); 438 439 VkResult loader_validate_instance_extensions( 440 const struct loader_instance *inst, 441 const struct loader_extension_list *icd_exts, 442 const struct loader_layer_list *instance_layer, 443 const VkInstanceCreateInfo *pCreateInfo); 444 445 void loader_initialize(void); 446 bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, 447 const uint32_t count, 448 const VkExtensionProperties *ext_array); 449 bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, 450 const struct loader_extension_list *ext_list); 451 452 VkResult loader_add_to_ext_list(const struct loader_instance *inst, 453 struct loader_extension_list *ext_list, 454 uint32_t prop_list_count, 455 const VkExtensionProperties *props); 456 VkResult loader_add_device_extensions(const struct loader_instance *inst, 457 struct loader_icd *icd, 458 VkPhysicalDevice physical_device, 459 const char *lib_name, 460 struct loader_extension_list *ext_list); 461 bool loader_init_generic_list(const struct loader_instance *inst, 462 struct loader_generic_list *list_info, 463 size_t element_size); 464 void loader_destroy_generic_list(const struct loader_instance *inst, 465 struct loader_generic_list *list); 466 void loader_destroy_layer_list(const struct loader_instance *inst, 467 struct loader_layer_list *layer_list); 468 void loader_delete_layer_properties(const struct loader_instance *inst, 469 struct loader_layer_list *layer_list); 470 void loader_expand_layer_names( 471 const struct loader_instance *inst, const char *key_name, 472 uint32_t expand_count, 473 const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE], 474 uint32_t *layer_count, char ***ppp_layer_names); 475 void loader_unexpand_dev_layer_names(const struct loader_instance *inst, 476 uint32_t layer_count, char **layer_names, 477 char **layer_ptr, 478 const VkDeviceCreateInfo *pCreateInfo); 479 void loader_unexpand_inst_layer_names(const struct loader_instance *inst, 480 uint32_t layer_count, char **layer_names, 481 char **layer_ptr, 482 const VkInstanceCreateInfo *pCreateInfo); 483 void loader_add_to_layer_list(const struct loader_instance *inst, 484 struct loader_layer_list *list, 485 uint32_t prop_list_count, 486 const struct loader_layer_properties *props); 487 void loader_scanned_icd_clear(const struct loader_instance *inst, 488 struct loader_icd_libs *icd_libs); 489 void loader_icd_scan(const struct loader_instance *inst, 490 struct loader_icd_libs *icds); 491 void loader_layer_scan(const struct loader_instance *inst, 492 struct loader_layer_list *instance_layers, 493 struct loader_layer_list *device_layers); 494 void loader_get_icd_loader_instance_extensions( 495 const struct loader_instance *inst, struct loader_icd_libs *icd_libs, 496 struct loader_extension_list *inst_exts); 497 struct loader_icd *loader_get_icd_and_device(const VkDevice device, 498 struct loader_device **found_dev); 499 void loader_init_dispatch_dev_ext(struct loader_instance *inst, 500 struct loader_device *dev); 501 void *loader_dev_ext_gpa(struct loader_instance *inst, const char *funcName); 502 void *loader_get_dev_ext_trampoline(uint32_t index); 503 struct loader_instance *loader_get_instance(const VkInstance instance); 504 struct loader_device * 505 loader_add_logical_device(const struct loader_instance *inst, 506 struct loader_device **device_list); 507 void loader_remove_logical_device(const struct loader_instance *inst, 508 struct loader_icd *icd, 509 struct loader_device *found_dev); 510 VkResult 511 loader_enable_instance_layers(struct loader_instance *inst, 512 const VkInstanceCreateInfo *pCreateInfo, 513 const struct loader_layer_list *instance_layers); 514 void loader_deactivate_instance_layers(struct loader_instance *instance); 515 516 VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, 517 const VkAllocationCallbacks *pAllocator, 518 struct loader_instance *inst, 519 VkInstance *created_instance); 520 521 void loader_activate_instance_layer_extensions(struct loader_instance *inst, 522 VkInstance created_inst); 523 VkResult 524 loader_enable_device_layers(const struct loader_instance *inst, 525 struct loader_icd *icd, 526 struct loader_layer_list *activated_layer_list, 527 const VkDeviceCreateInfo *pCreateInfo, 528 const struct loader_layer_list *device_layers); 529 530 VkResult loader_create_device_chain(const struct loader_physical_device *pd, 531 const VkDeviceCreateInfo *pCreateInfo, 532 const VkAllocationCallbacks *pAllocator, 533 const struct loader_instance *inst, 534 struct loader_icd *icd, 535 struct loader_device *dev); 536 VkResult loader_validate_device_extensions( 537 struct loader_physical_device *phys_dev, 538 const struct loader_layer_list *activated_device_layers, 539 const struct loader_extension_list *icd_exts, 540 const VkDeviceCreateInfo *pCreateInfo); 541 542 /* instance layer chain termination entrypoint definitions */ 543 VKAPI_ATTR VkResult VKAPI_CALL 544 terminator_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, 545 const VkAllocationCallbacks *pAllocator, 546 VkInstance *pInstance); 547 548 VKAPI_ATTR void VKAPI_CALL 549 terminator_DestroyInstance(VkInstance instance, 550 const VkAllocationCallbacks *pAllocator); 551 552 VKAPI_ATTR VkResult VKAPI_CALL 553 terminator_EnumeratePhysicalDevices(VkInstance instance, 554 uint32_t *pPhysicalDeviceCount, 555 VkPhysicalDevice *pPhysicalDevices); 556 557 VKAPI_ATTR void VKAPI_CALL 558 terminator_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, 559 VkPhysicalDeviceFeatures *pFeatures); 560 561 VKAPI_ATTR void VKAPI_CALL 562 terminator_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, 563 VkFormat format, 564 VkFormatProperties *pFormatInfo); 565 566 VKAPI_ATTR VkResult VKAPI_CALL 567 terminator_GetPhysicalDeviceImageFormatProperties( 568 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, 569 VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, 570 VkImageFormatProperties *pImageFormatProperties); 571 572 VKAPI_ATTR void VKAPI_CALL 573 terminator_GetPhysicalDeviceSparseImageFormatProperties( 574 VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, 575 VkSampleCountFlagBits samples, VkImageUsageFlags usage, 576 VkImageTiling tiling, uint32_t *pNumProperties, 577 VkSparseImageFormatProperties *pProperties); 578 579 VKAPI_ATTR void VKAPI_CALL 580 terminator_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, 581 VkPhysicalDeviceProperties *pProperties); 582 583 VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties( 584 VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pCount, 585 VkExtensionProperties *pProperties); 586 587 VKAPI_ATTR VkResult VKAPI_CALL 588 terminator_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, 589 uint32_t *pCount, 590 VkLayerProperties *pProperties); 591 592 VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties( 593 VkPhysicalDevice physicalDevice, uint32_t *pCount, 594 VkQueueFamilyProperties *pProperties); 595 596 VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties( 597 VkPhysicalDevice physicalDevice, 598 VkPhysicalDeviceMemoryProperties *pProperties); 599 600 VKAPI_ATTR VkResult VKAPI_CALL 601 terminator_CreateDevice(VkPhysicalDevice gpu, 602 const VkDeviceCreateInfo *pCreateInfo, 603 const VkAllocationCallbacks *pAllocator, 604 VkDevice *pDevice); 605 606 VkStringErrorFlags vk_string_validate(const int max_length, 607 const char *char_array); 608 609 #endif /* LOADER_H */ 610