> ## 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.

# CreateRootSignature

> Creates a root signature layout.

Creates a root signature layout.

## Syntax

```cpp theme={null}
HRESULT CreateRootSignature(
    UINT nodeMask,
    const void  pBlobWithRootSignature,
    SIZE_T blobLengthInBytes,
    const IID & riid,
    void  ppvRootSignature
)
```

### Parameters

*nodeMask \[in]*\
Type: UINT

For single GPU operation, set this to zero. If there are multiple GPU nodes, set bits to identify the nodes (the  device's physical adapters) to which the root signature is to apply.
Each bit in the mask corresponds to a single node.
Refer to [Multi-adapter systems](https://learn.microsoft.com/en-us/windows/win32/direct3d12/multi-engine).

*pBlobWithRootSignature \[in]*\
Type: const void \*

A pointer to the source data for the serialized signature.

*blobLengthInBytes \[in]*\
Type: **[SIZE\_T](https://learn.microsoft.com/en-us/windows/win32/WinProg/windows-data-types)**

The size, in bytes, of the block of memory that <i>pBlobWithRootSignature</i> points to.

*riid*\
Type: const IID &

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

*ppvRootSignature \[out]*\
Type: void \*\*

A pointer to a memory block that receives a pointer to the root signature.

### Return value

Type: HRESULT

Returns **S\_OK** if successful; otherwise, returns one of the [Direct3D 12 Return Codes](https://learn.microsoft.com/en-us/windows/win32/direct3d12/d3d12-graphics-reference-returnvalues).

This method returns **E\_INVALIDARG** if the blob that <i>pBlobWithRootSignature</i> points to is invalid.

## Remarks

If an application procedurally generates a [D3D12\_ROOT\_SIGNATURE\_DESC](/reference/graphics/d3d12/structs/d3d12_root_signature_desc_public) data structure, it must pass a pointer to this **D3D12\_ROOT\_SIGNATURE\_DESC** in a call to [D3D12SerializeRootSignature](/reference/graphics/d3d12/functions/d3d12serializerootsignature_public) to make the serialized form.
The application then passes the serialized form to <i>pBlobWithRootSignature</i> in a call to **ID3D12Device::CreateRootSignature**.

The **REFIID**, or **GUID**, of the interface to the root signature layout can be obtained by using the \_\_uuidof() macro.
For example, \_\_uuidof([ID3D12RootSignature](/reference/graphics/d3d12/interfaces/id3d12rootsignature/id3d12rootsignature_public)) will get the **GUID** of the interface to a root signature.

#### Examples

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

Create an empty root signature.

```cpp theme={null}
CD3DX12_ROOT_SIGNATURE_DESC rootSignatureDesc;
rootSignatureDesc.Init(0, nullptr, 0, nullptr, D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT);

ComPtr<ID3DBlob> signature;
ComPtr<ID3DBlob> error;
ThrowIfFailed(D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, &error));
ThrowIfFailed(m_device->CreateRootSignature(0, signature->GetBufferPointer(), signature->GetBufferSize(), IID_PPV_ARGS(&m_rootSignature)));

```

## 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)


## Related topics

- [D3D12SerializeRootSignature](/reference/graphics/d3d12/functions/d3d12serializerootsignature_public.md)
- [D3D12CreateRootSignatureDeserializer](/reference/graphics/d3d12/functions/d3d12createrootsignaturedeserializer_public.md)
- [D3D12CreateVersionedRootSignatureDeserializer](/reference/graphics/d3d12/functions/d3d12createversionedrootsignaturedeserializer_public.md)
- [CreateCommandSignature](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createcommandsignature_public.md)
- [D3D_ROOT_SIGNATURE_VERSION](/reference/graphics/d3d12/enums/d3d_root_signature_version_public.md)
