D3DX10CreateDeviceAndSwapChain function

Create the best Direct3D device and a swap chain.

Syntax

HRESULT D3DX10CreateDeviceAndSwapChain(
  _In_  IDXGIAdapter         *pAdapter,
  _In_  D3D10_DRIVER_TYPE    DriverType,
  _In_  HMODULE              Software,
  _In_  UINT                 Flags,
  _In_  DXGI_SWAP_CHAIN_DESC *pSwapChainDesc,
  _Out_ IDXGISwapChain       **ppSwapChain,
  _Out_ ID3D10Device         **ppDevice
);

Parameters

pAdapter [in]

Type: IDXGIAdapter*

Pointer to a IDXGIAdapter.

DriverType [in]

Type: D3D10_DRIVER_TYPE

The type of driver for the device. See D3D10_DRIVER_TYPE.

Software [in]

Type: HMODULE

A handle to the DLL that implements a software rasterizer. Must be NULL if DriverType is non-software. The HMODULE of a DLL can be obtained with LoadLibrary, LoadLibraryEx, or GetModuleHandle.

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.

pSwapChainDesc [in]

Type: DXGI_SWAP_CHAIN_DESC*

Description of the swap chain. See DXGI_SWAP_CHAIN_DESC.

ppSwapChain [out]

Type: IDXGISwapChain**

Address of a pointer to an IDXGISwapChain.

ppDevice [out]

Type: ID3D10Device**

Address of a pointer to an ID3D10Device Interface that will receive the newly created device.

Return value

Type: HRESULT

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

Remarks

To create the best device, this method implements more than one device creation option. First, the method attempts to create a 10.1 device (and swap chain). If that fails, the method attempts to create a 10.0 device. If that fails, the method will fail. If your application needs to create only a 10.1 device, or a 10.0 device only, use these APIs instead:

This method requires Windows Vista Service Pack 1.

Requirements

Requirement Value
Header
D3DX10Core.h

See also

General Purpose Functions