1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00
OpenDX/src/dxvk/dxvk_openvr.h
Philip Rebohle de29174d42
Revert "[vr] Cosmetic code cleanup"
This reverts commit a3bf90f5a3fe050ffae353f80bc5608c7c9a1244.

Crashes SuperHot VR for some reason.
2018-12-04 18:50:11 +01:00

99 lines
2.1 KiB
C++

#pragma once
#include <mutex>
#include <vector>
#include "dxvk_include.h"
namespace vr {
class IVRCompositor;
class IVRSystem;
}
namespace dxvk {
class DxvkInstance;
/**
* \brief OpenVR instance
*
* Loads Initializes OpenVR to provide
* access to Vulkan extension queries.
*/
class VrInstance {
public:
VrInstance();
~VrInstance();
/**
* \brief Query instance extensions
* \returns Instance extensions
*/
DxvkNameSet getInstanceExtensions();
/**
* \brief Query device extensions
*
* Retrieves the extensions required for a specific
* physical device. The adapter index should remain
* the same across multiple Vulkan instances.
* \param [in] adapterId Adapter index
*/
DxvkNameSet getDeviceExtensions(
uint32_t adapterId);
/**
* \brief Initializes instance extension set
*
* Should be called before creating
* the first Vulkan instance.
*/
void initInstanceExtensions();
/**
* \brief Initializes device extension sets
*
* Should be called after setting
* up the Vulkan physical devices.
* \param [in] instance DXVK instance
*/
void initDeviceExtensions(
const DxvkInstance* instance);
private:
std::mutex m_mutex;
vr::IVRCompositor* m_compositor = nullptr;
#ifdef __WINE__
void* m_ovrApi = nullptr;
#else
HMODULE m_ovrApi = nullptr;
#endif
bool m_loadedOvrApi = false;
bool m_initializedOpenVr = false;
bool m_initializedInsExt = false;
bool m_initializedDevExt = false;
DxvkNameSet m_insExtensions;
std::vector<DxvkNameSet> m_devExtensions;
DxvkNameSet queryInstanceExtensions() const;
DxvkNameSet queryDeviceExtensions(
VkPhysicalDevice adapter) const;
DxvkNameSet parseExtensionList(
const std::string& str) const;
vr::IVRCompositor* getCompositor();
void shutdown();
};
extern VrInstance g_vrInstance;
}