1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 22:24:15 +01:00

[d3d119 Implemented DXVK_FEATURE_LEVEL to restrict D3D feature levels

This commit is contained in:
Philip Rebohle 2018-01-30 12:19:53 +01:00
parent 727aa4d97e
commit c22dc143d1
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 27 additions and 1 deletions

View File

@ -1361,7 +1361,7 @@ namespace dxvk {
const Rc<DxvkAdapter>& adapter,
D3D_FEATURE_LEVEL featureLevel) {
// We currently only support 11_0 interfaces
if (featureLevel > D3D_FEATURE_LEVEL_11_0)
if (featureLevel > GetMaxFeatureLevel())
return false;
// Check whether all features are supported
@ -2170,4 +2170,28 @@ namespace dxvk {
m_resourceInitCommands = 0;
}
D3D_FEATURE_LEVEL D3D11Device::GetMaxFeatureLevel() {
static const std::array<std::pair<std::string, D3D_FEATURE_LEVEL>, 6> s_featureLevels = {{
{ "11_0", D3D_FEATURE_LEVEL_11_0 },
{ "10_1", D3D_FEATURE_LEVEL_10_1 },
{ "10_0", D3D_FEATURE_LEVEL_10_0 },
{ "9_3", D3D_FEATURE_LEVEL_9_3 },
{ "9_2", D3D_FEATURE_LEVEL_9_2 },
{ "9_1", D3D_FEATURE_LEVEL_9_1 },
}};
const std::string maxLevel = env::getEnvVar(L"DXVK_FEATURE_LEVEL");
auto entry = std::find_if(s_featureLevels.begin(), s_featureLevels.end(),
[&] (const std::pair<std::string, D3D_FEATURE_LEVEL>& pair) {
return pair.first == maxLevel;
});
return entry != s_featureLevels.end()
? entry->second
: D3D_FEATURE_LEVEL_11_0;
}
}

View File

@ -333,6 +333,8 @@ namespace dxvk {
void UnlockResourceInitContext(uint64_t CommandCount);
void SubmitResourceInitCommands();
static D3D_FEATURE_LEVEL GetMaxFeatureLevel();
};
}