1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[dxvk] Move extension provider list to DxvkInstance

This commit is contained in:
Philip Rebohle 2019-11-11 23:30:07 +01:00
parent 6948d18f5f
commit 9f66351b82
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 14 additions and 40 deletions

View File

@ -1,17 +0,0 @@
#include "dxvk_extension_provider.h"
#include "dxvk_openvr.h"
#include "dxvk_platform_exts.h"
namespace dxvk {
DxvkExtensionProviderList DxvkExtensionProvider::s_extensionProviders = {
&DxvkPlatformExts::s_instance,
&VrInstance::s_instance,
};
const DxvkExtensionProviderList& DxvkExtensionProvider::getExtensionProviders() {
return s_extensionProviders;
}
}

View File

@ -11,8 +11,6 @@ namespace dxvk {
class DxvkInstance;
class DxvkExtensionProvider;
using DxvkExtensionProviderList = std::vector<DxvkExtensionProvider*>;
/**
* \brief Extension provider base
*
@ -64,15 +62,6 @@ namespace dxvk {
virtual void initDeviceExtensions(
const DxvkInstance* instance) = 0;
/**
* \brief Get list of ptrs to the extension providers
*/
static const DxvkExtensionProviderList& getExtensionProviders();
private:
static DxvkExtensionProviderList s_extensionProviders;
};
}

View File

@ -1,7 +1,8 @@
#include <version.h>
#include "dxvk_instance.h"
#include "dxvk_extension_provider.h"
#include "dxvk_openvr.h"
#include "dxvk_platform_exts.h"
#include <algorithm>
@ -15,13 +16,16 @@ namespace dxvk {
m_config.merge(Config::getAppConfig(env::getExePath()));
m_config.logOptions();
const auto& extProviders = DxvkExtensionProvider::getExtensionProviders();
m_options = DxvkOptions(m_config);
m_extProviders.push_back(&DxvkPlatformExts::s_instance);
m_extProviders.push_back(&VrInstance::s_instance);
Logger::info("Built-in extension providers:");
for (const auto& provider : extProviders)
for (const auto& provider : m_extProviders)
Logger::info(str::format(" ", provider->getName()));
for (const auto& provider : extProviders)
for (const auto& provider : m_extProviders)
provider->initInstanceExtensions();
m_vkl = new vk::LibraryFn();
@ -29,17 +33,15 @@ namespace dxvk {
m_adapters = this->queryAdapters();
for (const auto& provider : extProviders)
for (const auto& provider : m_extProviders)
provider->initDeviceExtensions(this);
for (uint32_t i = 0; i < m_adapters.size(); i++) {
for (const auto& provider : extProviders) {
for (const auto& provider : m_extProviders) {
m_adapters[i]->enableExtensions(
provider->getDeviceExtensions(i));
}
}
m_options = DxvkOptions(m_config);
}
@ -97,11 +99,10 @@ namespace dxvk {
extensionsEnabled))
throw DxvkError("DxvkInstance: Failed to create instance");
const auto& extProviders = DxvkExtensionProvider::getExtensionProviders();
// Enable additional extensions if necessary
for (const auto& provider : extProviders)
for (const auto& provider : m_extProviders)
extensionsEnabled.merge(provider->getInstanceExtensions());
DxvkNameList extensionNameList = extensionsEnabled.toNameList();
Logger::info("Enabled instance extensions:");

View File

@ -4,6 +4,7 @@
#include "dxvk_adapter.h"
#include "dxvk_device_filter.h"
#include "dxvk_extension_provider.h"
#include "dxvk_options.h"
namespace dxvk {
@ -105,6 +106,7 @@ namespace dxvk {
Rc<vk::LibraryFn> m_vkl;
Rc<vk::InstanceFn> m_vki;
std::vector<DxvkExtensionProvider*> m_extProviders;
std::vector<Rc<DxvkAdapter>> m_adapters;
VkInstance createInstance();

View File

@ -98,7 +98,6 @@ dxvk_src = files([
'dxvk_stats.cpp',
'dxvk_unbound.cpp',
'dxvk_util.cpp',
'dxvk_extension_provider.cpp',
'platform/dxvk_win32_exts.cpp',