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

# ClearState

> 將直接命令清單的狀態重設回建立命令清單時的狀態。(ID3D12GraphicsCommandList.ClearState)

將直接命令清單的狀態重設回建立命令清單時的狀態。

## 語法

```cpp theme={null}
void ClearState(
    ID3D12PipelineState  pPipelineState
)
```

### 參數

*pPipelineState \[in, optional]*\
類型：ID3D12PipelineState \*

[ID3D12PipelineState](/zh-TW/reference/graphics/d3d12_xs/interfaces/ID3D12PipelineState/id3d12pipelinestate_xs) 物件的指標，該物件包含命令清單的初始管線狀態。

### 傳回值

類型：void

無。

## 備註

在套件組合上呼叫 **ClearState** 是無效的。如果應用程式在套件組合上呼叫 **ClearState**，對 [Close](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_close_public) 的呼叫將會傳回 **E\_FAIL**。

呼叫 **ClearState** 時，所有目前繫結的資源都會解除繫結。基本拓撲會設定為 [D3D\_PRIMITIVE\_TOPOLOGY\_UNDEFINED](https://learn.microsoft.com/en-us/windows/desktop/api/d3dcommon/ne-d3dcommon-d3d_primitive_topology)。檢視區、裁剪矩形、樣板參考值和混合因數都會設定為空值 (全部為零)。述詞會停用。

應用程式提供的管線狀態物件會繫結為目前設定的管線狀態物件。

## 需求

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

## 另請參閱

[ID3D12GraphicsCommandList](/zh-TW/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/id3d12graphicscommandlist_xs)


## Related topics

- [D3D12_META_COMMAND_DESC](/zh-TW/reference/graphics/d3d12/structs/d3d12_meta_command_desc_public.md)
- [ClearUnorderedAccessViewFloat](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_clearunorderedaccessviewfloat_public.md)
- [ClearUnorderedAccessViewUint](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_clearunorderedaccessviewuint_public.md)
- [HCMockClearMocks](/zh-TW/reference/live/httpclient/mock/functions/hcmockclearmocks.md)
- [D3D12_CLEAR_FLAGS](/zh-TW/reference/graphics/d3d12/enums/d3d12_clear_flags_public.md)
