D3DX10CreateDevice function

Create the best Direct3D 10 device that represents the display adapter. If a Direct3D 10.1-compatible device can be created, it will be possible to acquire an ID3D10Device1 Interface pointer from the returned device interface pointer.


HRESULT D3DX10CreateDevice(
  _In_  IDXGIAdapter      *pAdapter,
  _In_  D3D10_DRIVER_TYPE DriverType,
  _In_  HMODULE           Software,
  _In_  UINT              Flags,
  _Out_ ID3D10Device      **ppDevice


pAdapter [in]

Type: IDXGIAdapter*

Pointer to the display adapter (see the IDXGIAdapter interface) when creating a hardware device; otherwise set this parameter to NULL. If NULL is specified when creating a hardware device, Direct3D will use the first adapter enumerated by the IDXGIFactory interface.

DriverType [in]


The device-driver type (see the D3D10_DRIVER_TYPE enumeration). The driver type determines the type of device you will create.

Software [in]


A handle to a loaded module that implements a software driver (such as D3D10Ref.dll). To get a handle, call the GetModuleHandle function.

Flags [in]

Type: UINT

Device creation flags (see the D3D10_CREATE_DEVICE_FLAG enumeration) that enable API layers. These flags can be bitwise OR'd together.

ppDevice [out]

Type: ID3D10Device**

Address of a pointer to the device created (see the ID3D10Device interface).

Return value


This function returns one of the following Direct3D 10 Return Codes.


This function attempts to create the best device for the hardware. First, the function attempts to create a 10.1 device. If a 10.1 device cannot be created, the function attempts to create a 10.0 device. If neither device is successfully created, the function returns E_FAIL.

If your application needs to create only a 10.1 device, or a 10.0 device only, use the following functions instead:

A Direct3D 10.1 device can only be created on computers running Windows Vista Service Pack 1 or later, and with Direct3D 10.1-compatible hardware installed. However, it is legal to call this function on computers running any version of Windows that has the D3DX10 DLL installed.




See also

General Purpose Functions