diff --git a/src/dxvk/dxvk_extensions.cpp b/src/dxvk/dxvk_extensions.cpp index e1fd22e13..6d57c05ff 100644 --- a/src/dxvk/dxvk_extensions.cpp +++ b/src/dxvk/dxvk_extensions.cpp @@ -8,7 +8,7 @@ namespace dxvk { void DxvkExtensionList::enableExtensions(const vk::NameSet& extensions) { for (auto ext : m_extensions) { - if (extensions.supports(ext->name())) + if (extensions.contains(ext->name())) ext->setEnabled(true); } } diff --git a/src/dxvk/dxvk_instance.cpp b/src/dxvk/dxvk_instance.cpp index e4c0df357..5a817e2e4 100644 --- a/src/dxvk/dxvk_instance.cpp +++ b/src/dxvk/dxvk_instance.cpp @@ -85,7 +85,7 @@ namespace dxvk { vk::NameList layersEnabled; for (auto l : layers) { - if (layersAvailable.supports(l)) + if (layersAvailable.contains(l)) layersEnabled.add(l); else throw DxvkError(str::format("Requested layer not installed: ", l)); @@ -107,12 +107,12 @@ namespace dxvk { vk::NameList extensionsEnabled; for (auto e : extOptional) { - if (extensionsAvailable.supports(e)) + if (extensionsAvailable.contains(e)) extensionsEnabled.add(e); } for (auto e : extRequired) { - if (!extensionsAvailable.supports(e)) + if (!extensionsAvailable.contains(e)) throw DxvkError(str::format("DxvkInstance::getExtensions: Extension ", e, " not supported")); extensionsEnabled.add(e); } diff --git a/src/dxvk/vulkan/dxvk_vulkan_extensions.cpp b/src/dxvk/vulkan/dxvk_vulkan_extensions.cpp index 0b596cc89..6f7183ff6 100644 --- a/src/dxvk/vulkan/dxvk_vulkan_extensions.cpp +++ b/src/dxvk/vulkan/dxvk_vulkan_extensions.cpp @@ -2,7 +2,12 @@ namespace dxvk::vk { - bool NameSet::supports(const char* name) const { + void NameSet::add(const std::string& name) { + m_names.insert(name); + } + + + bool NameSet::contains(const std::string& name) const { return m_names.find(name) != m_names.end(); } @@ -48,7 +53,7 @@ namespace dxvk::vk { NameSet result; for (const auto& ext : extensions) - result.m_names.insert(ext.extensionName); + result.add(ext.extensionName); return result; } @@ -65,7 +70,7 @@ namespace dxvk::vk { throw DxvkError("ExtensionSet::addInstanceExtensions: Failed to query instance extensions"); for (const auto& ext : extensions) - m_names.insert(ext.extensionName); + this->add(ext.extensionName); } } diff --git a/src/dxvk/vulkan/dxvk_vulkan_extensions.h b/src/dxvk/vulkan/dxvk_vulkan_extensions.h index c8ae48ffb..6708b86df 100644 --- a/src/dxvk/vulkan/dxvk_vulkan_extensions.h +++ b/src/dxvk/vulkan/dxvk_vulkan_extensions.h @@ -51,13 +51,19 @@ namespace dxvk::vk { public: + /** + * \brief Adds an extension to the set + * \param [in] name The extension to add + */ + void add(const std::string& name); + /** * \brief Checks whether an extension or layer is supported * * \param [in] name The layer or extension name * \returns \c true if the entity is supported */ - bool supports(const char* name) const; + bool contains(const std::string& name) const; /** * \brief Enumerates instance layers