mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-30 11:52:11 +01:00
[dxvk] Remove ability to enable instance layers
This commit is contained in:
parent
a30e1368b1
commit
7408bc22b5
@ -40,10 +40,8 @@ namespace dxvk {
|
||||
|
||||
|
||||
VkInstance DxvkInstance::createInstance() {
|
||||
auto enabledLayers = this->getLayers();
|
||||
|
||||
// Query available extensions and enable the ones that are needed
|
||||
vk::NameSet availableExtensions = vk::NameSet::enumerateInstanceExtensions(*m_vkl, enabledLayers);
|
||||
vk::NameSet availableExtensions = vk::NameSet::enumerateInstanceExtensions(*m_vkl);
|
||||
|
||||
DxvkInstanceExtensions extensionsToEnable;
|
||||
extensionsToEnable.enableExtensions(availableExtensions);
|
||||
@ -55,8 +53,6 @@ namespace dxvk {
|
||||
vk::NameSet enabledExtensionSet = extensionsToEnable.getEnabledExtensionNames();
|
||||
vk::NameList enabledExtensionList = enabledExtensionSet.getNameList();
|
||||
|
||||
Logger::info("Enabled instance layers:");
|
||||
this->logNameList(enabledLayers);
|
||||
Logger::info("Enabled instance extensions:");
|
||||
this->logNameList(enabledExtensionList);
|
||||
|
||||
@ -74,8 +70,8 @@ namespace dxvk {
|
||||
info.pNext = nullptr;
|
||||
info.flags = 0;
|
||||
info.pApplicationInfo = &appInfo;
|
||||
info.enabledLayerCount = enabledLayers.count();
|
||||
info.ppEnabledLayerNames = enabledLayers.names();
|
||||
info.enabledLayerCount = 0;
|
||||
info.ppEnabledLayerNames = nullptr;
|
||||
info.enabledExtensionCount = enabledExtensionList.count();
|
||||
info.ppEnabledExtensionNames = enabledExtensionList.names();
|
||||
|
||||
@ -86,27 +82,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
vk::NameList DxvkInstance::getLayers() {
|
||||
std::vector<const char*> layers = { };
|
||||
|
||||
if (env::getEnvVar(L"DXVK_DEBUG_LAYERS") == "1")
|
||||
layers.push_back("VK_LAYER_LUNARG_standard_validation");
|
||||
|
||||
const vk::NameSet layersAvailable
|
||||
= vk::NameSet::enumerateInstanceLayers(*m_vkl);
|
||||
|
||||
vk::NameList layersEnabled;
|
||||
for (auto l : layers) {
|
||||
if (layersAvailable.contains(l))
|
||||
layersEnabled.add(l);
|
||||
else
|
||||
throw DxvkError(str::format("Requested layer not installed: ", l));
|
||||
}
|
||||
|
||||
return layersEnabled;
|
||||
}
|
||||
|
||||
|
||||
void DxvkInstance::logNameList(const vk::NameList& names) {
|
||||
for (uint32_t i = 0; i < names.count(); i++)
|
||||
Logger::info(str::format(" ", names.name(i)));
|
||||
|
@ -48,8 +48,6 @@ namespace dxvk {
|
||||
|
||||
VkInstance createInstance();
|
||||
|
||||
vk::NameList getLayers();
|
||||
|
||||
void logNameList(const vk::NameList& names);
|
||||
|
||||
};
|
||||
|
@ -18,30 +18,19 @@ namespace dxvk::vk {
|
||||
}
|
||||
|
||||
|
||||
NameSet NameSet::enumerateInstanceLayers(const LibraryFn& vkl) {
|
||||
uint32_t layerCount = 0;
|
||||
if (vkl.vkEnumerateInstanceLayerProperties(&layerCount, nullptr) != VK_SUCCESS)
|
||||
throw DxvkError(str::format("LayerSet::enumerateInstanceLayers: Failed to query instance layers"));
|
||||
|
||||
std::vector<VkLayerProperties> layers(layerCount);
|
||||
if (vkl.vkEnumerateInstanceLayerProperties(&layerCount, layers.data()) != VK_SUCCESS)
|
||||
throw DxvkError(str::format("LayerSet::enumerateInstanceLayers: Failed to query instance layers"));
|
||||
|
||||
NameSet result;
|
||||
for (const auto& layer : layers)
|
||||
result.m_names.insert(layer.layerName);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
NameSet NameSet::enumerateInstanceExtensions(
|
||||
const LibraryFn& vkl,
|
||||
const NameList& layers) {
|
||||
NameSet result;
|
||||
result.addInstanceLayerExtensions(vkl, nullptr);
|
||||
const LibraryFn& vkl) {
|
||||
uint32_t extCount = 0;
|
||||
if (vkl.vkEnumerateInstanceExtensionProperties(nullptr, &extCount, nullptr) != VK_SUCCESS)
|
||||
throw DxvkError("ExtensionSet::addInstanceExtensions: Failed to query instance extensions");
|
||||
|
||||
for (size_t i = 0; i < layers.count(); i++)
|
||||
result.addInstanceLayerExtensions(vkl, layers.name(i));
|
||||
std::vector<VkExtensionProperties> extensions(extCount);
|
||||
if (vkl.vkEnumerateInstanceExtensionProperties(nullptr, &extCount, extensions.data()) != VK_SUCCESS)
|
||||
throw DxvkError("ExtensionSet::addInstanceExtensions: Failed to query instance extensions");
|
||||
|
||||
NameSet result;
|
||||
for (const auto& ext : extensions)
|
||||
result.add(ext.extensionName);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -64,22 +53,6 @@ namespace dxvk::vk {
|
||||
}
|
||||
|
||||
|
||||
void NameSet::addInstanceLayerExtensions(
|
||||
const LibraryFn& vkl,
|
||||
const char* layer) {
|
||||
uint32_t extCount = 0;
|
||||
if (vkl.vkEnumerateInstanceExtensionProperties(layer, &extCount, nullptr) != VK_SUCCESS)
|
||||
throw DxvkError("ExtensionSet::addInstanceExtensions: Failed to query instance extensions");
|
||||
|
||||
std::vector<VkExtensionProperties> extensions(extCount);
|
||||
if (vkl.vkEnumerateInstanceExtensionProperties(layer, &extCount, extensions.data()) != VK_SUCCESS)
|
||||
throw DxvkError("ExtensionSet::addInstanceExtensions: Failed to query instance extensions");
|
||||
|
||||
for (const auto& ext : extensions)
|
||||
this->add(ext.extensionName);
|
||||
}
|
||||
|
||||
|
||||
NameList NameSet::getNameList() const {
|
||||
NameList result;
|
||||
for (const std::string& name : m_names)
|
||||
|
@ -71,25 +71,14 @@ namespace dxvk::vk {
|
||||
*/
|
||||
bool contains(const std::string& name) const;
|
||||
|
||||
/**
|
||||
* \brief Enumerates instance layers
|
||||
*
|
||||
* \param [in] vkl Vulkan library functions
|
||||
* \returns Available instance layers
|
||||
*/
|
||||
static NameSet enumerateInstanceLayers(
|
||||
const LibraryFn& vkl);
|
||||
|
||||
/**
|
||||
* \brief Enumerates instance extensions
|
||||
*
|
||||
* \param [in] vkl Vulkan library functions
|
||||
* \param [in] layers Enabled instance layers
|
||||
* \returns Available instance extensions
|
||||
*/
|
||||
static NameSet enumerateInstanceExtensions(
|
||||
const LibraryFn& vkl,
|
||||
const NameList& layers);
|
||||
const LibraryFn& vkl);
|
||||
|
||||
/**
|
||||
* \brief Enumerates device extensions
|
||||
@ -116,10 +105,6 @@ namespace dxvk::vk {
|
||||
|
||||
std::unordered_set<std::string> m_names;
|
||||
|
||||
void addInstanceLayerExtensions(
|
||||
const LibraryFn& vkl,
|
||||
const char* layer);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user