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

# GetDescriptorHandleIncrementSize

> 指定されたタイプのデスクリプター ヒープに対するハンドル インクリメントのサイズを取得します。この値は通常、デスクリプター配列内のハンドルをインクリメントするために使用されます。

指定されたタイプのデスクリプター ヒープに対するハンドル インクリメントのサイズを取得します。この値は通常、デスクリプター配列内のハンドルを正しい量だけインクリメントするために使用されます。

## 構文

```cpp theme={null}
UINT GetDescriptorHandleIncrementSize(
    D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType
)
```

### パラメーター

*DescriptorHeapType \[in]*\
型: D3D12\_DESCRIPTOR\_HEAP\_TYPE

ハンドル インクリメントのサイズを取得するデスクリプター ヒープのタイプを指定する [D3D12\_DESCRIPTOR\_HEAP\_TYPE](/reference/graphics/d3d12/enums/d3d12_descriptor_heap_type_public) 型の値。

### 戻り値

型: UINT

必要なパディングを含む、指定されたタイプのデスクリプター ヒープに対するハンドル インクリメントのサイズを返します。

## 解説

このメソッドで返されるデスクリプター サイズは、ヘルパー構造体 [CD3DX12\_CPU\_DESCRIPTOR\_HANDLE](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/cd3dx12-cpu-descriptor-handle) および [CD3DX12\_GPU\_DESCRIPTOR\_HANDLE](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/cd3dx12-gpu-descriptor-handle) への入力の 1 つとして使用されます。

#### 例

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

リソース用のデスクリプター ヒープを作成します。<code>m\_rtvDescriptorSize</code> 変数はレンダー ターゲット ビュー デスクリプター ハンドル インクリメント サイズを格納し、コードの **フレーム リソースの作成** セクションで使用されます。

```cpp theme={null}
// Create descriptor heaps.
{
// Describe and create a render target view (RTV) descriptor heap.
D3D12_DESCRIPTOR_HEAP_DESC rtvHeapDesc = {};
rtvHeapDesc.NumDescriptors = FrameCount;
rtvHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
rtvHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
ThrowIfFailed(m_device->CreateDescriptorHeap(&rtvHeapDesc, IID_PPV_ARGS(&m_rtvHeap)));

// Describe and create a depth stencil view (DSV) descriptor heap.
D3D12_DESCRIPTOR_HEAP_DESC dsvHeapDesc = {};
dsvHeapDesc.NumDescriptors = 1;
dsvHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV;
dsvHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
ThrowIfFailed(m_device->CreateDescriptorHeap(&dsvHeapDesc, IID_PPV_ARGS(&m_dsvHeap)));

// Describe and create a constant buffer view (CBV) descriptor heap.
D3D12_DESCRIPTOR_HEAP_DESC cbvHeapDesc = {};
cbvHeapDesc.NumDescriptors = CbvCountPerFrame * FrameCount;
cbvHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
cbvHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
ThrowIfFailed(m_device->CreateDescriptorHeap(&cbvHeapDesc, IID_PPV_ARGS(&m_cbvHeap)));

// Describe and create a heap for occlusion queries.
D3D12_QUERY_HEAP_DESC queryHeapDesc = {};
queryHeapDesc.Count = 1;
queryHeapDesc.Type = D3D12_QUERY_HEAP_TYPE_OCCLUSION;
ThrowIfFailed(m_device->CreateQueryHeap(&queryHeapDesc, IID_PPV_ARGS(&m_queryHeap)));

m_rtvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
m_cbvSrvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
}

// Create frame resources.
{
CD3DX12_CPU_DESCRIPTOR_HANDLE rtvHandle(m_rtvHeap->GetCPUDescriptorHandleForHeapStart());

// Create a RTV and a command allocator for each frame.
for (UINT n = 0; n < FrameCount; n++)
{
ThrowIfFailed(m_swapChain->GetBuffer(n, IID_PPV_ARGS(&m_renderTargets[n])));
m_device->CreateRenderTargetView(m_renderTargets[n].Get(), nullptr, rtvHandle);
rtvHandle.Offset(1, m_rtvDescriptorSize);

ThrowIfFailed(m_device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&m_commandAllocators[n])));
}
}

```

[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 ファミリ

## 関連項目

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


## Related topics

- [D3D12_GPU_DESCRIPTOR_HANDLE](/ja-jp/reference/graphics/d3d12/structs/d3d12_gpu_descriptor_handle_public.md)
- [D3D12_CPU_DESCRIPTOR_HANDLE](/ja-jp/reference/graphics/d3d12/structs/d3d12_cpu_descriptor_handle_public.md)
- [D3D12_DESCRIPTOR_HEAP_TYPE](/ja-jp/reference/graphics/d3d12/enums/d3d12_descriptor_heap_type_public.md)
- [GetCPUDescriptorHandleForHeapStart](/ja-jp/reference/graphics/d3d12/interfaces/id3d12descriptorheap/methods/id3d12descriptorheap_getcpudescriptorhandleforheapstart_public.md)
- [GetGPUDescriptorHandleForHeapStart](/ja-jp/reference/graphics/d3d12/interfaces/id3d12descriptorheap/methods/id3d12descriptorheap_getgpudescriptorhandleforheapstart_public.md)
