mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Make vk::NameSet more versatile
This commit is contained in:
parent
40b52758e3
commit
d1eddbdc3f
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user