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

# D3D12SerializeVersionedRootSignature

> 序列化可傳遞至 ID3D12Device::CreateRootSignature 的任何版本根簽章。

序列化可傳遞至 [ID3D12Device::CreateRootSignature](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createrootsignature_public) 的任何版本根簽章。

## 語法

```cpp theme={null}
HRESULT D3D12SerializeVersionedRootSignature(
    const D3D12_VERSIONED_ROOT_SIGNATURE_DESC  pRootSignature,
    ID3DBlob  ppBlob,
    ID3DBlob  ppErrorBlob
)
```

### 參數

*pRootSignature \[in]*\
類型：const D3D12\_VERSIONED\_ROOT\_SIGNATURE\_DESC \*

指定包含任何版本根簽章描述的 [D3D12\_VERSIONED\_ROOT\_SIGNATURE\_DESC](/zh-TW/reference/graphics/d3d12/structs/d3d12_versioned_root_signature_desc_public)。

*ppBlob \[out]*\
類型：ID3DBlob \*\*

指向記憶體區塊的指標，該區塊會接收指向 **ID3DBlob** 介面的指標，您可以使用該介面存取序列化的根簽章。

*ppErrorBlob \[out, optional]*\
類型：ID3DBlob \*\*

指向記憶體區塊的指標，該區塊會接收指向 **ID3DBlob** 介面的指標，您可以使用該介面存取序列化程式錯誤訊息；如果沒有錯誤，則為 **NULL**。

### 傳回值

類型：HRESULT

如果成功，則傳回 **S\_OK**；否則傳回其中一個 [Direct3D 12 傳回碼](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/d3d12-graphics-reference-returnvalues)。

## 備註

如果應用程式以程序方式產生 [D3D12\_ROOT\_SIGNATURE\_DESC1](/zh-TW/reference/graphics/d3d12/structs/d3d12_root_signature_desc1_public) 資料結構，則必須在呼叫 **D3D12SerializeVersionedRootSignature** 時傳遞指向此 **D3D12\_ROOT\_SIGNATURE\_DESC1** 的指標，以產生序列化形式。
接著，應用程式會將 <i>ppBlob</i> 所指向的序列化形式傳遞至 [ID3D12Device::CreateRootSignature](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createrootsignature_public)。

如果著色器在撰寫時已包含根簽章，則編譯後的著色器中已包含序列化的根簽章。在此情況下，請將編譯後的著色器 Blob 傳遞至 [ID3D12Device::CreateRootSignature](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createrootsignature_public)，以取得執行階段根簽章物件。

<Note>
  請注意，對於 XBOX 開發人員，強烈建議使用以 HLSL 撰寫的根簽章。
</Note>

函式簽章 PFN\_D3D12\_SERIALIZE\_VERSIONED\_ROOT\_SIGNATURE 以 typedef 形式提供，因此您可以使用動態連結技術 ([GetProcAddress](https://learn.microsoft.com/en-us/windows/desktop/api/libloaderapi/nf-libloaderapi-getprocaddress)) 而非靜態連結。

此函式隨 Windows 10 年度更新版 (14393) 發行，並取代 [D3D12SerializeRootSignature](/zh-TW/reference/graphics/d3d12/functions/d3d12serializerootsignature_public)。

## 需求

**標頭：** d3d12\_xs.h 或 d3d12\_x.h\
**程式庫：** d3d12\_xs.lib 或 d3d12\_x.lib\
**支援的平台**：XBOX Series 主機和 XBOX One 系列主機

## 另請參閱

[核心函式](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-functions)

[建立根簽章](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/creating-a-root-signature)

[D3DX12SerializeVersionedRootSignature](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/d3dx12serializeversionedrootsignature)

[根簽章 1.1 版](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/root-signature-version-1-1)


## Related topics

- [D3D12_VERSIONED_ROOT_SIGNATURE_DESC](/zh-TW/reference/graphics/d3d12/structs/d3d12_versioned_root_signature_desc_public.md)
- [D3D12SerializeRootSignature](/zh-TW/reference/graphics/d3d12/functions/d3d12serializerootsignature_public.md)
- [D3D12CreateVersionedRootSignatureDeserializer](/zh-TW/reference/graphics/d3d12/functions/d3d12createversionedrootsignaturedeserializer_public.md)
- [ID3D12VersionedRootSignatureDeserializer](/zh-TW/reference/graphics/d3d12/interfaces/id3d12versionedrootsignaturedeserializer/id3d12versionedrootsignaturedeserializer_public.md)
- [ID3D12RootSignatureDeserializer](/zh-TW/reference/graphics/d3d12/interfaces/id3d12rootsignaturedeserializer/id3d12rootsignaturedeserializer_public.md)
