PFND3D11_1DDI_RESOURCECOPYREGION callback function

Copies a source subresource region to a location on a destination subresource.

Syntax

PFND3D11_1DDI_RESOURCECOPYREGION Pfnd3d111DdiResourcecopyregion;

void Pfnd3d111DdiResourcecopyregion(
   D3D10DDI_HDEVICE,
   D3D10DDI_HRESOURCE,
   UINT,
   UINT,
   UINT,
   UINT,
   D3D10DDI_HRESOURCE,
   UINT,
  CONST D3D10_DDI_BOX *,
  UINT CopyFlags
)
{...}

Parameters

D3D10DDI_HDEVICE

D3D10DDI_HRESOURCE

UINT

UINT

UINT

UINT

D3D10DDI_HRESOURCE

UINT

*

CopyFlags

Return Value

None

The driver can use the pfnSetErrorCb callback function to set an error code. For more information about setting error codes, see the Remarks section.

Remarks

The Microsoft Direct3D runtime calls the user-mode display driver's ResourceCopyRegion(D3D11_1) function to inform the driver to copy from the specified source subresource region to a location on the specified destination subresource. The source and destination subresources can be the same subresource of the same resource. Both source and destination resources must be the same type of resource and must have format types (DXGI_FORMAT-typed values) that are convertible to each other.

For buffers, all the coordinates must be in bytes; whereas for textures, all the coordinates must be in pixels. The box that the pSrcBox parameter points to must not extend over the edges of the source subresource region or the destination subresource. The source and the destination resource must not be currently mapped. In addition, the resource creation flags restrict whether the resource can participate in the copy operation.

The driver should not encounter any error, except for D3DDDIERR_DEVICEREMOVED. Therefore, if the driver passes any error, except for D3DDDIERR_DEVICEREMOVED, in a call to the pfnSetErrorCb function, the Direct3D runtime will determine that the error is critical. Even if the device was removed, the driver is not required to return D3DDDIERR_DEVICEREMOVED; however, if device removal interfered with the operation of (which typically should not happen), the driver can return D3DDDIERR_DEVICEREMOVED.

The driver can implement a ResourceCopyRegion(D3D11_1) function that can contain a switch statement to process copying and conversion. That is, the driver can implement one ResourceCopyRegion(D3D11_1) and can set the pfnResourceConvertRegion member of the D3D11_1DDI_DEVICEFUNCS structure to point to ResourceCopyRegion(D3D11_1) along with the pfnResourceCopyRegion member of D3D11_1DDI_DEVICEFUNCS. However, to improve performance, the driver can implement separate ResourceCopyRegion(D3D11_1) and ResourceConvertRegion(D3D11_1) functions.

The following sections list conditions for copying and converting:

Copying

For copying, ResourceCopyRegion(D3D11_1) ensures that the source and destination resources were created through the driver's CreateResource(D3D11) function with the following conditions:

  • The destination resource was not created with the D3D10_DDI_USAGE_IMMUTABLE value set in the Usage member of the D3D11DDIARG_CREATERESOURCE structure.

  • If either the source or destination resource has the D3D10_DDI_BIND_DEPTH_STENCIL bit set in the BindFlags member of the D3D10DDIARG_CREATERESOURCE or is a multi-sampled resource, ResourceCopyRegion(D3D11_1) verifies that the pSrcBox parameter is NULL, while the DstX, DstY, and DstZ parameters are 0.

  • The subresource indices are in range.

  • Alignment restrictions apply to coordinates.

  • The source and destination resources are not part of the exact same subresource.

  • Each source and destination resource format that is specified in the Format member of D3D11DDIARG_CREATERESOURCE is in the same typeless group.

  • The source and destination resources must have the same number of samples and quality levels; except for single-sampled resources, which must only have the same number of samples.

ResourceCopyRegion(D3D11_1) does not ensure that the source box that is offset by the destination offsets fits entirely on the resource. ResourceCopyRegion(D3D11_1) also does not ensure that no subresources are currently mapped.

Converting

For conversion, ResourceCopyRegion(D3D11_1) ensures that the source and destination resources were created through the driver's CreateResource(D3D11) function with the following conditions:

  • The destination resource was not created with the D3D10_DDI_USAGE_IMMUTABLE value set in the Usage member of the D3D11DDIARG_CREATERESOURCE structure.

  • If either the source or destination resource has the D3D10_DDI_BIND_DEPTH_STENCIL bit set in the BindFlags member of D3D11DDIARG_CREATERESOURCE or is a multi-sampled resource, ResourceCopyRegion(D3D11_1) verifies that the pSrcBox parameter is NULL, while the DstX, DstY, and DstZ parameters are 0.

  • The subresource indices are in range.

  • Alignment restrictions apply to coordinates.

  • The source and destination resources are not part of the exact same subresource.

  • Each source and destination resource format that is specified in the Format member of D3D11DDIARG_CREATERESOURCE is in the same typeless group.

  • Each source and destination resource format that is specified in the Format member of D3D11DDIARG_CREATERESOURCE supports the appropriate conversion operation.

  • The source and destination resources must have the same number of samples and quality levels; except for single-sampled resources, which must only have the same number of samples.

ResourceCopyRegion(D3D11_1) does not ensure that no subresources are currently mapped. ResourceCopyRegion(D3D11_1) also does not ensure that the source box that is offset by the destination offsets fits entirely on the resource.

Requirements

   
Windows version Windows 8 Windows Server 2012
Target Platform Desktop
Header d3d10umddi.h (include D3d10umddi.h)

See Also

CreateResource(D3D11)

D3D10_DDI_BOX

D3D11DDIARG_CREATERESOURCE

D3D11_1DDI_DEVICEFUNCS

D3D11_1_DDI_COPY_FLAGS

pfnSetErrorCb