Device interface and Devicecontext interface for Direct3D 11

Source: Internet
Author: User

the two main interfaces of the D3D :

Device,id3d11device. create resources, shader objects, state objects, query objects, and so on. And check the hardware features, debug functions. Can be considered a provider of resources. Device Context,id3d11devicecontext. use resources. Binding resources, shader objects, state objects wait for pipelining. and control the execution of the computational flow. Immedite context. Immediate mode, for the main rendering thread, is also the main interface of the service GPU deffered context. delay mode, which provides thread-safe mechanism for the asynchronous threading model.
Create device and context:
Device can be created using the d3d11createdevice function or the d3d11createdeviceandswapchain function. the difference is that the latter can also create swap chain and return context, so the latter is preferred.
The parameter usage of D3d11createdeviceandswapchain is as follows:

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   const __IN _chain_desc *pswapchaindesc,  
 __out  idxgiswapchain **ppswapchain,  
 __out id3d11device  * * Ppdevice,  
 __out  d3d_feature_level *pfeaturelevel,  
 __out  id3d11devicecontext * * Ppimmediatecontext  
;  

*padapter: Pointing to the connection adapter, NULL uses the default video card.
Drivertype: Specifies the drive type. The value can be: D3d_driver_type_unknown, D3d_driver_type_hardware, general use of this d3d_driver_type_refernce, for software implementation D3D D3d_driver_type_ NULL, used to test d3d_driver_type_software, custom drive, usually not. D3d_driver_type_warp, supports the use of multi-core CPUs, but only for D3D 10.1. Software: If Drivertype chooses not software, this parameter is set to NULL.
Flags: Specifies the special features of the device, which can be a combination of the following values: Enum D3d11_create_device_flag
{
d3d11_create_device_singlethreaded = 0x1,//Must be single-threaded. If not set is multithreading.
D3d11_create_device_debug = 0x2,//Implement Id3d11debug interface.
D3d11_create_device_switch_to_ref = 0x4,//D3D11 does not support this option.
d3d11_create_device_prevent_internal_threading_optimizations= 0x8,//No multithreading optimizations.
D3d11_create_device_bgra_support = 0x20,//For DIRECT2D
D3d11_create_device_debuggable = 0x40,
d3d11_create_device_prevent_altering_layer_settings_from_registry= 0x80,
D3d11_create_device_disable_gpu_timeout = 0x100,
D3d11_create_device_video_support = 0x800
} D3d11_create_device_flag;

Pfeaturelevels, specifies the functional level of the D3D to support. Can be a combination of the following values: D3d_feature_level_11_1, 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 sdkversion, use D3d11 in D3d11_sdk_version
Pswapchaindesc,swap chain is an object created by Dxgi. This pointer points to the description of the swap chain, primarily the initialization property of the swap chain. You need to define a DXGI_SWAP_CHAIN_DESC structure body.

Ppswapchain, return to Swapchain.
Ppdevice, return to device.
Pfeaturelevel, return to Featurelevel.
Ppimmeditecontext, return to Immeditecontext.

More information on MSDN

http://msdn.microsoft.com/en-us/library/ff476083 (v=vs.85). aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.