mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 14:25:38 +00:00
VulkanLoader: Search frameworks directory for libvulkan.dylib
This commit is contained in:
parent
032127a7d6
commit
5f3642e9fd
|
@ -7,6 +7,8 @@
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "vulkan_loader.h"
|
#include "vulkan_loader.h"
|
||||||
|
|
||||||
|
@ -14,6 +16,10 @@
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define VULKAN_MODULE_ENTRY_POINT(name, required) PFN_##name name;
|
#define VULKAN_MODULE_ENTRY_POINT(name, required) PFN_##name name;
|
||||||
#define VULKAN_INSTANCE_ENTRY_POINT(name, required) PFN_##name name;
|
#define VULKAN_INSTANCE_ENTRY_POINT(name, required) PFN_##name name;
|
||||||
#define VULKAN_DEVICE_ENTRY_POINT(name, required) PFN_##name name;
|
#define VULKAN_DEVICE_ENTRY_POINT(name, required) PFN_##name name;
|
||||||
|
@ -111,6 +117,25 @@ bool LoadVulkanLibrary()
|
||||||
char* libvulkan_env = getenv("LIBVULKAN_PATH");
|
char* libvulkan_env = getenv("LIBVULKAN_PATH");
|
||||||
if (libvulkan_env)
|
if (libvulkan_env)
|
||||||
vulkan_module = dlopen(libvulkan_env, RTLD_NOW);
|
vulkan_module = dlopen(libvulkan_env, RTLD_NOW);
|
||||||
|
if (!vulkan_module)
|
||||||
|
{
|
||||||
|
unsigned path_size = 0;
|
||||||
|
_NSGetExecutablePath(nullptr, &path_size);
|
||||||
|
std::string path;
|
||||||
|
path.resize(path_size);
|
||||||
|
if (_NSGetExecutablePath(path.data(), &path_size) == 0)
|
||||||
|
{
|
||||||
|
path[path_size] = 0;
|
||||||
|
|
||||||
|
size_t pos = path.rfind('/');
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
{
|
||||||
|
path.erase(pos);
|
||||||
|
path += "/../Frameworks/libvulkan.dylib";
|
||||||
|
vulkan_module = dlopen(path.c_str(), RTLD_NOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!vulkan_module)
|
if (!vulkan_module)
|
||||||
vulkan_module = dlopen("libvulkan.dylib", RTLD_NOW);
|
vulkan_module = dlopen("libvulkan.dylib", RTLD_NOW);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue