diff options
| author | Stenzek <stenzek@gmail.com> | 2019-03-29 23:35:01 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2019-03-29 23:36:53 +1000 |
| commit | a6bb06174f6e571be10b3a436e9cb9bd9e7a408f (patch) | |
| tree | 203e38e613308115912f952606b9df8bd7ec4f85 /Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp | |
| parent | 377615b06fd61717edb39b51964e611fd2da8cdc (diff) | |
Vulkan: Fix library load failure on Android
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp b/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp index bfc8b5673e..cb1c8d6571 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp @@ -37,32 +37,32 @@ static void ResetVulkanLibraryFunctionPointers() static Common::DynamicLibrary s_vulkan_module; -static std::string GetVulkanLibraryFilename() +static bool OpenVulkanLibrary() { #ifdef __APPLE__ // Check if a path to a specific Vulkan library has been specified. char* libvulkan_env = getenv("LIBVULKAN_PATH"); - if (libvulkan_env) - return std::string(libvulkan_env); + if (libvulkan_env && s_vulkan_module.Open(libvulkan_env)) + return true; // Use the libvulkan.dylib from the application bundle. - return File::GetBundleDirectory() + "/Contents/Frameworks/libvulkan.dylib"; + std::string filename = File::GetBundleDirectory() + "/Contents/Frameworks/libvulkan.dylib"; + return s_vulkan_module.Open(filename.c_str()); #else - return Common::DynamicLibrary::GetVersionedFilename("vulkan", 1); + std::string filename = Common::DynamicLibrary::GetVersionedFilename("vulkan", 1); + if (s_vulkan_module.Open(filename.c_str())) + return true; + + // Android devices may not have libvulkan.so.1, only libvulkan.so. + filename = Common::DynamicLibrary::GetVersionedFilename("vulkan"); + return s_vulkan_module.Open(filename.c_str()); #endif } bool LoadVulkanLibrary() { - if (!s_vulkan_module.IsOpen()) - { - const std::string filename = GetVulkanLibraryFilename(); - if (!s_vulkan_module.Open(filename.c_str())) - { - ERROR_LOG(VIDEO, "Failed to load %s", filename.c_str()); - return false; - } - } + if (!s_vulkan_module.IsOpen() && !OpenVulkanLibrary()) + return false; #define VULKAN_MODULE_ENTRY_POINT(name, required) \ if (!s_vulkan_module.GetSymbol(#name, &name) && required) \ |
