mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[vr] Query required device extensions during instance creation
After the DXGI device refactor in c5deedef2dcc920f29061c50e097f66a32f1f05e, device extensions required for OpenVR interop would not be enabled correctly because the VR-related code is now being called from both the D3D11 and DXGI DLLs rather than just the DXGI DLL, and the D3D11 one is not in the expected state when querying required device extensions. Querying them during instance creation fixes that problem as it moves the relevant code back to the same DLL which creates the Vulkan instance.
This commit is contained in:
parent
f638689b2a
commit
652525119f
@ -208,6 +208,11 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkAdapter::enableExtensions(const DxvkNameSet& extensions) {
|
||||
m_extraExtensions.merge(extensions);
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkDevice> DxvkAdapter::createDevice(DxvkDeviceFeatures enabledFeatures) {
|
||||
DxvkDeviceExtensions devExtensions;
|
||||
|
||||
@ -237,7 +242,7 @@ namespace dxvk {
|
||||
throw DxvkError("DxvkAdapter: Failed to create device");
|
||||
|
||||
// Enable additional extensions if necessary
|
||||
extensionsEnabled.merge(g_vrInstance.getDeviceExtensions(getAdapterIndex()));
|
||||
extensionsEnabled.merge(m_extraExtensions);
|
||||
DxvkNameList extensionNameList = extensionsEnabled.toNameList();
|
||||
|
||||
Logger::info("Enabled device extensions:");
|
||||
@ -460,16 +465,6 @@ namespace dxvk {
|
||||
m_vki->vkGetPhysicalDeviceQueueFamilyProperties(
|
||||
m_handle, &numQueueFamilies, m_queueFamilies.data());
|
||||
}
|
||||
|
||||
|
||||
uint32_t DxvkAdapter::getAdapterIndex() const {
|
||||
for (uint32_t i = 0; m_instance->enumAdapters(i) != nullptr; i++) {
|
||||
if (m_instance->enumAdapters(i).ptr() == this)
|
||||
return i;
|
||||
}
|
||||
|
||||
return ~0u;
|
||||
}
|
||||
|
||||
|
||||
void DxvkAdapter::logNameList(const DxvkNameList& names) {
|
||||
|
@ -182,6 +182,17 @@ namespace dxvk {
|
||||
bool checkFeatureSupport(
|
||||
const DxvkDeviceFeatures& required) const;
|
||||
|
||||
/**
|
||||
* \brief Enables extensions for this adapter
|
||||
*
|
||||
* When creating a device, all extensions that
|
||||
* are added using this method will be enabled
|
||||
* in addition to the ones required by DXVK.
|
||||
* This is used for OpenVR support.
|
||||
*/
|
||||
void enableExtensions(
|
||||
const DxvkNameSet& extensions);
|
||||
|
||||
/**
|
||||
* \brief Creates a DXVK device
|
||||
*
|
||||
@ -244,6 +255,7 @@ namespace dxvk {
|
||||
Rc<vk::InstanceFn> m_vki;
|
||||
VkPhysicalDevice m_handle;
|
||||
|
||||
DxvkNameSet m_extraExtensions;
|
||||
DxvkNameSet m_deviceExtensions;
|
||||
DxvkDeviceInfo m_deviceInfo;
|
||||
DxvkDeviceFeatures m_deviceFeatures;
|
||||
@ -258,8 +270,6 @@ namespace dxvk {
|
||||
void queryDeviceFeatures();
|
||||
void queryDeviceQueues();
|
||||
|
||||
uint32_t getAdapterIndex() const;
|
||||
|
||||
static void logNameList(const DxvkNameList& names);
|
||||
|
||||
};
|
||||
|
@ -23,6 +23,11 @@ namespace dxvk {
|
||||
m_adapters = this->queryAdapters();
|
||||
g_vrInstance.initDeviceExtensions(this);
|
||||
|
||||
for (uint32_t i = 0; i < m_adapters.size(); i++) {
|
||||
m_adapters[i]->enableExtensions(
|
||||
g_vrInstance.getDeviceExtensions(i));
|
||||
}
|
||||
|
||||
m_options = DxvkOptions(m_config);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user