Is there a Direct 3D equivalent of glxinfo?
Asked Answered
P

4

5

I need to make sure my machine can create a D3D window before even trying to open it. How can I do so?

Poss answered 3/11, 2011 at 16:16 Comment(1)
Which version of DirectX are you using?Underpay
P
5

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).

Poss answered 7/11, 2011 at 10:24 Comment(0)
P
4

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.

Pubes answered 3/11, 2011 at 16:19 Comment(0)
H
4

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.

Haukom answered 3/11, 2011 at 19:51 Comment(2)
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
W
1

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;
}
Westerman answered 26/2, 2013 at 18:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.