PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN Callback

Creates a device that represents the display adapter, specifying a swap chain.

Syntax

typedef HRESULT (*PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN)(
         IDXGIAdapter *pAdapter,
         D3D_DRIVER_TYPE DriverType,
         HMODULE Software,
         UINT Flags,
         const D3D_FEATURE_LEVEL *pFeatureLevels,
         const D3D_FEATURE_LEVEL *pFeatureLevels,
         UINT FeatureLevels,
         UINT SDKVersion,
         const DXGI_SWAP_CHAIN_DESC *pSwapChainDesc,
         IDXGISwapChain **ppSwapChain,
         ID3D11Device **ppDevice,
         D3D_FEATURE_LEVEL *pFeatureLevel,
         ID3D11DeviceContext **ppImmediateContext
)  

Parameters

pAdapter
Type: IDXGIAdapter *

[in, optional] A pointer to the video adapter to use when creating a device. Pass NULL to use the default adapter, which is the first adapter that is enumerated by IDXGIFactory::EnumAdapters or IDXGIFactory1::EnumAdapters1.

Note

  Do not mix the use of DXGI 1.0 (IDXGIFactory) and DXGI 1.1 (IDXGIFactory1) in an application. Use IDXGIFactory or IDXGIFactory1, but not both in an application.

DriverType
Type: D3D_DRIVER_TYPE 

The D3D_DRIVER_TYPE, which represents the driver type to create.

Software
Type: HMODULE 

A handle to a DLL that implements a software rasterizer. If DriverType is D3D_DRIVER_TYPE_SOFTWARE, Software must not be NULL. Get the handle by calling LoadLibrary, LoadLibraryEx , or GetModuleHandle.

Flags
Type: UINT 

The runtime layers to enable (see D3D11_CREATE_DEVICE_FLAG); values can be bitwise OR’d together.

pFeatureLevels
Type: D3D_FEATURE_LEVEL *

[in, optional] A pointer to an array of D3D_FEATURE_LEVELs, which determine the order of feature levels to attempt to create. If pFeatureLevels is set to NULL, this function uses the following array of feature levels:

{
  D3D_FEATURE_LEVEL_11_0,
  D3D_FEATURE_LEVEL_10_1,
  D3D_FEATURE_LEVEL_10_0,
  D3D_FEATURE_LEVEL_9_3,
  D3D_FEATURE_LEVEL_9_2,
  D3D_FEATURE_LEVEL_9_1,
};  

Note If the Direct3D 11.1 runtime is present on the computer and pFeatureLevels is set to NULL, this function won’t create a D3D_FEATURE_LEVEL_11_1 device. To create a D3D_FEATURE_LEVEL_11_1 device, you must explicitly provide a D3D_FEATURE_LEVEL array that includes D3D_FEATURE_LEVEL_11_1. If you provide a D3D_FEATURE_LEVEL array that contains D3D_FEATURE_LEVEL_11_1 on a computer that doesn’t have the Direct3D 11.1 runtime installed, this function immediately fails with E_INVALIDARG.

pFeatureLevels
Type: D3D_FEATURE_LEVEL *

[in, optional] The feature levels, as a pointer to D3D_FEATURE_LEVEL.

FeatureLevels
Type: UINT 

The number of elements in pFeatureLevels.

SDKVersion
Type: UINT 

The SDK version; use D3D11_SDK_VERSION.

pSwapChainDesc
Type: DXGI_SWAP_CHAIN_DESC *

[in, optional] The swap chain description, as a pointer to DXGI_SWAP_CHAIN_DESC.

ppSwapChain
Type: IDXGISwapChain **

[out, optional] The swap chain, as a pointer to pointer to IDXGISwapChain.

ppDevice
Type: ID3D11Device **

[out, optional] Returns the address of a pointer to an ID3D11Device object that represents the device created.

pFeatureLevel
Type: D3D_FEATURE_LEVEL *

[out, optional] If successful, returns the first D3D_FEATURE_LEVEL from the pFeatureLevels array which succeeded. Otherwise, returns 0.

ppImmediateContext
Type: ID3D11DeviceContext **

[out, optional] Returns the address of a pointer to an ID3D11DeviceContext object that represents the device context.

Return value

Type: HRESULT 

One of the Direct3D 11 return codes.

Requirements

Header: Declared in d3d11_x.h (d3d11.h on other Windows platforms).

Library: Use d3d11_x.lib (d3d11.lib on other Windows platforms).

See also

D3D11CreateDeviceAndSwapChain