I need to make sure my machine can create a D3D window before even trying to open it. How can I do so?
Is there a Direct 3D equivalent of glxinfo?
Asked Answered
I've found the equivalent of glxinfo
for directX -- it's called dxdiag and is provided by Microsoft. This lets you output an xml file with a D3dStatus
field (which says "not available" in my case).
You probably want to take a look at DeviceCaps. It should be able to tell you the capabilities of the device so that you don't try to create a window that it doesn't support.
Actually glxinfo does create a OpenGL window and creates a OpenGL context, but never maps it to the screen. One must create a OpenGL context to get all the information, like glxinfo does.
Great comment, but doesn't answer the question about D3D. –
Audrit
@MatthewRead: The OP asked about getting GPU information without context creation. He assumed glxinfo would gather its information without create a window. To which I replied, that glxinfo actually does the usual thing. I think it's not very hard to think about the logical step of doing the same with Direct3D; trying to create a Direct3D window/context to see what the machine can actually do. –
Haukom
If you use Direct3D11 you can use this code
// Determines feature level without creating a device.
D3D_FEATURE_LEVEL determineHighestSupportedFeatureLevel()
{
HRESULT hr = E_FAIL;
D3D_FEATURE_LEVEL FeatureLevel;
hr = D3D11CreateDevice(
nullptr,
D3D_DRIVER_TYPE_HARDWARE,
nullptr,
0,
nullptr,
0,
D3D11_SDK_VERSION,
nullptr,
&FeatureLevel,
nullptr );
if(FAILED(hr))
{
throw std::runtime_exception("Determine the highest supported Direct3D11 feature level failed.");
}
return FeatureLevel;
}
© 2022 - 2024 — McMap. All rights reserved.