mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-30 20:52:11 +01:00
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.
This commit is contained in:
parent
120585c66d
commit
b9135ca0cd
@ -28,9 +28,7 @@ namespace dxvk {
|
|||||||
&& DxvkGpuVendor(devInfo.core.properties.vendorID) != DxvkGpuVendor::Amd;
|
&& DxvkGpuVendor(devInfo.core.properties.vendorID) != DxvkGpuVendor::Amd;
|
||||||
|
|
||||||
bool apitraceAttached = false;
|
bool apitraceAttached = false;
|
||||||
#ifndef __WINE__
|
|
||||||
apitraceAttached = ::GetModuleHandle("dxgitrace.dll") != nullptr;
|
apitraceAttached = ::GetModuleHandle("dxgitrace.dll") != nullptr;
|
||||||
#endif
|
|
||||||
|
|
||||||
this->apitraceMode = config.getOption<bool>("d3d11.apitraceMode", apitraceAttached);
|
this->apitraceMode = config.getOption<bool>("d3d11.apitraceMode", apitraceAttached);
|
||||||
|
|
||||||
|
@ -5,20 +5,8 @@
|
|||||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WINE__
|
|
||||||
#include <dlfcn.h>
|
|
||||||
|
|
||||||
#pragma push_macro("_WIN32")
|
|
||||||
//request UNIX ABI from openvr.hpp
|
|
||||||
#undef _WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <openvr/openvr.hpp>
|
#include <openvr/openvr.hpp>
|
||||||
|
|
||||||
#ifdef __WINE__
|
|
||||||
#pragma pop_macro("_WIN32")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using VR_InitInternalProc = vr::IVRSystem* (VR_CALLTYPE *)(vr::EVRInitError*, vr::EVRApplicationType);
|
using VR_InitInternalProc = vr::IVRSystem* (VR_CALLTYPE *)(vr::EVRInitError*, vr::EVRApplicationType);
|
||||||
using VR_ShutdownInternalProc = void (VR_CALLTYPE *)();
|
using VR_ShutdownInternalProc = void (VR_CALLTYPE *)();
|
||||||
using VR_GetGenericInterfaceProc = void* (VR_CALLTYPE *)(const char*, vr::EVRInitError*);
|
using VR_GetGenericInterfaceProc = void* (VR_CALLTYPE *)(const char*, vr::EVRInitError*);
|
||||||
@ -316,40 +304,24 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SoHandle VrInstance::loadLibrary() {
|
HMODULE VrInstance::loadLibrary() {
|
||||||
SoHandle handle = nullptr;
|
HMODULE handle = nullptr;
|
||||||
#ifdef __WINE__
|
|
||||||
// on winelib, load native openvr_api directly
|
|
||||||
if (!(handle = ::dlopen("libopenvr_api.so", RTLD_LAZY | RTLD_NOLOAD)))
|
|
||||||
handle = ::dlopen("libopenvr_api_dxvk.so", RTLD_LAZY | RTLD_LOCAL);
|
|
||||||
m_loadedOvrApi = handle != nullptr;
|
|
||||||
#else
|
|
||||||
if (!(handle = ::GetModuleHandle("openvr_api.dll"))) {
|
if (!(handle = ::GetModuleHandle("openvr_api.dll"))) {
|
||||||
handle = ::LoadLibrary("openvr_api_dxvk.dll");
|
handle = ::LoadLibrary("openvr_api_dxvk.dll");
|
||||||
m_loadedOvrApi = handle != nullptr;
|
m_loadedOvrApi = handle != nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void VrInstance::freeLibrary() {
|
void VrInstance::freeLibrary() {
|
||||||
#ifdef __WINE__
|
|
||||||
::dlclose(m_ovrApi);
|
|
||||||
#else
|
|
||||||
::FreeLibrary(m_ovrApi);
|
::FreeLibrary(m_ovrApi);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void* VrInstance::getSym(const char* sym) {
|
void* VrInstance::getSym(const char* sym) {
|
||||||
#ifdef __WINE__
|
|
||||||
return reinterpret_cast<void*>(
|
|
||||||
::dlsym(m_ovrApi, sym));
|
|
||||||
#else
|
|
||||||
return reinterpret_cast<void*>(
|
return reinterpret_cast<void*>(
|
||||||
::GetProcAddress(m_ovrApi, sym));
|
::GetProcAddress(m_ovrApi, sym));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,6 @@
|
|||||||
|
|
||||||
#include "dxvk_extension_provider.h"
|
#include "dxvk_extension_provider.h"
|
||||||
|
|
||||||
#ifdef __WINE__
|
|
||||||
using SoHandle = void*;
|
|
||||||
#else
|
|
||||||
using SoHandle = HMODULE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace vr {
|
namespace vr {
|
||||||
class IVRCompositor;
|
class IVRCompositor;
|
||||||
class IVRSystem;
|
class IVRSystem;
|
||||||
@ -52,7 +46,7 @@ namespace dxvk {
|
|||||||
dxvk::mutex m_mutex;
|
dxvk::mutex m_mutex;
|
||||||
HKEY m_vr_key = nullptr;
|
HKEY m_vr_key = nullptr;
|
||||||
vr::IVRCompositor* m_compositor = nullptr;
|
vr::IVRCompositor* m_compositor = nullptr;
|
||||||
SoHandle m_ovrApi = nullptr;
|
HMODULE m_ovrApi = nullptr;
|
||||||
|
|
||||||
bool m_no_vr;
|
bool m_no_vr;
|
||||||
bool m_loadedOvrApi = false;
|
bool m_loadedOvrApi = false;
|
||||||
@ -75,7 +69,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
SoHandle loadLibrary();
|
HMODULE loadLibrary();
|
||||||
|
|
||||||
void freeLibrary();
|
void freeLibrary();
|
||||||
|
|
||||||
|
@ -146,8 +146,8 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SoHandle DxvkXrProvider::loadLibrary() {
|
HMODULE DxvkXrProvider::loadLibrary() {
|
||||||
SoHandle handle = nullptr;
|
HMODULE handle = nullptr;
|
||||||
if (!(handle = ::GetModuleHandle("wineopenxr.dll"))) {
|
if (!(handle = ::GetModuleHandle("wineopenxr.dll"))) {
|
||||||
handle = ::LoadLibrary("wineopenxr.dll");
|
handle = ::LoadLibrary("wineopenxr.dll");
|
||||||
m_loadedOxrApi = handle != nullptr;
|
m_loadedOxrApi = handle != nullptr;
|
||||||
|
@ -5,12 +5,6 @@
|
|||||||
|
|
||||||
#include "dxvk_extension_provider.h"
|
#include "dxvk_extension_provider.h"
|
||||||
|
|
||||||
#ifdef __WINE__
|
|
||||||
using SoHandle = void*;
|
|
||||||
#else
|
|
||||||
using SoHandle = HMODULE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
class DxvkInstance;
|
class DxvkInstance;
|
||||||
@ -44,7 +38,7 @@ namespace dxvk {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
dxvk::mutex m_mutex;
|
dxvk::mutex m_mutex;
|
||||||
SoHandle m_wineOxr = nullptr;
|
HMODULE m_wineOxr = nullptr;
|
||||||
|
|
||||||
bool m_loadedOxrApi = false;
|
bool m_loadedOxrApi = false;
|
||||||
bool m_initializedInsExt = false;
|
bool m_initializedInsExt = false;
|
||||||
@ -64,7 +58,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
void shutdown();
|
void shutdown();
|
||||||
|
|
||||||
SoHandle loadLibrary();
|
HMODULE loadLibrary();
|
||||||
|
|
||||||
void freeLibrary();
|
void freeLibrary();
|
||||||
|
|
||||||
@ -72,4 +66,4 @@ namespace dxvk {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,18 +2,8 @@
|
|||||||
|
|
||||||
namespace dxvk::vk {
|
namespace dxvk::vk {
|
||||||
|
|
||||||
#if defined(__WINE__)
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
PFN_vkVoidFunction native_vkGetInstanceProcAddrWINE(VkInstance instance, const char *name);
|
|
||||||
static const PFN_vkGetInstanceProcAddr GetInstanceProcAddr = native_vkGetInstanceProcAddrWINE;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static const PFN_vkGetInstanceProcAddr GetInstanceProcAddr = vkGetInstanceProcAddr;
|
static const PFN_vkGetInstanceProcAddr GetInstanceProcAddr = vkGetInstanceProcAddr;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PFN_vkVoidFunction LibraryLoader::sym(const char* name) const {
|
PFN_vkVoidFunction LibraryLoader::sym(const char* name) const {
|
||||||
return dxvk::vk::GetInstanceProcAddr(nullptr, name);
|
return dxvk::vk::GetInstanceProcAddr(nullptr, name);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user