diff --git a/src/vulkan/vulkan_loader.cpp b/src/vulkan/vulkan_loader.cpp index e5981e94..17e9b629 100644 --- a/src/vulkan/vulkan_loader.cpp +++ b/src/vulkan/vulkan_loader.cpp @@ -45,8 +45,13 @@ namespace dxvk::vk { std::tie(m_library, m_getInstanceProcAddr) = loadVulkanLibrary(); } + LibraryLoader::LibraryLoader(PFN_vkGetInstanceProcAddr loaderProc) { + m_getInstanceProcAddr = loaderProc; + } + LibraryLoader::~LibraryLoader() { - FreeLibrary(m_library); + if (m_library) + FreeLibrary(m_library); } PFN_vkVoidFunction LibraryLoader::sym(VkInstance instance, const char* name) const { @@ -84,6 +89,8 @@ namespace dxvk::vk { LibraryFn::LibraryFn() { } + LibraryFn::LibraryFn(PFN_vkGetInstanceProcAddr loaderProc) + : LibraryLoader(loaderProc) { } LibraryFn::~LibraryFn() { } diff --git a/src/vulkan/vulkan_loader.h b/src/vulkan/vulkan_loader.h index 89944e09..6939985f 100644 --- a/src/vulkan/vulkan_loader.h +++ b/src/vulkan/vulkan_loader.h @@ -20,6 +20,7 @@ namespace dxvk::vk { */ struct LibraryLoader : public RcObject { LibraryLoader(); + LibraryLoader(PFN_vkGetInstanceProcAddr loaderProc); ~LibraryLoader(); PFN_vkVoidFunction sym(VkInstance instance, const char* name) const; PFN_vkVoidFunction sym(const char* name) const; @@ -75,6 +76,7 @@ namespace dxvk::vk { */ struct LibraryFn : LibraryLoader { LibraryFn(); + LibraryFn(PFN_vkGetInstanceProcAddr loaderProc); ~LibraryFn(); VULKAN_FN(vkCreateInstance);