mirror of
https://github.com/libretro/snes9x.git
synced 2025-01-30 21:42:24 +00:00
vulkan: Handle case when no vulkan library is available.
Use one copy of the dynamic loader, if it can't load a library, drop out of instance creation.
This commit is contained in:
parent
edbffb9a53
commit
f67bdbef3f
@ -8,14 +8,21 @@
|
||||
namespace Vulkan
|
||||
{
|
||||
|
||||
static std::unique_ptr<vk::DynamicLoader> dl;
|
||||
|
||||
Context::Context()
|
||||
{
|
||||
vk::DynamicLoader *dl = new vk::DynamicLoader;
|
||||
if (!dl)
|
||||
{
|
||||
dl = std::make_unique<vk::DynamicLoader>();
|
||||
if (!dl->success())
|
||||
return;
|
||||
}
|
||||
|
||||
auto vkGetInstanceProcAddr =
|
||||
dl->getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
||||
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
||||
|
||||
}
|
||||
|
||||
Context::~Context()
|
||||
@ -39,6 +46,9 @@ Context::~Context()
|
||||
|
||||
static vk::UniqueInstance create_instance_preamble(const char *wsi_extension)
|
||||
{
|
||||
if (!dl || !dl->success())
|
||||
return vk::UniqueInstance();
|
||||
|
||||
std::vector<const char *> extensions = { wsi_extension, VK_KHR_SURFACE_EXTENSION_NAME };
|
||||
vk::ApplicationInfo application_info({}, {}, {}, {}, VK_API_VERSION_1_0);
|
||||
vk::InstanceCreateInfo instance_create_info({}, &application_info, {}, extensions);
|
||||
|
Loading…
x
Reference in New Issue
Block a user