ID3D12Resource::ReadFromSubresource method (d3d12.h)

Uses the CPU to copy data from a subresource, enabling the CPU to read the contents of most textures with undefined layouts.

Syntax

HRESULT ReadFromSubresource(
  [out]          void            *pDstData,
                 UINT            DstRowPitch,
                 UINT            DstDepthPitch,
                 UINT            SrcSubresource,
  [in, optional] const D3D12_BOX *pSrcBox
);

Parameters

[out] pDstData

Type: void*

A pointer to the destination data in memory.

DstRowPitch

Type: UINT

The distance from one row of destination data to the next row.

DstDepthPitch

Type: UINT

The distance from one depth slice of destination data to the next.

SrcSubresource

Type: UINT

Specifies the index of the subresource to read from.

[in, optional] pSrcBox

Type: const D3D12_BOX*

A pointer to a box that defines the portion of the destination subresource to copy the resource data from. If NULL, the data is read from the destination subresource with no offset. The dimensions of the destination must fit the destination (see D3D12_BOX).

An empty box results in a no-op. A box is empty if the top value is greater than or equal to the bottom value, or the left value is greater than or equal to the right value, or the front value is greater than or equal to the back value. When the box is empty, this method doesn't perform any operation.

Return value

Type: HRESULT

This method returns one of the Direct3D 12 Return Codes.

Remarks

See the Remarks section for WriteToSubresource.

Requirements

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

See also

ID3D12Resource

Subresources