I'm new to DirectX 12. I understand some of the basics.

For speed and optimization, is it better if I have more than one command queue, command list, and command allocator? If so, how many should I have of each for a high performance game?


1 Answer 1


As with all optimization advice: It depends.

The basic render loop is one D3D12_COMMAND_LIST_TYPE_DIRECT Command Queue, one Command Allocator per backbuffer swap chain (2 or 3), and each frame has one Command List (reset from the appropriate command allocator) for graphics drawing.

Beyond that is really depends on what else you are doing.

  • You can upload resources on a distinct Command Queue (typically D3D12_COMMAND_LIST_TYPE_COPY), which can let you do resource upload on another thread while rendering on a main thread.

The ResourceUploadBatch in DirectX Tool Kit for DX12 supports doing upload batches on any queue type. The main trick there is handling the resource states which are restricted on COPY and COMPUTE queues compared to DIRECT. Each instance of ResourceUploadBatch (which would be one per uploading thread) has it's own Command Allocator, and each batch of work is it's own Command List.

  • If you are using asynchronous compute, you can submit the work on it's own D3D12_COMMAND_LIST_TYPE_COMPUTE Command Queue. Again, each batch of work is it's own command list.

  • If you are doing multi-threaded rendering, you can build different command-lists on each thread. See this sample.

By design, the DirectX 12 work submission design is flexible and largely left up to the developer depending on their application's needs. See Microsoft Docs.

The optimal number of Command Queue instances of course depends on the specific GPU you are using, but typical modern GPUs have at least one "Graphics" hardware queue which maps to DIRECT, one "Compute" hardware queue which maps to "COMPUTE", and one DMA engine hardware queue which maps to "COPY".

See also directx-vs-templates.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .