Dynamically load Vulkan library and base function pointers
| 54 | |
| 55 | // Dynamically load Vulkan library and base function pointers |
| 56 | bool loadVulkanLibrary() |
| 57 | { |
| 58 | __android_log_print(ANDROID_LOG_INFO, "vulkanCapsViewer", "Loading libvulkan.so...\n"); |
| 59 | |
| 60 | // Load vulkan library |
| 61 | void *libVulkan = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL); |
| 62 | if (!libVulkan) |
| 63 | { |
| 64 | __android_log_print(ANDROID_LOG_INFO, "vulkanCapsViewer", "Could not load vulkan library : %s!\n", dlerror()); |
| 65 | return false; |
| 66 | } |
| 67 | |
| 68 | // Load base function pointers |
| 69 | vkEnumerateInstanceExtensionProperties = reinterpret_cast<PFN_vkEnumerateInstanceExtensionProperties>(dlsym(libVulkan, "vkEnumerateInstanceExtensionProperties")); |
| 70 | vkEnumerateInstanceLayerProperties = reinterpret_cast<PFN_vkEnumerateInstanceLayerProperties>(dlsym(libVulkan, "vkEnumerateInstanceLayerProperties")); |
| 71 | vkCreateInstance = reinterpret_cast<PFN_vkCreateInstance>(dlsym(libVulkan, "vkCreateInstance")); |
| 72 | vkDestroyInstance = reinterpret_cast<PFN_vkDestroyInstance>(dlsym(libVulkan, "vkDestroyInstance")); |
| 73 | vkGetInstanceProcAddr = reinterpret_cast<PFN_vkGetInstanceProcAddr>(dlsym(libVulkan, "vkGetInstanceProcAddr")); |
| 74 | |
| 75 | // Required for the profiles library |
| 76 | vkEnumerateInstanceVersion = reinterpret_cast<PFN_vkEnumerateInstanceVersion>(dlsym(libVulkan, "vkEnumerateInstanceVersion")); |
| 77 | vkGetDeviceProcAddr = reinterpret_cast<PFN_vkGetDeviceProcAddr>(dlsym(libVulkan, "vkGetDeviceProcAddr")); |
| 78 | |
| 79 | return true; |
| 80 | } |
| 81 | |
| 82 | // Load instance based Vulkan function pointers |
| 83 | void loadVulkanFunctions() |