Skip to main content
Sets all of the elements in an unordered-access view (UAV) to the specified float values.

Syntax

Parameters

ViewGPUHandleInCurrentHeap
Type: D3D12_GPU_DESCRIPTOR_HANDLE
A D3D12_GPU_DESCRIPTOR_HANDLE 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. ViewCPUHandle
Type: D3D12_CPU_DESCRIPTOR_HANDLE
A D3D12_CPU_DESCRIPTOR_HANDLE in a non-shader visible descriptor heap that references an initialized descriptor for the unordered-access view (UAV) that is to be cleared.
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.
pResource
Type: ID3D12Resource *
A pointer to the ID3D12Resource interface that represents the unordered-access-view (UAV) resource to clear. Values
Type: const FLOAT *
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, ClearUnorderedAccessViewFloat clears the entire resource view.

Return value

Type: void None.

Remarks

Runtime validation

For floating-point inputs, the runtime sets denormalized values to 0 (while preserving NANs). If you want to clear the UAV to a specific bit pattern, consider using ID3D12GraphicsCommandList::ClearUnorderedAccessViewUint. Validation failure results in the call to ID3D12GraphicsCommandList::Close 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 ClearUnorderedAccessViewFloat, the state must be D3D12_RESOURCE_STATE_UNORDERED_ACCESS.

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
Last modified on August 20, 2026