> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CreateCommandQueue

> Creates a command queue.

Creates a command queue.

Also see [ID3D12Device9::CreateCommandQueue1](/reference/graphics/d3d12/interfaces/id3d12device9/methods/id3d12device9_createcommandqueue1_public).

## Syntax

```cpp theme={null}
HRESULT CreateCommandQueue(
    const D3D12_COMMAND_QUEUE_DESC  pDesc,
    const IID & riid,
    void  ppCommandQueue
)
```

### Parameters

*pDesc*\
Type: const D3D12\_COMMAND\_QUEUE\_DESC \*

Specifies a **D3D12\_COMMAND\_QUEUE\_DESC** that describes the command queue.

*riid*\
Type: const IID &

The globally unique identifier (GUID) for the command queue interface. See **Remarks**. An input parameter.

*ppCommandQueue*\
Type: void \*\*

A pointer to a memory block that receives a pointer to the [ID3D12CommandQueue](/reference/graphics/d3d12_xs/interfaces/ID3D12CommandQueue/id3d12commandqueue_xs) interface for the command queue.

### Return value

Type: HRESULT

This method returns **E\_OUTOFMEMORY** if there is insufficient memory to create the command queue. See [Direct3D 12 return codes](https://learn.microsoft.com/en-us/windows/win32/direct3d12/d3d12-graphics-reference-returnvalues) for other possible return values.

## Remarks

The **REFIID**, or **GUID**, of the interface to the command queue can be obtained by using the \_\_uuidof() macro. For example, \_\_uuidof(ID3D12CommandQueue) will get the **GUID** of the interface to a command queue.

## Examples

The [D3D12HelloTriangle](https://learn.microsoft.com/en-us/windows/win32/direct3d12/working-samples) sample uses **ID3D12Device::CreateCommandQueue** as follows:

```cpp theme={null}
D3D12_COMMAND_QUEUE_DESC queueDesc{};
queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;

ThrowIfFailed(m_device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&m_commandQueue)));
```

Refer to the [Example code in the D3D12 reference](https://learn.microsoft.com/en-us/windows/win32/direct3d12/notes-on-example-code).

## Requirements

**Header:** d3d12\_xs.h or d3d12\_x.h\
**Library:** d3d12\_xs.lib or d3d12\_x.lib\
**Supported Platforms**: XBOX Series consoles and XBOX One family

## See Also

* [ID3D12Device](/reference/graphics/d3d12_x/interfaces/id3d12device/id3d12device)
* [ID3D12Device9::CreateCommandQueue1](/reference/graphics/d3d12/interfaces/id3d12device9/methods/id3d12device9_createcommandqueue1_public)


## Related topics

- [CreateCommandQueue1 (XBOX Series consoles)](/reference/graphics/d3d12/interfaces/id3d12device9/methods/id3d12device9_createcommandqueue1_public.md)
- [D3D12_COMMAND_QUEUE_DESC](/reference/graphics/d3d12/structs/d3d12_command_queue_desc_public.md)
- [D3D12_COMMAND_QUEUE_PRIORITY](/reference/graphics/d3d12/enums/d3d12_command_queue_priority_public.md)
- [Create Command](/build/core-features/common/game-streaming/tak-command-line-tool/game-streaming-tak-command-line-create-command.md)
- [SHAPE audio flowgraph construction best practices](/build/console-features/audio/overviews/best-practices-audio-flowgraph-construction.md)
