ID3D12Device::CopyDescriptors method (d3d12.h)

Copies descriptors from a source to a destination.

Syntax

void CopyDescriptors(
  [in]           UINT                              NumDestDescriptorRanges,
  [in]           const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts,
  [in, optional] const UINT                        *pDestDescriptorRangeSizes,
  [in]           UINT                              NumSrcDescriptorRanges,
  [in]           const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts,
  [in, optional] const UINT                        *pSrcDescriptorRangeSizes,
  [in]           D3D12_DESCRIPTOR_HEAP_TYPE        DescriptorHeapsType
);

Parameters

[in] NumDestDescriptorRanges

Type: UINT

The number of destination descriptor ranges to copy to.

[in] pDestDescriptorRangeStarts

Type: const D3D12_CPU_DESCRIPTOR_HANDLE*

An array of D3D12_CPU_DESCRIPTOR_HANDLE objects to copy to.

All the destination and source descriptors must be in heaps of the same D3D12_DESCRIPTOR_HEAP_TYPE.

[in, optional] pDestDescriptorRangeSizes

Type: const UINT*

An array of destination descriptor range sizes to copy to.

[in] NumSrcDescriptorRanges

Type: UINT

The number of source descriptor ranges to copy from.

[in] pSrcDescriptorRangeStarts

Type: const D3D12_CPU_DESCRIPTOR_HANDLE*

An array of D3D12_CPU_DESCRIPTOR_HANDLE objects to copy from.

Important

All elements in the pSrcDescriptorRangeStarts parameter must be in a non shader-visible descriptor heap. This is because shader-visible descriptor heaps may be created in WRITE_COMBINE memory or GPU local memory, which is prohibitively slow to read from. If your application manages descriptor heaps via copying the descriptors required for a given pass or frame from local "storage" descriptor heaps to the GPU-bound descriptor heap, use shader-opaque heaps for the storage heaps and copy into the GPU-visible heap as required.

[in, optional] pSrcDescriptorRangeSizes

Type: const UINT*

An array of source descriptor range sizes to copy from.

[in] DescriptorHeapsType

Type: D3D12_DESCRIPTOR_HEAP_TYPE

The D3D12_DESCRIPTOR_HEAP_TYPE-typed value that specifies the type of descriptor heap to copy with. This is required as different descriptor types may have different sizes.

Both the source and destination descriptor heaps must have the same type, else the debug layer will emit an error.

Return value

None

Remarks

Where applicable, prefer ID3D12Device::CopyDescriptorsSimple to this method. It can have a better CPU cache miss rate due to the linear nature of the copy.

Requirements

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

See also

Copying Descriptors

ID3D12Device