gpt4 book ai didi

directx - D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT 可以与 D3D_FEATURE_LEVEL_11_0 一起传递吗?

转载 作者:行者123 更新时间:2023-12-01 22:28:21 24 4
gpt4 key购买 nike

MSDN on D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT说:

Direct3D 11: This value is not supported until Direct3D 11.1.

这是否意味着运行时版本或功能级别?

我可以将标志传递给 D3D11CreateDevice但仅通过功能级别 11_0?

功能级别是否无关紧要,仅取决于安装的运行时版本?如果我将标志传递给 DX 运行时 11.0 会发生什么?会不会就这样被默默无视呢?或者我是否首先必须以某种方式检测 DX 运行时版本,然后仅当 DX 运行时版本至少为 11.1 时才传递标志?

最佳答案

确定您是否拥有 Direct3D 11.1 运行时的“正确”方法如下:

#include <d3d11_1.h>
#include <wrl/client.h>

#pragma comment(lib,"d3d11.lib")

bool IsDirect3D11_1OrGreater()
{
Microsoft::WRL::ComPtr<ID3D11Device> device;

HRESULT hr = D3D11CreateDevice(
nullptr,
D3D_DRIVER_TYPE_NULL,
nullptr,
0,
nullptr,
0,
D3D11_SDK_VERSION,
device.GetAddressOf(),
nullptr,
nullptr
);

if (FAILED(hr))
return false;

Microsoft::WRL::ComPtr<ID3D11Device1> device1;
return SUCCEEDED(device.As(&device1));
}

然后您调用IsDirect3D11_1OrGreater。如果这是真的,那么您可以安全地使用需要 Direct3D 11.1 运行时的 D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT 标志

Keep in mind that you shouldn't be using D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT as a matter of course. It really only should be used for DirectCompute-heavy programs that are free to tie up the GPU a lot and potentially cause the system to become unresponsive to UI. Use it with caution.

That also implies your application will require a Direct3D Feature Level 11.0 or greater card to use DirectCompute 5.0 -or- it will require Direct3D Feature Level 10.0 and need to do a CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, ...) call and verify D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x is true for DirectCompute 4.0.

如果 IsDirect3D11_1OrGreater 返回 false,那么您应该告诉用户:

This application requires the DirectX 11.1 Runtime. It is supported on
Windows 7 Service Pack 1 with KB2670838 or later Windows operating systems.

另请参阅DirectX 11.1 and Windows 7DirectX 11.1 and Windows 7 Update .

关于directx - D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT 可以与 D3D_FEATURE_LEVEL_11_0 一起传递吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39491352/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com