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

# ReadFromSubresource

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

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

## Syntax

```cpp theme={null}
HRESULT ReadFromSubresource(
    void  pDstData,
    UINT DstRowPitch,
    UINT DstDepthPitch,
    UINT SrcSubresource,
    const D3D12_BOX  pSrcBox
)
```

### Parameters

*pDstData \[out]*\
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.

*pSrcBox \[in, optional]*\
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](/reference/graphics/d3d12/structs/d3d12_box_public)).

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](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/d3d12-graphics-reference-returnvalues).

## Remarks

See the Remarks section for [WriteToSubresource](/reference/graphics/d3d12/interfaces/id3d12resource/methods/id3d12resource_writetosubresource_public).

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

[ID3D12Resource](/reference/graphics/d3d12_xs/interfaces/ID3D12Resource/id3d12resource_xs)

[Subresources](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/subresources)


## Related topics

- [D3D12_BOX](/reference/graphics/d3d12/structs/d3d12_box_public.md)
- [Map](/reference/graphics/d3d12/interfaces/id3d12resource/methods/id3d12resource_map_public.md)
- [D3D12_RESOURCE_BARRIER_TYPE](/reference/graphics/d3d12/enums/d3d12_resource_barrier_type_public.md)
- [ResolveSubresourceRegion](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist1/methods/id3d12graphicscommandlist1_resolvesubresourceregion_public.md)
- [AtomicCopyBufferUINT](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist1/methods/id3d12graphicscommandlist1_atomiccopybufferuint_public.md)
