D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT是否可以与D3D_FEATURE_LEVEL_11_0一起传递? [英] Can D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT be passed with D3D_FEATURE_LEVEL_11_0?
问题描述
MSDN on D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT 说:
Direct3D 11:直到Direct3D 11.1才支持此值.
Direct3D 11: This value is not supported until Direct3D 11.1.
这是指运行时版本还是功能级别?
Does this mean runtime version or feature level?
我可以将标志传递给 D3D11CreateDevice ,但仅通过功能级别11_0?
Can I pass the flag to D3D11CreateDevice but only pass feature level 11_0?
功能级别是否无关紧要,仅取决于安装的运行时版本?如果将标志传递给DX运行时11.0,会发生什么情况?会被默默地忽略吗?还是我首先必须以某种方式检测DX运行时版本,然后仅在DX运行时版本至少为11.1时才通过标志?
Is the feature level irrelevant and it just depends on the installed runtime version? What happens if I pass the flag to a DX runtime 11.0? Will it just be ignored silently? Or do I first have to detect the DX runtime version somehow, and then pass the flag only if the DX runtime version is at least 11.1?
推荐答案
确定您是否具有Direct3D 11.1运行时的正确"方法如下:
The 'correct' way to determine if you have the Direct3D 11.1 Runtime would be as follows:
#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
.如果是真的,那么可以放心使用D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT
这样的标志,它要求Direct3D 11.1运行时
You then call IsDirect3D11_1OrGreater
. If it's true, then you are safe to use a flag like D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT
that requires the Direct3D 11.1 Runtime
请记住,您当然不应该使用
D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT
.实际上,它仅应用于大量占用GPU的DirectCompute程序,这些程序会大量占用GPU,并可能导致系统对UI失去响应.谨慎使用.
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.
这还意味着您的应用程序需要Direct3D功能级别11.0或更高版本才能使用DirectCompute 5.0-或-它需要Direct3D功能级别10.0并需要执行CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, ...)
调用并验证D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x
是否对DirectCompute正确4.0.
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,那么您应该告诉用户:
If IsDirect3D11_1OrGreater
returns false, then you should tell the user:
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和Windows 7 和 DirectX 11.1和Windows 7更新.
这篇关于D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT是否可以与D3D_FEATURE_LEVEL_11_0一起传递?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!