【问题标题】:How do I determine the Direct3D WARP supported feature level?如何确定 Direct3D WARP 支持的功能级别?
【发布时间】:2015-02-27 13:40:59
【问题描述】:

Windows Advanced Rasterization Platform (WARP) 支持 variety of feature levels,这取决于安装的 DirectX API 版本:

  • 安装 Direct3D 11 时的功能级别 9_1、9_2、9_3、10_0 和 10_1
  • 当 Direct3D 11.1 安装在 Windows 7 上时,所有上述功能级别加上 11_0
  • 当 Direct3D 11.1 安装在 Windows 8 上时,以上所有功能级别加上 11_1

如何通过 WARP 轻松确定可用的功能级别?我知道我可以运行 ID3D11Device::GetFeatureLevel 的硬件设备,但我没有看到 WARP 的等效项。

【问题讨论】:

  • 您应该可以在使用 WARP 时调用GetFeatureLevel。你觉得这有问题吗?
  • @MooseBoys,文档说GetFeatureLevel返回“描述硬件设备功能级别的D3D_FEATURE_LEVEL枚举类型的成员。”我>

标签: direct3d direct3d11 warp


【解决方案1】:

使用来自Anatomy of Direct3D 11 Create Device 的代码,但使用 WARP 设备类型。

D3D_FEATURE_LEVEL lvl[] = {
    D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0,
    D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0 };

DWORD createDeviceFlags = 0;
#ifdef _DEBUG
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

ID3D11Device* pDevice = nullptr;
ID3D11DeviceContext* pContext = nullptr;
D3D_FEATURE_LEVEL fl;
HRESULT hr = D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_WARP, nullptr,
    createDeviceFlags, lvl, _countof(lvl),
    D3D11_SDK_VERSION, &pDevice, &fl, &pContext );
if ( hr == E_INVALIDARG )
{
    hr = D3D11CreateDevice( nullptr, D3D_DRIVER_TYPE_WARP, nullptr,
       createDeviceFlags, &lvl[1], _countof(lvl)-1,
       D3D11_SDK_VERSION, &pDevice, &fl, &pContext );
}
if ( FAILED(hr) )
    // error handling

然后检查fl看是10.1、11.0还是11.1。我们不需要在lvl 中列出 9.1、9.2 或 9.3 功能级别,因为 WARP 在 Windows 桌面 PC 上至少支持 10.1。为了稳健,我建议也列出 10.0。

【讨论】:

    猜你喜欢
    • 2017-07-31
    • 1970-01-01
    • 2012-06-25
    • 2018-09-30
    • 1970-01-01
    • 1970-01-01
    • 2016-05-05
    • 2017-11-26
    相关资源
    最近更新 更多