typedef struct D3D12_FEATURE_DATA_FEATURE_LEVELS {
_Inout_ D3D_FEATURE_LEVEL *pFeatureLevelsRequested;
UINT NumFeatureLevels;
_Out_ D3D_FEATURE_LEVEL MaxSupportedFeatureLevel;
} D3D12_FEATURE_DATA_FEATURE_LEVELS;
结构成员的含义如下:
- pFeatureLevelsRequested: 一个指向所请求的 Direct3D 特性级别数组的指针。函数将返回硬件支持的最高级别的特性级别。
- NumFeatureLevels: 请求的特性级别数组中的元素数量。
- MaxSupportedFeatureLevel: 输出参数,返回硬件支持的最高特性级别。
你可以使用这个结构查询硬件设备所支持的特性级别,例如:
D3D_FEATURE_LEVEL featureLevels[] = {
D3D_FEATURE_LEVEL_11_1,
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1
};
D3D12_FEATURE_DATA_FEATURE_LEVELS featureLevelsData = {};
featureLevelsData.pFeatureLevelsRequested = featureLevels;
featureLevelsData.NumFeatureLevels = ARRAYSIZE(featureLevels);
HRESULT hr = pDevice->CheckFeatureSupport(D3D12_FEATURE_FEATURE_LEVELS, &featureLevelsData, sizeof(featureLevelsData));
if (SUCCEEDED(hr)) {
// 查询成功,MaxSupportedFeatureLevel 中包含了硬件支持的最高特性级别
D3D_FEATURE_LEVEL maxSupportedFeatureLevel = featureLevelsData.MaxSupportedFeatureLevel;
// 其他处理...
} else {
// 查询失败,处理错误...
}
这个结构在查询设备支持的特性级别时非常有用。
转载请注明出处:http://www.pingtaimeng.com/article/detail/25934/Win32 API/D3d12.h/D3D12_FEATURE_DATA_FEATURE_LEVELS