[d3d11] Move maximum feature level check to D3D11DeviceFeatures

This commit is contained in:
Philip Rebohle 2022-09-03 23:39:51 +02:00
parent c082e7f0a9
commit 882072e134
4 changed files with 50 additions and 53 deletions

View File

@ -1824,28 +1824,8 @@ namespace dxvk {
if (entry != s_featureLevels.end())
return entry->second;
// Check Feature Level 11_0 features
if (!features.core.features.drawIndirectFirstInstance
|| !features.core.features.fragmentStoresAndAtomics
|| !features.core.features.multiDrawIndirect
|| !features.core.features.tessellationShader)
return D3D_FEATURE_LEVEL_10_1;
// Check Feature Level 11_1 features
if (!features.core.features.logicOp
|| !features.core.features.variableMultisampleRate
|| !features.core.features.vertexPipelineStoresAndAtomics)
return D3D_FEATURE_LEVEL_11_0;
// Check Feature Level 12_0 features
D3D11_TILED_RESOURCES_TIER tiledResourcesTier = DetermineTiledResourcesTier(
Adapter->features(),
Adapter->devicePropertiesExt());
if (tiledResourcesTier < D3D11_TILED_RESOURCES_TIER_2)
return D3D_FEATURE_LEVEL_11_1;
return D3D_FEATURE_LEVEL_12_0;
// Otherwise, check the actually available device features
return D3D11DeviceFeatures::GetMaxFeatureLevel(Instance, Adapter);
}
@ -2368,33 +2348,6 @@ namespace dxvk {
}
D3D11_TILED_RESOURCES_TIER D3D11Device::DetermineTiledResourcesTier(
const DxvkDeviceFeatures& Features,
const DxvkDeviceInfo& Properties) {
if (!Features.core.features.sparseBinding
|| !Features.core.features.sparseResidencyBuffer
|| !Features.core.features.sparseResidencyImage2D
|| !Features.core.features.sparseResidencyAliased
|| !Properties.core.properties.sparseProperties.residencyStandard2DBlockShape)
return D3D11_TILED_RESOURCES_NOT_SUPPORTED;
if (!Features.core.features.shaderResourceResidency
|| !Features.core.features.shaderResourceMinLod
|| !Features.vk12.samplerFilterMinmax
|| !Properties.vk12.filterMinmaxSingleComponentFormats
|| !Properties.core.properties.sparseProperties.residencyNonResidentStrict
|| Properties.core.properties.sparseProperties.residencyAlignedMipSize)
return D3D11_TILED_RESOURCES_TIER_1;
if (!Features.core.features.sparseResidencyImage3D
|| !Properties.core.properties.sparseProperties.residencyStandard3DBlockShape)
return D3D11_TILED_RESOURCES_TIER_2;
return D3D11_TILED_RESOURCES_TIER_3;
}
D3D11DeviceExt::D3D11DeviceExt(
D3D11DXGIDevice* pContainer,

View File

@ -494,10 +494,6 @@ namespace dxvk {
UINT Subresource,
const D3D11_BOX* pBox);
static D3D11_TILED_RESOURCES_TIER DetermineTiledResourcesTier(
const DxvkDeviceFeatures& Features,
const DxvkDeviceInfo& Properties);
};

View File

@ -177,6 +177,14 @@ namespace dxvk {
}
D3D_FEATURE_LEVEL D3D11DeviceFeatures::GetMaxFeatureLevel(
const Rc<DxvkInstance>& Instance,
const Rc<DxvkAdapter>& Adapter) {
D3D11DeviceFeatures features(Instance, Adapter, D3D_FEATURE_LEVEL_12_1);
return features.GetMaxFeatureLevel();
}
D3D11_CONSERVATIVE_RASTERIZATION_TIER D3D11DeviceFeatures::DetermineConservativeRasterizationTier(
D3D_FEATURE_LEVEL FeatureLevel) {
if (FeatureLevel < D3D_FEATURE_LEVEL_11_1
@ -265,4 +273,31 @@ namespace dxvk {
return TRUE;
}
D3D_FEATURE_LEVEL D3D11DeviceFeatures::GetMaxFeatureLevel() const {
// Check Feature Level 11_0 features
if (!m_features.core.features.drawIndirectFirstInstance
|| !m_features.core.features.fragmentStoresAndAtomics
|| !m_features.core.features.multiDrawIndirect
|| !m_features.core.features.tessellationShader)
return D3D_FEATURE_LEVEL_10_1;
// Check Feature Level 11_1 features
if (!m_d3d11Options.OutputMergerLogicOp
|| !m_features.core.features.vertexPipelineStoresAndAtomics)
return D3D_FEATURE_LEVEL_11_0;
// Check Feature Level 12_0 features
if (m_d3d11Options2.TiledResourcesTier < D3D11_TILED_RESOURCES_TIER_2
|| !m_d3d11Options2.TypedUAVLoadAdditionalFormats)
return D3D_FEATURE_LEVEL_11_1;
// Check Feature Level 12_1 features
if (!m_d3d11Options2.ConservativeRasterizationTier
|| !m_d3d11Options2.ROVsSupported)
return D3D_FEATURE_LEVEL_12_0;
return D3D_FEATURE_LEVEL_12_1;
}
}

View File

@ -54,6 +54,17 @@ namespace dxvk {
return m_d3d11Options2.ConservativeRasterizationTier;
}
/**
* \brief Tests maximum supported feature level
*
* \param [in] Instance DXVK instance
* \param [in] Adapter DXVK adapter
* \returns Highest supported feature level
*/
static D3D_FEATURE_LEVEL GetMaxFeatureLevel(
const Rc<DxvkInstance>& Instance,
const Rc<DxvkAdapter>& Adapter);
private:
DxvkDeviceFeatures m_features;
@ -100,6 +111,8 @@ namespace dxvk {
const Rc<DxvkAdapter>& Adapter,
D3D_FEATURE_LEVEL FeatureLevel);
D3D_FEATURE_LEVEL GetMaxFeatureLevel() const;
};
}