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

# D3D12SerializeRootSignature

> Serializes a root signature version 1.0 that can be passed to ID3D12Device::CreateRootSignature.

Serializes a root signature version 1.0 that can be passed to [ID3D12Device::CreateRootSignature](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createrootsignature_public).

## Syntax

```cpp theme={null}
HRESULT D3D12SerializeRootSignature(
    const D3D12_ROOT_SIGNATURE_DESC  pRootSignature,
    D3D_ROOT_SIGNATURE_VERSION Version,
    ID3DBlob  ppBlob,
    ID3DBlob  ppErrorBlob
)
```

### Parameters

*pRootSignature \[in]*\
Type: const D3D12\_ROOT\_SIGNATURE\_DESC \*

The description of the root signature, as a pointer to a [D3D12\_ROOT\_SIGNATURE\_DESC](/reference/graphics/d3d12/structs/d3d12_root_signature_desc_public) structure.

*Version \[in]*\
Type: D3D\_ROOT\_SIGNATURE\_VERSION

A [D3D\_ROOT\_SIGNATURE\_VERSION](/reference/graphics/d3d12/enums/d3d_root_signature_version_public)-typed value that specifies the version of root signature.

*ppBlob \[out]*\
Type: ID3DBlob \*\*

A pointer to a memory block that receives a pointer to the **ID3DBlob** interface that you can use to access the serialized root signature.

*ppErrorBlob \[out, optional]*\
Type: ID3DBlob \*\*

A pointer to a memory block that receives a pointer to the **ID3DBlob** interface that you can use to access serializer error messages, or **NULL** if there are no errors.

### 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/desktop/direct3d12/d3d12-graphics-reference-returnvalues).

## Remarks

This function has been superseded by [D3D12SerializeVersionedRootSignature](/reference/graphics/d3d12/functions/d3d12serializeversionedrootsignature_public) as of the Windows 10 Anniversary Update (14393).

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** to make the serialized form.
The application then passes the serialized form to which <i>ppBlob</i> points into [ID3D12Device::CreateRootSignature](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createrootsignature_public).

If a shader has been authored with a root signature in it, the compiled shader will contain a serialized root signature in it already. In this case, pass the compiled shader blob to [ID3D12Device::CreateRootSignature](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createrootsignature_public) to obtain the runtime root signature object.

The function signature PFN\_D3D12\_SERIALIZE\_ROOT\_SIGNATURE is provided as a typedef, so that you can use dynamic linking techniques ([GetProcAddress](https://learn.microsoft.com/en-us/windows/desktop/api/libloaderapi/nf-libloaderapi-getprocaddress)) instead of statically linking.

#### Examples

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

```

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

<div class="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

[Core Functions](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-functions)

[Creating a Root Signature](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/creating-a-root-signature)


## Related topics

- [D3D12_ROOT_SIGNATURE_DESC](/reference/graphics/d3d12/structs/d3d12_root_signature_desc_public.md)
- [D3D_ROOT_SIGNATURE_VERSION](/reference/graphics/d3d12/enums/d3d_root_signature_version_public.md)
- [CreateRootSignature](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createrootsignature_public.md)
- [D3D12_VERSIONED_ROOT_SIGNATURE_DESC](/reference/graphics/d3d12/structs/d3d12_versioned_root_signature_desc_public.md)
- [ID3D12RootSignature](/reference/graphics/d3d12/interfaces/id3d12rootsignature/id3d12rootsignature_public.md)
