D3D12_COMMAND_LIST_TYPE_COPY for High-Bandwidth DMA
D3D12_COMMAND_LIST_TYPE_COPY provides a specialized
execution path in DirectX 12 designed explicitly for memory transfers
between host memory and GPU memory or across different GPU resources. By
targeting dedicated hardware Direct Memory Access (DMA) engines, copy
command lists allow high-bandwidth streaming of textures, geometry, and
buffers completely in parallel with rendering and compute tasks,
eliminating pipeline stalls and maximizing data throughput across the
PCIe bus.
Dedicated DMA Hardware Access
Unlike D3D12_COMMAND_LIST_TYPE_DIRECT or
D3D12_COMMAND_LIST_TYPE_COMPUTE, which utilize the GPU's
graphics front-end and programmable compute units (Streaming
Multiprocessors / Compute Units), a copy command list maps directly to
the GPU’s asynchronous DMA copy engines. These are independent,
fixed-function hardware units built specifically for blitting and
shifting data. By utilizing this queue type, the driver bypasses the 3D
graphics pipeline entirely, preventing large data transfers from taking
execution cycles away from pixel, vertex, or compute shaders.
True Asynchronous Concurrency
Because the DMA copy engine operates independently of the 3D and
compute hardware, transfers recorded via
D3D12_COMMAND_LIST_TYPE_COPY can execute concurrently with
frame rendering. When handling massive data ingestion—such as open-world
asset streaming or runtime mipmap uploads—submitting work to a dedicated
copy queue prevents frame-rate hitching. The direct queue continues
executing draw calls without waiting for high-latency PCIe transfers to
complete.
Maximizing PCIe Bandwidth Saturation
Copy engines are optimized for sustained, high-bandwidth transfers
across the host interface (PCIe or unified memory buses). A
D3D12_COMMAND_LIST_TYPE_COPY command list minimizes driver
and hardware scheduling overhead:
- Low Command Overhead: It supports only
copy-specific commands (such as
CopyBufferRegion,CopyTextureRegion, andCopyResource). - No Graphics State Management: The engine maintains no pipeline state objects (PSOs), render targets, or viewport states, leading to near-zero command recording and submission latency.
- Full Bus Saturation: It efficiently handles large, linear blocks of memory to fully saturate host-to-device (H2D) and device-to-host (D2H) bandwidth.
Strict Resource State Constraints
To facilitate maximum transfer speeds with minimal synchronization logic inside the hardware, DirectX 12 restricts the valid resource states for copy queues:
- Resources on a copy queue can generally only exist in
D3D12_RESOURCE_STATE_COPY_DEST,D3D12_RESOURCE_STATE_COPY_SOURCE, orD3D12_RESOURCE_STATE_COMMON. - Implicit state transitions apply when accessing resources in the
COMMONstate, reducing the requirement for explicit barriers within the copy list itself. - Once data transfer completes, explicit resource transitions must occur to allow subsequent access on direct or compute queues.
Inter-Queue Synchronization via Fences
Because copy queues operate completely out-of-order relative to the
main rendering pipeline, cross-queue synchronization using
ID3D12Fence is mandatory. The standard design pattern
requires:
- Populating an upload buffer and recording transfer commands into a
D3D12_COMMAND_LIST_TYPE_COPYlist. - Executing the copy command list on a dedicated copy command queue.
- Signaling a fence from the copy queue upon completion.
- Instructing the direct or compute queue to execute
Wait()on that fence prior to reading the newly transferred resource.
This explicit separation guarantees that rendering operations access updated memory without stalling the GPU pipeline during the physical transfer phase.