mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxvk] Collect info about the supported revisions of an extension
This commit is contained in:
parent
54b2001f42
commit
f5270c8522
@ -7,18 +7,25 @@ namespace dxvk {
|
||||
|
||||
|
||||
void DxvkNameSet::add(const char* pName) {
|
||||
m_names.insert(pName);
|
||||
m_names.insert({ pName, 1u });
|
||||
}
|
||||
|
||||
|
||||
void DxvkNameSet::merge(const DxvkNameSet& names) {
|
||||
for (const std::string& name : names.m_names)
|
||||
m_names.insert(name);
|
||||
for (const auto& pair : names.m_names)
|
||||
m_names.insert(pair);
|
||||
}
|
||||
|
||||
|
||||
bool DxvkNameSet::supports(const char* pName) const {
|
||||
return m_names.find(pName) != m_names.end();
|
||||
uint32_t DxvkNameSet::supports(const char* pName) const {
|
||||
auto entry = m_names.find(pName);
|
||||
|
||||
if (entry == m_names.end())
|
||||
return 0;
|
||||
|
||||
return entry->second != 0
|
||||
? entry->second
|
||||
: 1;
|
||||
}
|
||||
|
||||
|
||||
@ -32,11 +39,11 @@ namespace dxvk {
|
||||
DxvkExt* ext = ppExtensions[i];
|
||||
|
||||
if (ext->mode() != DxvkExtMode::Disabled) {
|
||||
bool supported = supports(ext->name());
|
||||
uint32_t revision = supports(ext->name());
|
||||
|
||||
if (supported) {
|
||||
if (revision != 0) {
|
||||
nameSet.add(ext->name());
|
||||
ext->enable();
|
||||
ext->enable(revision);
|
||||
} else if (ext->mode() == DxvkExtMode::Required) {
|
||||
Logger::info(str::format(
|
||||
"Required Vulkan extension ", ext->name(), " not supported"));
|
||||
@ -51,8 +58,8 @@ namespace dxvk {
|
||||
|
||||
DxvkNameList DxvkNameSet::toNameList() const {
|
||||
DxvkNameList nameList;
|
||||
for (const std::string& name : m_names)
|
||||
nameList.add(name.c_str());
|
||||
for (const auto& pair : m_names)
|
||||
nameList.add(pair.first.c_str());
|
||||
return nameList;
|
||||
}
|
||||
|
||||
@ -70,7 +77,7 @@ namespace dxvk {
|
||||
|
||||
DxvkNameSet set;
|
||||
for (uint32_t i = 0; i < entryCount; i++)
|
||||
set.m_names.insert(entries[i].layerName);
|
||||
set.m_names.insert({ entries[i].layerName, entries[i].specVersion });
|
||||
return set;
|
||||
}
|
||||
|
||||
@ -88,7 +95,7 @@ namespace dxvk {
|
||||
|
||||
DxvkNameSet set;
|
||||
for (uint32_t i = 0; i < entryCount; i++)
|
||||
set.m_names.insert(entries[i].extensionName);
|
||||
set.m_names.insert({ entries[i].extensionName, entries[i].specVersion });
|
||||
return set;
|
||||
}
|
||||
|
||||
@ -108,7 +115,7 @@ namespace dxvk {
|
||||
|
||||
DxvkNameSet set;
|
||||
for (uint32_t i = 0; i < entryCount; i++)
|
||||
set.m_names.insert(entries[i].extensionName);
|
||||
set.m_names.insert({ entries[i].extensionName, entries[i].specVersion });
|
||||
return set;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "dxvk_include.h"
|
||||
@ -60,7 +60,15 @@ namespace dxvk {
|
||||
* \returns \c true if the extension is enabled
|
||||
*/
|
||||
operator bool () const {
|
||||
return m_enabled;
|
||||
return m_revision != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Supported revision
|
||||
* \returns Supported revision
|
||||
*/
|
||||
uint32_t revision() const {
|
||||
return m_revision;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,15 +84,15 @@ namespace dxvk {
|
||||
/**
|
||||
* \brief Enables the extension
|
||||
*/
|
||||
void enable() {
|
||||
m_enabled = true;
|
||||
void enable(uint32_t revision) {
|
||||
m_revision = revision;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
const char* m_name = nullptr;
|
||||
DxvkExtMode m_mode = DxvkExtMode::Disabled;
|
||||
bool m_enabled = false;
|
||||
uint32_t m_revision = 0;
|
||||
|
||||
};
|
||||
|
||||
@ -175,9 +183,9 @@ namespace dxvk {
|
||||
* \brief Checks whether an extension is supported
|
||||
*
|
||||
* \param [in] pName Extension name
|
||||
* \returns \c true if the extension is supported
|
||||
* \returns Supported revision, or zero
|
||||
*/
|
||||
bool supports(
|
||||
uint32_t supports(
|
||||
const char* pName) const;
|
||||
|
||||
/**
|
||||
@ -238,7 +246,7 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
std::set<std::string> m_names;
|
||||
std::map<std::string, uint32_t> m_names;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user