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

# ClearUnorderedAccessViewFloat

> 將無序存取檢視中的所有元素設定為指定的浮點數值。

將無序存取檢視 (UAV) 中的所有元素設定為指定的浮點數值。

## 語法

```cpp theme={null}
void ClearUnorderedAccessViewFloat(
    D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap,
    D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle,
    ID3D12Resource  pResource,
    const FLOAT  Values,
    UINT NumRects,
    const D3D12_RECT  pRects
)
```

### 參數

*ViewGPUHandleInCurrentHeap*\
類型：D3D12\_GPU\_DESCRIPTOR\_HANDLE

[D3D12\_GPU\_DESCRIPTOR\_HANDLE](/zh-TW/reference/graphics/d3d12/structs/d3d12_gpu_descriptor_handle_public)，參考要清除之無序存取檢視 (UAV) 的已初始化描述元。此描述元必須位於著色器可見的描述元堆積中，且該堆積必須透過 [SetDescriptorHeaps](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_setdescriptorheaps_public) 在命令清單上設定。

*ViewCPUHandle*\
類型：D3D12\_CPU\_DESCRIPTOR\_HANDLE

位於非著色器可見描述元堆積中的 [D3D12\_CPU\_DESCRIPTOR\_HANDLE](/zh-TW/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public)，參考要清除之無序存取檢視 (UAV) 的已初始化描述元。

<Info>
  此描述元不得位於著色器可見的描述元堆積中。這是為了讓將清除作業實作為固定功能硬體作業 (而非分派) 的驅動程式能夠有效率地從描述元讀取，因為著色器可見的堆積可能建立在 **WRITE\_BACK** 記憶體中 (類似 **D3D12\_HEAP\_TYPE\_UPLOAD** 堆積類型)，而 CPU 從這類記憶體讀取的速度極慢。
</Info>

*pResource*\
類型：ID3D12Resource \*

[ID3D12Resource](/zh-TW/reference/graphics/d3d12_xs/interfaces/ID3D12Resource/id3d12resource_xs) 介面的指標，代表要清除的無序存取檢視 (UAV) 資源。

*Values*\
類型：const FLOAT \*

包含用來填入無序存取檢視資源之值的 4 元件陣列。

*NumRects*\
類型：UINT

*pRects* 參數所指定之陣列中的矩形數目。

*pRects*\
類型：const D3D12\_RECT \*

**D3D12\_RECT** 結構的陣列，代表資源檢視中要清除的矩形。如果為 **NULL**，**ClearUnorderedAccessViewFloat** 會清除整個資源檢視。

### 傳回值

類型：void

無。

## 備註

### 執行階段驗證

對於浮點輸入，執行階段會將非正規化值設定為 0 (同時保留 NAN)。

如果您想要將 UAV 清除為特定的位元模式，請考慮使用 [ID3D12GraphicsCommandList::ClearUnorderedAccessViewUint](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_clearunorderedaccessviewuint_public)。

驗證失敗會導致對 [ID3D12GraphicsCommandList::Close](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_close_public) 的呼叫傳回 **E\_INVALIDARG**。

### 偵錯層

如果輸入值超出正規化範圍，偵錯層會發出錯誤。

如果檢視所參考的子資源不處於適當的狀態，偵錯層會發出錯誤。對於 **ClearUnorderedAccessViewFloat**，狀態必須為 [D3D12\_RESOURCE\_STATE\_UNORDERED\_ACCESS](/zh-TW/reference/graphics/d3d12_x/enums/d3d12_resource_states)。

## 需求

**標頭:** 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_GPU_DESCRIPTOR_HANDLE](/zh-TW/reference/graphics/d3d12/structs/d3d12_gpu_descriptor_handle_public.md)
- [D3D12_CPU_DESCRIPTOR_HANDLE](/zh-TW/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public.md)
- [ClearUnorderedAccessViewUint](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_clearunorderedaccessviewuint_public.md)
- [D3D12_UNORDERED_ACCESS_VIEW_DESC](/zh-TW/reference/graphics/d3d12/structs/d3d12_unordered_access_view_desc_public.md)
- [SetGraphicsRootUnorderedAccessView](/zh-TW/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_setgraphicsrootunorderedaccessview_public.md)
