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

# CopyDescriptors

> Copies descriptors from a source to a destination. (ID3D12Device.CopyDescriptors)

Copies descriptors from a source to a destination.

## Syntax

```cpp theme={null}
void CopyDescriptors(
    UINT NumDestDescriptorRanges,
    const D3D12_CPU_DESCRIPTOR_HANDLE  pDestDescriptorRangeStarts,
    const UINT  pDestDescriptorRangeSizes,
    UINT NumSrcDescriptorRanges,
    const D3D12_CPU_DESCRIPTOR_HANDLE  pSrcDescriptorRangeStarts,
    const UINT  pSrcDescriptorRangeSizes,
    D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType
)
```

### Parameters

*NumDestDescriptorRanges \[in]*\
Type: UINT

The number of destination descriptor ranges to copy to.

*pDestDescriptorRangeStarts \[in]*\
Type: const D3D12\_CPU\_DESCRIPTOR\_HANDLE \*

An array of **[D3D12\_CPU\_DESCRIPTOR\_HANDLE](/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public)** objects to copy to.

All the destination and source descriptors must be in heaps of the same [D3D12\_DESCRIPTOR\_HEAP\_TYPE](/reference/graphics/d3d12/enums/d3d12_descriptor_heap_type_public).

*pDestDescriptorRangeSizes \[in, optional]*\
Type: const UINT \*

An array of destination descriptor range sizes to copy to.

*NumSrcDescriptorRanges \[in]*\
Type: UINT

The number of source descriptor ranges to copy from.

*pSrcDescriptorRangeStarts \[in]*\
Type: const D3D12\_CPU\_DESCRIPTOR\_HANDLE \*

An array of **[D3D12\_CPU\_DESCRIPTOR\_HANDLE](/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public)** objects to copy from.

<Info>
  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.
</Info>

*pSrcDescriptorRangeSizes \[in, optional]*\
Type: const UINT \*

An array of source descriptor range sizes to copy from.

*DescriptorHeapsType \[in]*\
Type: D3D12\_DESCRIPTOR\_HEAP\_TYPE

The [D3D12\_DESCRIPTOR\_HEAP\_TYPE](/reference/graphics/d3d12/enums/d3d12_descriptor_heap_type_public)-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

Type: void

None.

## Remarks

Where applicable, prefer [**ID3D12Device::CopyDescriptorsSimple**](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_copydescriptorssimple_public) to this method. It can have a better CPU cache miss rate due to the linear nature of the copy.

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

[Copying Descriptors](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/copying-descriptors)

[ID3D12Device](/reference/graphics/d3d12_x/interfaces/id3d12device/id3d12device)


## Related topics

- [CopyDescriptorsSimple](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_copydescriptorssimple_public.md)
- [D3D12_DESCRIPTOR_HEAP_TYPE](/reference/graphics/d3d12/enums/d3d12_descriptor_heap_type_public.md)
- [SetDescriptorHeaps](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_setdescriptorheaps_public.md)
- [D3D12_CPU_DESCRIPTOR_HANDLE](/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public.md)
- [CopyTiles](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_copytiles_public.md)
