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

# ClearUnorderedAccessViewUint

> Sets all the elements in a unordered-access view (UAV) to the specified integer values.

Sets all the elements in a unordered-access view (UAV) to the specified integer values.

## Syntax

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

### Parameters

*ViewGPUHandleInCurrentHeap*\
Type: D3D12\_GPU\_DESCRIPTOR\_HANDLE

A [D3D12\_GPU\_DESCRIPTOR\_HANDLE](/reference/graphics/d3d12/structs/d3d12_gpu_descriptor_handle_public) that references an initialized descriptor for the unordered-access view (UAV) that is to be cleared. This descriptor must be in a shader-visible descriptor heap, which must be set on the command list via [SetDescriptorHeaps](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_setdescriptorheaps_public).

*ViewCPUHandle*\
Type: D3D12\_CPU\_DESCRIPTOR\_HANDLE

A [D3D12\_CPU\_DESCRIPTOR\_HANDLE](/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public) in a non-shader visible descriptor heap that references an initialized descriptor for the unordered-access view (UAV) that is to be cleared.

<Info>
  This descriptor must not be in a shader-visible descriptor heap. This is to allow drivers that implement the clear as a fixed-function hardware operation (rather than as a dispatch) to efficiently read from the descriptor, as shader-visible heaps may be created in **WRITE\_BACK** memory (similar to **D3D12\_HEAP\_TYPE\_UPLOAD** heap types), and CPU reads from this type of memory are prohibitively slow.
</Info>

*pResource*\
Type: ID3D12Resource \*

A pointer to the [ID3D12Resource](/reference/graphics/d3d12_xs/interfaces/ID3D12Resource/id3d12resource_xs) interface that represents the unordered-access-view (UAV) resource to clear.

*Values*\
Type: const UINT \*

A 4-component array that containing the values to fill the unordered-access-view resource with.

*NumRects*\
Type: UINT

The number of rectangles in the array that the *pRects* parameter specifies.

*pRects*\
Type: const D3D12\_RECT \*

An array of **D3D12\_RECT** structures for the rectangles in the resource view to clear. If **NULL**, **ClearUnorderedAccessViewUint** clears the entire resource view.

### Return value

Type: void

None.

## Remarks

### Runtime validation

Validation failure results in the call to [ID3D12GraphicsCommandList::Close](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_close_public) returning **E\_INVALIDARG**.

### Debug layer

The debug layer issues errors if the input values are outside of a normalized range.

The debug layer issues an error if the subresources referenced by the view aren't in the appropriate state. For **ClearUnorderedAccessViewUint**, the state must be [D3D12\_RESOURCE\_STATE\_UNORDERED\_ACCESS](/reference/graphics/d3d12_x/enums/d3d12_resource_states).

## Requirements

**Header:** d3d12\_xs.h or d3d12\_x.h\
**Library:** d3d12\_xs.lib or d3d12\_x.lib\
**Supported Platforms**: XBOX Series consoles and XBOX One family

## See Also

[ID3D12GraphicsCommandList interface](/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/id3d12graphicscommandlist_xs)


## Related topics

- [ClearUnorderedAccessViewFloat](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_clearunorderedaccessviewfloat_public.md)
- [D3D12_GPU_DESCRIPTOR_HANDLE](/reference/graphics/d3d12/structs/d3d12_gpu_descriptor_handle_public.md)
- [D3D12_CPU_DESCRIPTOR_HANDLE](/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public.md)
- [SetComputeRootUnorderedAccessView](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_setcomputerootunorderedaccessview_public.md)
- [SetGraphicsRootUnorderedAccessView](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_setgraphicsrootunorderedaccessview_public.md)
