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

# D3D12_CLEAR_VALUE

> 描述用于优化特定资源清除操作的值。

描述用于优化特定资源清除操作的值。

## 语法

```cpp theme={null}
typedef struct D3D12_CLEAR_VALUE
{
    DXGI_FORMAT Format;
    FLOAT Color;
    D3D12_DEPTH_STENCIL_VALUE DepthStencil;
} D3D12_CLEAR_VALUE
```

### 成员

*Format*\
类型：DXGI\_FORMAT

指定 [DXGI\_FORMAT](https://learn.microsoft.com/en-us/windows/desktop/api/dxgiformat/ne-dxgiformat-dxgi_format) 枚举的一个成员。

通常清除的颜色的格式遵循与视图/描述符创建相同的验证规则。一般来说，清除颜色的格式可以是资源格式所属同一 typeless 组中的任何格式。

此 <i>Format</i> 必须与清除操作期间所使用视图的格式匹配。它指示 <i>Color</i> 还是 <i>DepthStencil</i> 成员有效，以及如何转换值以供资源使用。

*Color*\
类型：FLOAT\[4]

指定包含 4 个条目的浮点数组，用于确定 RGBA 值。RGBA 的顺序与 [ClearRenderTargetView](/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/methods/id3d12graphicscommandlist_clearrendertargetview_xs) 中使用的顺序一致。

*DepthStencil*\
类型：D3D12\_DEPTH\_STENCIL\_VALUE

指定 [D3D12\_DEPTH\_STENCIL\_VALUE](/reference/graphics/d3d12/structs/d3d12_depth_stencil_value_public) 的一个成员。这些值与 [ClearDepthStencilView](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_cleardepthstencilview_public) 中的 <i>Depth</i> 和 <i>Stencil</i> 语义相匹配。

## 备注

此结构可选择性地传递给以下方法：

<ul>
  <li>
    [ID3D12Device::CreateCommittedResource](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createcommittedresource_public)
  </li>

  <li>
    [ID3D12Device::CreatePlacedResource](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createplacedresource_public)
  </li>

  <li>
    [ID3D12Device::CreateReservedResource](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createreservedresource_public)
  </li>
</ul>

## 要求

**头文件：** d3d12\_xs.h 或 d3d12\_x.h\
**库：** d3d12\_xs.lib 或 d3d12\_x.lib\
**支持的平台**：XBOX Series 主机和 XBOX One 系列

## 另请参阅

[CD3DX12\_CLEAR\_VALUE](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/cd3dx12-clear-value)

[核心结构](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-structures)


## Related topics

- [D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS](/zh-CN/reference/graphics/d3d12/structs/d3d12_render_pass_beginning_access_clear_parameters_public.md)
- [D3D12_DEPTH_STENCIL_VALUE](/zh-CN/reference/graphics/d3d12/structs/d3d12_depth_stencil_value_public.md)
- [CreateReservedResource](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createreservedresource_public.md)
- [CreateReservedResource1 (XBOX Series 主机)](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device4/methods/id3d12device4_createreservedresource1_public.md)
- [CreateCommittedResource](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createcommittedresource_public.md)
