Trying to create D3D11 device with reference driver fails with error code 0x887a0004

Alexandre Miguel 21 Reputation points
2021-01-05T14:24:35.973+00:00

Hello. I hope this is the right place to ask about this.

I'm very new to Direct3D, and I'm trying to create a D3D11 device with a reference driver for software rendering. Now, I don't really need a reference driver, but I'd still like to understand why the call fails, giving me error code 0x887a0004, and telling me the device interface + feature level is not supported. Here's the code:

UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;  
  
#if defined(_DEBUG)  
    creationFlags |= D3D11_CREATE_DEVICE_DEBUG;  
#endif  
  
    D3D_FEATURE_LEVEL featureLevels[] =  
    {  
        D3D_FEATURE_LEVEL_11_1,  
        D3D_FEATURE_LEVEL_11_0,  
        D3D_FEATURE_LEVEL_10_1,  
        D3D_FEATURE_LEVEL_10_0,  
        D3D_FEATURE_LEVEL_9_3,  
        D3D_FEATURE_LEVEL_9_1  
    };  
  
    ID3D11Device* d3dDevice;  
    ID3D11DeviceContext* d3dDeviceContext;  
    HRESULT result = D3D11CreateDevice(  
        nullptr,   
        D3D_DRIVER_TYPE_REFERENCE,  
        nullptr,   
        creationFlags,  
        featureLevels,  
        ARRAYSIZE(featureLevels),  
        D3D11_SDK_VERSION,  
        &d3dDevice,  
        nullptr,  
        &d3dDeviceContext  
    );  

This same code returns S_OK if I instead create a hardware driver with D3D_DRIVER_TYPE_HARDWARE, so I don't think this failure is due to my computer not supporting D3D11 (very recent gpu as well). I also read here that D3D_DRIVER_TYPE_REFERENCE should work on all feature levels on D3D11.1, but I'm not entirely sure how to create a D3D11.1 device in the first place. I thought adding D3D_FEATURE_LEVEL_11_1 to the featureLevels list would be enough, but I'm not sure. Also it may be worth mentioning that I have COM initialized.

So what am I missing here, and what articles should I be looking at to help me understand this?

Thank you in advance.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,585 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rita Han - MSFT 2,161 Reputation points
    2021-01-06T05:34:01.367+00:00

    Hello @Alexandre Miguel ,

    I can reproduce this issue. The reason is missing D3D11Ref.dll.

    You can check whether D3D11Ref.dll exists at C:\Windows\System32. If it is not existing, you can get it by installing Windows SDK 8.1 (tested and works for me).

    Thank you!


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.