Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

D3D10CreateDevice function

Create a Direct3D 10.0 device that represents the display adapter.

Syntax


HRESULT D3D10CreateDevice(
  _In_   IDXGIAdapter *pAdapter,
  _In_   D3D10_DRIVER_TYPE DriverType,
  _In_   HMODULE Software,
  _In_   UINT Flags,
  _In_   UINT SDKVersion,
  _Out_  ID3D10Device **ppDevice
);

Parameters

pAdapter [in]

Type: IDXGIAdapter*

Pointer to the display adapter (see IDXGIAdapter) 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 EnumAdapters.

DriverType [in]

Type: D3D10_DRIVER_TYPE

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

Software [in]

Type: HMODULE

Reserved. Set to NULL.

Flags [in]

Type: UINT

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

SDKVersion [in]

Type: UINT

Bit flag that indicates the version of the SDK. Should always be D3D10_SDK_VERSION.

ppDevice [out]

Type: ID3D10Device**

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

Return value

Type: HRESULT

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

Remarks

This example creates a reference device.



ID3D10Device* g_pd3dDevice = NULL;
D3D10CreateDevice( NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, 
    D3D10_SDK_VERSION, &g_pd3dDevice );             
      

To create a device and a swap chain at the same time, see D3D10CreateDeviceAndSwapChain.

The object returned by D3D10CreateDevice implements the IUnknown interface and can be queried for other interfaces the object supports. To retrieve the IDXGIDevice interface of the object the following code could be used.



IDXGIDevice * pDXGIDevice;
hr = g_pd3dDevice->QueryInterface(__uuidof(IDXGIDevice), (void **)&pDXGIDevice);
      

Requirements

Header

D3D10Misc.h

Library

D3D10.lib

DLL

D3D10.dll

See also

Core Functions

 

 

Community Additions

Show:
© 2014 Microsoft