Device and device context

In Direct3D 11 there are two main device objects:

  • ID3D11Device
  • ID3D11DeviceContext

The ID3D11Device object is responsible for initialization and resource management. It is the general interface for anything that is not directly related to instructing the hardware what to do, but rather to set up for the hardware instructions.

The ID3D11DeviceContext object is responsible for submitting rendering and compute work for the hardware to process. The device context acts as a queue: Most commands submitted are not guaranteed to be completed when the call to the function is done, as they are processed on the hardware rather than the CPU. Care should be used in submitting commands that might require the application to wait for the GPU to be done processing, for instance by mapping a resource for reading on the CPU.

The device and device context are the objects most commonly replaced by newer versions in newer versions of Direct3D 11. A list of types follows:

API version Max device version Max device context version
11.0 ID3D11Device D3D11DeviceContext
11.1 ID3D11Device1 D3D11DeviceContext1
11.2 ID3D11Device2 D3D11DeviceContext2
11.3 ID3D11Device3 D3D11DeviceContext3
11.4 ID3D11Device4 D3D11DeviceContext3

Using a higher API version still allows the use of lower device- and device context versions, but lower API versions will not be able to use higher device- and device context versions. As such, it is to be considered best practice to determine the minimum set of features you require, and use the minimum device version you can.