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

# GetCopyableFootprints

> コピー可能なリソース レイアウトを取得します。領域をサブ割り当てする際に、アプリが D3D12_PLACED_SUBRESOURCE_FOOTPRINT と D3D12_SUBRESOURCE_FOOTPRINT を入力するのを支援します。

コピー可能なリソース レイアウトを取得します。
アップロード ヒープ内の領域をサブ割り当てする際に、アプリが
[D3D12\_PLACED\_SUBRESOURCE\_FOOTPRINT](/reference/graphics/d3d12/structs/d3d12_placed_subresource_footprint_public) と
[D3D12\_SUBRESOURCE\_FOOTPRINT](/reference/graphics/d3d12/structs/d3d12_subresource_footprint_public) を入力するのを支援します。

## 構文

```cpp theme={null}
void GetCopyableFootprints(
    const D3D12_RESOURCE_DESC  pResourceDesc,
    UINT FirstSubresource,
    UINT NumSubresources,
    UINT64 BaseOffset,
    D3D12_PLACED_SUBRESOURCE_FOOTPRINT  pLayouts,
    UINT  pNumRows,
    UINT64  pRowSizeInBytes,
    UINT64  pTotalBytes
)
```

### パラメーター

*pResourceDesc \[in]*\
型: const D3D12\_RESOURCE\_DESC \*

リソースの記述。[D3D12\_RESOURCE\_DESC](/reference/graphics/d3d12/structs/d3d12_resource_desc_public) 構造体へのポインター。

*FirstSubresource \[in]*\
型: UINT

リソース内の最初のサブリソースのインデックス。
有効な値の範囲は 0 から D3D12\_REQ\_SUBRESOURCES です。

*NumSubresources \[in]*\
型: UINT

リソース内のサブリソースの数。有効な値の範囲は 0 から (D3D12\_REQ\_SUBRESOURCES - <i>FirstSubresource</i>) です。

*BaseOffset*\
型: UINT64

リソースへのオフセット (バイト単位)。

*pLayouts \[out, optional]*\
型: D3D12\_PLACED\_SUBRESOURCE\_FOOTPRINT \*

各サブリソースの記述と配置を入力する
[D3D12\_PLACED\_SUBRESOURCE\_FOOTPRINT](/reference/graphics/d3d12/structs/d3d12_placed_subresource_footprint_public) 構造体の配列 (長さ <i>NumSubresources</i>) へのポインター。

*pNumRows \[out, optional]*\
型: UINT \*

各サブリソースの行数が入力される整数変数の配列 (長さ <i>NumSubresources</i>) へのポインター。

*pRowSizeInBytes \[out, optional]*\
型: UINT64 \*

各エントリに各サブリソースの行のパディングなしのサイズ (バイト単位) が入力される整数変数の配列 (長さ <i>NumSubresources</i>) へのポインター。

たとえば、Texture2D リソースの幅が 32 でピクセルあたりのバイト数が 4 の場合、

<i>pRowSizeInBytes</i> は 128 を返します。

<i>pRowSizeInBytes</i> を **行ピッチ** と混同しないでください。<i>pLayouts</i> を調べてそこから行ピッチを取得すると、D3D12\_TEXTURE\_DATA\_PITCH\_ALIGNMENT に整列されているため 256 になります。

*pTotalBytes \[out, optional]*\
型: UINT64 \*

合計サイズ (バイト単位) が入力される整数変数へのポインター。

### 戻り値

型: void

なし。

## 解説

このルーチンは、アップロード ヒープ内の領域をサブ割り当てする際に、アプリケーションが
[D3D12\_PLACED\_SUBRESOURCE\_FOOTPRINT](/reference/graphics/d3d12/structs/d3d12_placed_subresource_footprint_public) 構造体と
[D3D12\_SUBRESOURCE\_FOOTPRINT](/reference/graphics/d3d12/structs/d3d12_subresource_footprint_public) 構造体を入力するのを支援します。
結果の構造体は GPU アダプターに依存しません。つまり、値は GPU アダプターによって変わりません。
**GetCopyableFootprints** は、リソース フォーマット、テクスチャ レイアウト、アライメント要件 ([D3D12\_RESOURCE\_DESC](/reference/graphics/d3d12/structs/d3d12_resource_desc_public) 構造体から) について指定された詳細を使用して、サブリソース構造体を入力します。
アプリケーションはこれらすべての詳細にアクセスできるため、このメソッドまたはそのバリエーションをアプリの一部として記述することができます。

#### 例

[D3D12Multithreading](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/working-samples) サンプルでは、**ID3D12Device::GetCopyableFootprints** を次のように使用しています。

```cpp theme={null}
// Returns required size of a buffer to be used for data upload
inline UINT64 GetRequiredIntermediateSize(
_In_ ID3D12Resource* pDestinationResource,
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources)
{
D3D12_RESOURCE_DESC Desc = pDestinationResource->GetDesc();
UINT64 RequiredSize = 0;

ID3D12Device* pDevice;
pDestinationResource->GetDevice(__uuidof(*pDevice), reinterpret_cast<void**>(&pDevice));
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, 0, nullptr, nullptr, nullptr, &RequiredSize);
pDevice->Release();

return RequiredSize;
}

```

[D3D12 リファレンスのサンプル コード](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/notes-on-example-code) を参照してください。

<div class="code" />

## 要件

**ヘッダー:** d3d12\_xs.h または d3d12\_x.h\
**ライブラリ:** d3d12\_xs.lib または d3d12\_x.lib\
**サポートされているプラットフォーム**: XBOX Series 本体および XBOX One ファミリ

## 関連項目

[CD3DX12\_RESOURCE\_DESC](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/cd3dx12-resource-desc)

[CD3DX12\_SUBRESOURCE\_FOOTPRINT](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/cd3dx12-subresource-footprint)

[ID3D12Device](/reference/graphics/d3d12_x/interfaces/id3d12device/id3d12device)


## Related topics

- [D3D12_PLACED_SUBRESOURCE_FOOTPRINT](/ja-jp/reference/graphics/d3d12/structs/d3d12_placed_subresource_footprint_public.md)
- [D3D12_SUBRESOURCE_FOOTPRINT](/ja-jp/reference/graphics/d3d12/structs/d3d12_subresource_footprint_public.md)
- [D3D12_TEXTURE_COPY_TYPE](/ja-jp/reference/graphics/d3d12/enums/d3d12_texture_copy_type_public.md)
- [D3D12_TEXTURE_COPY_LOCATION](/ja-jp/reference/graphics/d3d12/structs/d3d12_texture_copy_location_public.md)
- [GetPMCValue](/ja-jp/reference/tools/pix3/functions/getpmcvalue.md)
