ID3D12CommandQueue::ExecuteCommandLists method

Submits an array of command lists for execution.


void ExecuteCommandLists(
  UINT              NumCommandLists,
  ID3D12CommandList * const *ppCommandLists



The number of command lists to be executed.


The array of ID3D12CommandList command lists to be executed.

Return Value

This method does not return a value.


The driver is free to patch the submitted command lists. It is the calling application’s responsibility to ensure that the graphics processing unit (GPU) is not currently reading the any of the submitted command lists from a previous execution.

Applications are encouraged to batch together command list executions to reduce fixed costs associated with submitted commands to the GPU.

Runtime validation

Bundles can't be submitted to a command queue directly. If a bundle is passed to this method, the runtime will drop the call. The runtime will also drop the call if the Close has not been called on any of the command lists.

The runtime will detect if the command allocators associated with the command lists have been reset after Close was called. The runtime will drop the call and remove the device in this situation.

The runtime will drop the call and remove the device if the command queue fence indicates that a previous execution of any of the command lists has not yet completed.

The runtime will validate the "before" and "after" states of resource transition barriers inside of ExecuteCommandLists. If the “before” state of a transition does not match up with the “after” state of a previous transition, then the runtime will drop the call and remove the device.

The runtime will validate the “before” and “after” states of queries used by the command lists. If an error is detected, then the runtime will drop the call and remove the device.

Debug layer

The debug layer will issue errors for all cases where the runtime would drop the call.

The debug layer will issue an error if it detects that any resource referenced by the command lists, including queries, has been destroyed.


Renders a scene.

// Pipeline objects.
D3D12_VIEWPORT m_viewport;
ComPtr m_swapChain;
ComPtr m_d3d11DeviceContext;
ComPtr m_d3d11On12Device;
ComPtr m_d3d12Device;
ComPtr m_dWriteFactory;
ComPtr m_d2dFactory;
ComPtr m_d2dDevice;
ComPtr m_d2dDeviceContext;
ComPtr m_renderTargets[FrameCount];
ComPtr m_wrappedBackBuffers[FrameCount];
ComPtr m_d2dRenderTargets[FrameCount];
ComPtr m_commandAllocators[FrameCount];
ComPtr m_commandQueue;
ComPtr m_rootSignature;
ComPtr m_rtvHeap;
ComPtr m_pipelineState;
ComPtr m_commandList;
D3D12_RECT m_scissorRect;
// Render the scene.
void D3D1211on12::OnRender()
    // Record all the commands we need to render the scene into the command list.
// Execute the command list.
ID3D12CommandList* ppCommandLists[] = { m_commandList.Get() };
m_commandQueue->ExecuteCommandLists(_countof(ppCommandLists), ppCommandLists);


// Present the frame.
ThrowIfFailed(m_swapChain->Present(1, 0));



Refer to the Example Code in the D3D12 Reference.


Target Platform Windows
Header d3d12.h

See Also