1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00
dxvk/src/vulkan/vulkan_loader.cpp
Connor Abbott b9135ca0cd
Do not try to load libraries natively under __WINE__
This was only half-implemented (e.g. OpenXR was still calling
GetModuleHandle), broke compilation with Vulkan due to mismatched ABI,
and wouldn't have worked anyways with winelib builds because we still
need access to wine's implementation of the Vulkan win32 winsys
integration. Perhaps this is still useful for dxvk-native but if so it
should be re-added under a DXVK_NATIVE flag.
2021-07-03 14:28:28 +02:00

51 lines
1.4 KiB
C++

#include "vulkan_loader.h"
namespace dxvk::vk {
static const PFN_vkGetInstanceProcAddr GetInstanceProcAddr = vkGetInstanceProcAddr;
PFN_vkVoidFunction LibraryLoader::sym(const char* name) const {
return dxvk::vk::GetInstanceProcAddr(nullptr, name);
}
InstanceLoader::InstanceLoader(bool owned, VkInstance instance)
: m_instance(instance), m_owned(owned) { }
PFN_vkVoidFunction InstanceLoader::sym(const char* name) const {
return dxvk::vk::GetInstanceProcAddr(m_instance, name);
}
DeviceLoader::DeviceLoader(bool owned, VkInstance instance, VkDevice device)
: m_getDeviceProcAddr(reinterpret_cast<PFN_vkGetDeviceProcAddr>(
dxvk::vk::GetInstanceProcAddr(instance, "vkGetDeviceProcAddr"))),
m_device(device), m_owned(owned) { }
PFN_vkVoidFunction DeviceLoader::sym(const char* name) const {
return m_getDeviceProcAddr(m_device, name);
}
LibraryFn::LibraryFn() { }
LibraryFn::~LibraryFn() { }
InstanceFn::InstanceFn(bool owned, VkInstance instance)
: InstanceLoader(owned, instance) { }
InstanceFn::~InstanceFn() {
if (m_owned)
this->vkDestroyInstance(m_instance, nullptr);
}
DeviceFn::DeviceFn(bool owned, VkInstance instance, VkDevice device)
: DeviceLoader(owned, instance, device) { }
DeviceFn::~DeviceFn() {
if (m_owned)
this->vkDestroyDevice(m_device, nullptr);
}
}