> ## 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) 列舉的一個成員。

常用清除色彩的格式遵循與檢視/描述元建立相同的驗證規則。一般而言，清除色彩的格式可以是與資源格式屬於同一無類型群組中的任何格式。

此 <i>Format</i> 必須與清除作業期間所使用之檢視的格式相符。它會指出 <i>Color</i> 或 <i>DepthStencil</i> 成員何者有效，以及如何轉換值以搭配資源使用。

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

指定包含 4 個項目的浮點數值陣列，用以決定 RGBA 值。RGBA 的順序與 [ClearRenderTargetView](/zh-TW/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/methods/id3d12graphicscommandlist_clearrendertargetview_xs) 所使用的順序相符。

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

指定 [D3D12\_DEPTH\_STENCIL\_VALUE](/zh-TW/reference/graphics/d3d12/structs/d3d12_depth_stencil_value_public) 的一個成員。這些值與 [ClearDepthStencilView](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_cleardepthstencilview_public) 中 <i>Depth</i> 與 <i>Stencil</i> 的語意相符。

## 備註

此結構可選擇性地傳入下列方法：

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

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

  <li>
    [ID3D12Device::CreateReservedResource](/zh-TW/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-TW/reference/graphics/d3d12/structs/d3d12_render_pass_beginning_access_clear_parameters_public.md)
- [D3D12_DEPTH_STENCIL_VALUE](/zh-TW/reference/graphics/d3d12/structs/d3d12_depth_stencil_value_public.md)
- [CreateReservedResource](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createreservedresource_public.md)
- [CreateReservedResource1 (XBOX Series 主機)](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device4/methods/id3d12device4_createreservedresource1_public.md)
- [CreateCommittedResource](/zh-TW/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createcommittedresource_public.md)
