Creates a device that represents the display adapter and a swap chain used for rendering.

Syntax

HRESULT D3D11CreateDeviceAndSwapChain
__in IDXGIAdapter *pAdapter, 
__in D3D_DRIVER_TYPE DriverType, 
__in HMODULE Software, 
__in UINT Flags, 
__in const D3D_FEATURE_LEVEL *pFeatureLevels, 
__in UINT FeatureLevels, 
__in UINT SDKVersion, 
__in const DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, 
__out IDXGISwapChain **ppSwapChain, 
__out ID3D11Device **ppDevice, 
__out D3D_FEATURE_LEVEL *pFeatureLevel, 
__out ID3D11DeviceContext **ppImmediateContext 
);

Parameters

pAdapter [in]
IDXGIAdapter

A pointer to the video adapter to use when creating a device. Pass NULL to use the default adapter, 

which is the first adapter enumerated by IDXGIFactory1::EnumAdapters.

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.

If you set the pAdapter parameter to a non-NULL value, you must also set the DriverType parameter to 

the D3D_DRIVER_TYPE_UNKNOWN value. If you set the pAdapter parameter to a non-NULL value 

and the DriverType parameter to the D3D_DRIVER_TYPE_HARDWARE value, 

D3D11CreateDeviceAndSwapChain returns an HRESULT of E_INVALIDARG.

DriverType [in]
D3D_DRIVER_TYPE

The D3D_DRIVER_TYPE, which represents the driver type to create.

Software [in]
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

The value should be non-NULL when D3D_DRIVER_TYPE is D3D_DRIVER_TYPE_SOFTWARE 

and NULL otherwise.

Flags [in]
UINT

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

pFeatureLevels [in]
D3D_FEATURE_LEVEL

A pointer to an array of D3D_FEATURE_LEVELs, which determine the order of feature levels to attempt to 

create. Use default parameters to get the greatest feature level available. If pFeatureLevels is set to NULL, 

the following array of feature levels will be used:

 { 

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, 
}; 
FeatureLevels [in]
UINT

The number of elements in pFeatureLevels.

SDKVersion [in]
UINT

The SDK version; use D3D11_SDK_VERSION.

pSwapChainDesc [in]
DXGI_SWAP_CHAIN_DESC

A pointer to a swap chain description (see DXGI_SWAP_CHAIN_DESC

that contains initialization parameters for the swap chain.

ppSwapChain [out]
IDXGISwapChain

Returns the address of a pointer to the IDXGISwapChain object 

that represents the swap chain used for rendering.

ppDevice [out]
ID3D11Device

Returns the address of a pointer to an ID3D11Device object that represents the device created. 

Supply NULL as an input to return the highest supported feature level in pFeatureLevel.

pFeatureLevel [out]
D3D_FEATURE_LEVEL

Returns a pointer to a D3D_FEATURE_LEVEL, which represents the first element in an array 

of feature levels supported by the device.

ppImmediateContext [out]
ID3D11DeviceContext

Returns the address of a pointer to an ID3D11DeviceContext object that represents the device context.

 

Return Value

HRESULT

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

Remarks

This entry-point and the D3D11.DLL requires the Direct3D 11 Runtime which is available on 

Windows 7, Windows Server 2008 R2, and as an update to Windows Vista (KB971644).

Also, see the remarks section in D3D11CreateDevice for details about input parameter dependencies. 

To create a device without creating a swap chain, use the D3D11CreateDevice function.

Requirements

Header - D3D11.h
Library - D3D11.lib
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Genius 的頭像
    Genius

    Nobody

    Genius 發表在 痞客邦 留言(0) 人氣()