-2
  1. I have issue with Error

    if (FAILED(D3D11CreateDeviceAndSwapChain(
        nullptr,
        D3D_DRIVER_TYPE_HARDWARE,
        nullptr,
        createFlags,
        requestedLevels,
        sizeof(requestedLevels) / sizeof(D3D_FEATURE_LEVEL),
        D3D11_SDK_VERSION,
        &scd,
        &pSwapChain,
        &pDevice,
        &obtainedLevel,
        &pContext)))
    {
        MessageBox(hWnd, "Failed to create directX device and swapchain!", 
             "Error", MB_ICONERROR);
        return NULL;
    }
    

The Message Show Up all Times on use the .dll file

I have reinstalled DirectX and Nvidia driver. What is the next Step? (Other Computer working fine)

Asesh
  • 3,186
  • 2
  • 21
  • 31
  • What are the requested feature levels, creation flags, description of your swap chain etc. You are no posting enough code and what type of HRESULT value does D3D11CreateDeviceAndSwapChain return? – Asesh Oct 10 '17 at 03:13
  • https://pastebin.com/4hMvjhP5 – Markus Blubb Oct 10 '17 at 06:51
  • can you edit your post instead? Like I said you have not posted enough code – Asesh Oct 10 '17 at 06:52

1 Answers1

1

The most likely cause is that you have set the D3D11_CREATE_DEVICE_DEBUG creation flag but your system does not have the Direct3D Debug Device installed. Running the legacy DirectX SDK doesn't work on Windows 7 SP1 with DirectX 11.1 or later to get the developer runtime.

As noted in the comments above, the HRESULT value you get back from this function would have given a hint as to the cause, but you failed to output it in your code snippet.

The way you do get the debug device on your system depends on exactly which OS you are running. See this post for a full list. If you are running Windows 10, for example, no SDK installs it and instead you must enable the Graphics Tools "Feature On Demand".

Other possible causes here would be:

  • There's no device on your system that supports your requestedLevels list of Direct3D Hardware Feature levels

  • You have passed some invalid set of input parameters to either the device or swap chain creation--another reason to use the more modern approach of creating the swap chain independent of the device creation. Note that D3D11CreateDeviceAndSwapChain is a legacy function, so likely whatever material you are using as a tutorial is also outdated. See Anatomy of Direct3D 11 Create Device

If you are new to DirectX development, I recommend taking a look at the DirectX Tool Kit tutorials.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81