> ## 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](/reference/graphics/d3d12_xs/interfaces/ID3D12PipelineState/id3d12pipelinestate_xs) 对象的指针，该对象包含命令列表的初始管道状态。

### 返回值

类型：void

无。

## 备注

在捆绑包上调用 **ClearState** 是无效的。如果应用在捆绑包上调用 **ClearState**，对 [Close](/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](/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/id3d12graphicscommandlist_xs)


## Related topics

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