ID3D12GraphicsCommandList::ClearUnorderedAccessViewFloat method (d3d12.h)

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

Syntax

void ClearUnorderedAccessViewFloat(
  D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap,
  D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle,
  ID3D12Resource              *pResource,
  const FLOAT [4]             Values,
  UINT                        NumRects,
  const D3D12_RECT            *pRects
);

Parameters

ViewGPUHandleInCurrentHeap

Type: [in] 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: [in] 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.

Important

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: [in] ID3D12Resource*

A pointer to the ID3D12Resource interface that represents the unordered-access-view (UAV) resource to clear.

Values

Type: [in] const FLOAT[4]

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

NumRects

Type: [in] UINT

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

pRects

Type: [in] 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

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

Requirement Value
Target Platform Windows
Header d3d12.h
Library D3d12.lib
DLL D3d12.dll

See also

ID3D12GraphicsCommandList interface