ID3D12Device::CreateCommandAllocator method

Creates a command allocator object.

Syntax

HRESULT CreateCommandAllocator(
  D3D12_COMMAND_LIST_TYPE type,
  REFIID                  riid,
  void                    **ppCommandAllocator
);

Parameters

type

Type: D3D12_COMMAND_LIST_TYPE

A D3D12_COMMAND_LIST_TYPE-typed value that specifies the type of command allocator to create. The type of command allocator can be the type that records either direct command lists or bundles.

riid

Type: REFIID

The globally unique identifier (GUID) for the command allocator interface (ID3D12CommandAllocator). The REFIID, or GUID, of the interface to the command allocator can be obtained by using the __uuidof() macro. For example, __uuidof(ID3D12CommandAllocator) will get the GUID of the interface to a command allocator.

ppCommandAllocator

Type: void**

A pointer to a memory block that receives a pointer to the ID3D12CommandAllocator interface for the command allocator.

Return Value

Type: HRESULT

This method returns E_OUTOFMEMORY if there is insufficient memory to create the command allocator. See Direct3D 12 Return Codes for other possible return values.

Remarks

The device creates command lists from the command allocator.

Examples

The D3D12Bundles sample uses ID3D12Device::CreateCommandAllocator as follows:

C++
ThrowIfFailed(pDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&m_commandAllocator)));
ThrowIfFailed(pDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_BUNDLE, IID_PPV_ARGS(&m_bundleAllocator)));

Refer to the Example Code in the D3D12 Reference.

Requirements

   
Target Platform Windows
Header d3d12.h
Library D3D12.lib
DLL D3D12.dll

See Also

ID3D12Device