Direct3D11 Device(设备对象),Device Context(设备上下文)官方SDK翻译

来源:互联网 发布:淘宝上大麻种子 编辑:程序博客网 时间:2024/04/30 22:04

Dx11Device

官方SDK翻译

作者:CYM

时间:2012/5/19

Device(设备对象)

Adevice is used to create resources and to enumerate the capabilities of adisplay adapter. In Direct3D 11, a device is represented with anID3D11Deviceinterface.

一个设备对象(Device)用与创建资源以及枚举一个显卡的功能,Direct3D11,一个设备用ID3D11Device接口来表示

Eachapplication must have at least one device, most applications only create onedevice. Create a device for one of the hardware drivers installed on yourmachine by callingD3D11CreateDevice orD3D11CreateDeviceAndSwapChain andspecify the driver type with theD3D_DRIVER_TYPE flag.Each device can use one or more device contexts, depending on the functionalitydesired.

每个应用程序必须拥有至少一个设备对象,绝大多数的应用程序只创建一个设备对象.你可以调用D3D11CreateDevice或者D3D11CreateDeviceAndSwapChain来创建设备对象,同时可以用D3D_DRIVER_TYPE标志来指定驱动类型(driver type).每个设备对象可以使用一个或者多个设备上下文,这取决于你想要多少功能.

Device Context(设备上下文)

Adevice context contains the circumstance or setting in which a device is used.More specifically, a device context is used to set pipeline state and generaterendering commands using the resources owned by a device. Direct3D 11implements two types of device contexts, one for immediate rendering and theother for deferred rendering; both contexts are represented with anID3D11DeviceContextinterface.

一个设备上下文(device context)包含了环境和设置.更能为具体的说一个设备上下文使用设备对象所创建的资源类设置管道状态以及建立渲染指令.Direct3D11的设备上下文有两种类型,一个是实时渲染,另外一个则是延时渲染,两种设备上下文都可以ID3D11DeviceContext来表示.

Immediate Context(实时上下文)

Animmediate context renders directly to the driver. Each device has one and onlyone immediate context which can retrieve data from the GPU. An immediatecontext can be used to immediately render (or play back) acommand list.

Thereare two ways to get an immediate context:

  • By     calling either D3D11CreateDevice orD3D11CreateDeviceAndSwapChain.
  • By     calling ID3D11Device::GetImmediateContext.

一个实时上下文将直接向驱动渲染,每个设备对象只能有一个实时上下文,这个实时上下文能够从GPU中取回数据,一个实时上下文可以用于实时渲染.

这里有两种方式去获得实时上下文:

  • 通过调用D3D11CreateDevice或者D3D11CreateDeviceAndSwapChain.
  • 通过调用 ID3D11Device::GetImmediateContext.

 

Deferred Context

Adeferred context records GPU commands into a command list. Adeferred context is primarily used for multithreading and is not necessary fora single-threaded application. A deferred context is generally used by a workerthread instead of the main rendering thread. When you create a deferredcontext, it does not inherit any state from the immediate context.

Toget a deferred context, call ID3D11Device::CreateDeferredContext.

Anycontext -- immediate or deferred -- can be used on any thread as long as thecontext is only used in one thread at a time.

一个延时上下文将记录GPU指令到一个命令列表中(comman list).一个延时上下文主要用与多线程,你不必为一个单线程程序去使用它.一个延时上下文主要用于工作线程而非主要的渲染线程.当你创建一个延时上下文时她并不会从实时上下文中继承任何状态.

你可以调用ID3D11Device::CreateDeferredContext.来创建一个延时上下文

Anycontext -- immediate or deferred -- can be used on any thread as long as thecontext is only used in one thread at a time.

 

原创粉丝点击