summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp
diff options
context:
space:
mode:
authorConnor McLaughlin <stenzek@gmail.com>2019-03-30 00:35:40 +1000
committerGitHub <noreply@github.com>2019-03-30 00:35:40 +1000
commit914aa7c506507c731e3df4e841d1af31d9ba2e69 (patch)
tree6b9bc5805aaf17c68950bcbeeaf95a7e70fdc18b /Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp
parent377615b06fd61717edb39b51964e611fd2da8cdc (diff)
parentb685a66753c980f2c6e69aa277d33b20e9490d15 (diff)
Merge pull request #7943 from stenzek/vulkan-android-library-load
Vulkan: Fix library load failure on Android
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp28
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) \