The main command submission primitive in Direct3D 11 used to be the ID3D11DeviceContext
, but this concept has been replaced in Direct3D 12 by two primitives: ID3D12GraphicsCommandList
and ID3D12CommandQueue
.
ID3D12GraphicsCommandList
is the closest analogue to the D3D11 device context. This takes all draw commands and binding instructions. One major difference, however, is the way command lists are managed. The ID3D11DeviceContext
queued commands and sent them to the driver for execution as soon as possible. The command list on the other hand records commands for explicit submission. This means the commands are not executed until the command list is submitted, but allows the command list to be submitted multiple times.
The ID3D12CommandQueue
is a new construct that represents the ability of a GPU to execute multiple jobs at once. Various architectures have the capabilities to do graphics, compute and copy commands simultaneously. In Direct3D 11, this was managed by the driver based on the commands submitted by the user. In Direct3D 12, this can be managed by the user to utilize the capabilities of multiple simultaneous jobs effectively.
All jobs submitted to the command queue are executed in-order, but multiple queues are not guaranteed to be synchronized between one another implicitly. These can be explicitly synchronized through the use of barriers, which will be covered in the Synchronization chapter.