Skip to main content
Gets a resource layout that can be copied. Helps the app fill-in D3D12_PLACED_SUBRESOURCE_FOOTPRINT and D3D12_SUBRESOURCE_FOOTPRINT when suballocating space in upload heaps.

Syntax

Parameters

pResourceDesc [in]
Type: const D3D12_RESOURCE_DESC *
A description of the resource, as a pointer to a D3D12_RESOURCE_DESC structure. FirstSubresource [in]
Type: UINT
Index of the first subresource in the resource. The range of valid values is 0 to D3D12_REQ_SUBRESOURCES. NumSubresources [in]
Type: UINT
The number of subresources in the resource. The range of valid values is 0 to (D3D12_REQ_SUBRESOURCES - FirstSubresource). BaseOffset
Type: UINT64
The offset, in bytes, to the resource. pLayouts [out, optional]
Type: D3D12_PLACED_SUBRESOURCE_FOOTPRINT *
A pointer to an array (of length NumSubresources) of D3D12_PLACED_SUBRESOURCE_FOOTPRINT structures, to be filled with the description and placement of each subresource. pNumRows [out, optional]
Type: UINT *
A pointer to an array (of length NumSubresources) of integer variables, to be filled with the number of rows for each subresource. pRowSizeInBytes [out, optional]
Type: UINT64 *
A pointer to an array (of length NumSubresources) of integer variables, each entry to be filled with the unpadded size in bytes of a row, of each subresource. For example, if a Texture2D resource has a width of 32 and bytes per pixel of 4, then pRowSizeInBytes returns 128. pRowSizeInBytes should not be confused with row pitch, as examining pLayouts and getting the row pitch from that will give you 256 as it is aligned to D3D12_TEXTURE_DATA_PITCH_ALIGNMENT. pTotalBytes [out, optional]
Type: UINT64 *
A pointer to an integer variable, to be filled with the total size, in bytes.

Return value

Type: void None.

Remarks

This routine assists the application in filling out D3D12_PLACED_SUBRESOURCE_FOOTPRINT and D3D12_SUBRESOURCE_FOOTPRINT structures, when suballocating space in upload heaps. The resulting structures are GPU adapter-agnostic, meaning that the values will not vary from one GPU adapter to the next. GetCopyableFootprints uses specified details about resource formats, texture layouts, and alignment requirements (from the D3D12_RESOURCE_DESC structure) to fill out the subresource structures. Applications have access to all these details, so this method, or a variation of it, could be written as part of the app.

Examples

The D3D12Multithreading sample uses ID3D12Device::GetCopyableFootprints as follows:
Refer to the Example Code in the D3D12 Reference.

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

CD3DX12_RESOURCE_DESC CD3DX12_SUBRESOURCE_FOOTPRINT ID3D12Device
Last modified on August 20, 2026