ID3D10Device::CopyResource method (d3d10.h)

Copy the entire contents of the source resource to the destination resource using the GPU.

Syntax

void CopyResource(
  [in] ID3D10Resource *pDstResource,
  [in] ID3D10Resource *pSrcResource
);

Parameters

[in] pDstResource

Type: ID3D10Resource*

A pointer to the destination resource (see ID3D10Resource).

[in] pSrcResource

Type: ID3D10Resource*

A pointer to the source resource (see ID3D10Resource).

Return value

None

Remarks

This method is unusual in that it causes the GPU to perform the copy operation (similar to a memcpy by the CPU). As a result, it has a few restrictions designed for improving performance. For instance, the source and destination resources:

  • Must be different resources.
  • Must be the same type.
  • Must have identical dimensions (including width, height, depth, and size as appropriate).
  • Must have compatible formats, which means the formats must be identical or at least from the same type group. For example, a DXGI_FORMAT_R32G32B32_FLOAT texture can be copied to a DXGI_FORMAT_R32G32B32_UINT texture since both of these formats are in the DXGI_FORMAT_R32G32B32_TYPELESS group. Beginning with Direct3D 10.1, CopyResource can copy between a few format types. For more info, see Format Conversion using Direct3D 10.1.
  • May not be currently mapped.
CopyResource supports only copy; it does not support any stretch, color key, blend, or format conversions. Beginning with Direct3D 10.1, CopyResource can reinterpret the resource data between a few format types. For more info, see Format Conversion using Direct3D 10.1.

Immutable, and depth-stencil resources cannot be used as a destination. Resources created with multisampling capability cannot be used as either a source or destination.

The method is an asynchronous call which may be added to the command-buffer queue. This attempts to remove pipeline stalls that may occur when copying data. See performance considerations for more details.

An application that only needs to copy a portion of the data in a resource should use ID3D10Device::CopySubresourceRegion instead.

Differences between Direct3D 10 and Direct3D 10.1:

Direct3D 10.1 enables depth-stencil resources to be used as either a source or destination. Direct3D 10.1 enables multisampled resources to be used as source and destination only if both source and destination have identical multisampled count and quality. If source and destination differ in multisampled count and quality or one of them is multisampled and the other is not multisampled, the call to ID3D10Device::CopyResource fails.

It is possible to copy between prestructured+typed resources and block-compressed textures. See Format Conversion using Direct3D 10.1.

Requirements

Requirement Value
Target Platform Windows
Header d3d10.h
Library D3D10.lib

See also

ID3D10Device

ID3D10Resource Interface