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

# SetDescriptorHeaps

> 명령 목록과 연결된 현재 바인딩된 설명자 힙을 변경합니다.

명령 목록과 연결된 현재 바인딩된 설명자 힙을 변경합니다.

## 구문

```cpp theme={null}
void SetDescriptorHeaps(
    UINT NumDescriptorHeaps,
     ID3D12DescriptorHeap* ppDescriptorHeaps
)
```

### 매개 변수

*NumDescriptorHeaps*\
형식: UINT

바인딩할 설명자 힙의 개수입니다.

*ppDescriptorHeaps*\
형식: \[in] **[ID3D12DescriptorHeap](/reference/graphics/d3d12/interfaces/id3d12descriptorheap/id3d12descriptorheap_public)**\*

명령 목록에 설정할 힙에 대한 [ID3D12DescriptorHeap](/reference/graphics/d3d12/interfaces/id3d12descriptorheap/id3d12descriptorheap_public) 개체 배열에 대한 포인터입니다.

[**D3D12\_DESCRIPTOR\_HEAP\_TYPE\_CBV\_SRV\_UAV**](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_setdescriptorheaps_public) 및 [**D3D12\_DESCRIPTOR\_HEAP\_TYPE\_SAMPLER**](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_setdescriptorheaps_public) 유형의 설명자 힙만 바인딩할 수 있습니다.

각 유형의 설명자 힙은 한 번에 하나만 설정할 수 있으므로, 한 번에 최대 2개의 힙(샘플러 하나, CBV/SRV/UAV 하나)만 설정할 수 있습니다.

### 반환 값

형식: void

없음.

## 설명

**SetDescriptorHeaps**는 번들에서 호출할 수 있지만, 번들 설명자 힙은 호출하는 명령 목록의 설명자 힙과 일치해야 합니다. 번들 제한에 대한 자세한 내용은 [명령 목록 및 번들 만들기 및 기록](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/recording-command-lists-and-bundles)을 참조하세요.

이전에 설정된 모든 힙은 이 호출로 인해 설정 해제됩니다. 이 호출에서는 셰이더 표시 유형별로 최대 하나의 힙만 설정할 수 있습니다.

설명자 힙 변경은 일부 하드웨어에서 파이프라인 플러시를 초래할 수 있습니다. 이 때문에 각 유형별로 하나의 셰이더 표시 힙을 사용하고 프레임당 한 번만 설정하는 것이 권장되며, 바인딩된 설명자 힙을 자주 변경하지 않는 것이 좋습니다. 대신, 렌더링 중에 필요에 따라 셰이더 불투명 힙에서 단일 셰이더 표시 힙으로 필요한 설명자를 복사하려면 [**ID3D12Device::CopyDescriptors**](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_copydescriptors_public) 및 [**ID3D12Device::CopyDescriptorsSimple**](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_copydescriptorssimple_public)을 사용하세요.

## 예제

[D3D12Bundles](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/working-samples) 샘플에서는 **ID3D12GraphicsCommandList::SetDescriptorHeaps**를 다음과 같이 사용합니다:

```cpp theme={null}
void D3D12Bundles::PopulateCommandList(FrameResource* pFrameResource)
{
// Command list allocators can only be reset when the associated
// command lists have finished execution on the GPU; apps should use
// fences to determine GPU execution progress.
ThrowIfFailed(m_pCurrentFrameResource->m_commandAllocator->Reset());

// However, when ExecuteCommandList() is called on a particular command
// list, that command list can then be reset at any time and must be before
// re-recording.
ThrowIfFailed(m_commandList->Reset(m_pCurrentFrameResource->m_commandAllocator.Get(), m_pipelineState1.Get()));

// Set necessary state.
m_commandList->SetGraphicsRootSignature(m_rootSignature.Get());

ID3D12DescriptorHeap* ppHeaps[] = { m_cbvSrvHeap.Get(), m_samplerHeap.Get() };
m_commandList->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps);

m_commandList->RSSetViewports(1, &m_viewport);
m_commandList->RSSetScissorRects(1, &m_scissorRect);

// Indicate that the back buffer will be used as a render target.
m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_frameIndex].Get(), D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET));

CD3DX12_CPU_DESCRIPTOR_HANDLE rtvHandle(m_rtvHeap->GetCPUDescriptorHandleForHeapStart(), m_frameIndex, m_rtvDescriptorSize);
CD3DX12_CPU_DESCRIPTOR_HANDLE dsvHandle(m_dsvHeap->GetCPUDescriptorHandleForHeapStart());
m_commandList->OMSetRenderTargets(1, &rtvHandle, FALSE, &dsvHandle);

// Record commands.
const float clearColor[] = { 0.0f, 0.2f, 0.4f, 1.0f };
m_commandList->ClearRenderTargetView(rtvHandle, clearColor, 0, nullptr);
m_commandList->ClearDepthStencilView(m_dsvHeap->GetCPUDescriptorHandleForHeapStart(), D3D12_CLEAR_FLAG_DEPTH, 1.0f, 0, 0, nullptr);

if (UseBundles)
{
// Execute the prebuilt bundle.
m_commandList->ExecuteBundle(pFrameResource->m_bundle.Get());
}
else
{
// Populate a new command list.
pFrameResource->PopulateCommandList(m_commandList.Get(), m_pipelineState1.Get(), m_pipelineState2.Get(), m_currentFrameResourceIndex, m_numIndices, &m_indexBufferView,
&m_vertexBufferView, m_cbvSrvHeap.Get(), m_cbvSrvDescriptorSize, m_samplerHeap.Get(), m_rootSignature.Get());
}

// Indicate that the back buffer will now be used to present.
m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_frameIndex].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT));

ThrowIfFailed(m_commandList->Close());
}
```

[D3D12 참조의 예제 코드](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/notes-on-example-code)를 참조하세요.

## 요구 사항

**헤더:** d3d12\_xs.h 또는 d3d12\_x.h\
**라이브러리:** d3d12\_xs.lib 또는 d3d12\_x.lib\
**지원 플랫폼**: XBOX Series 콘솔 및 XBOX One 제품군

## 함께 보기

[설명자 힙](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/descriptor-heaps)

[ID3D12GraphicsCommandList](/reference/graphics/d3d12_xs/interfaces/ID3D12GraphicsCommandList/id3d12graphicscommandlist_xs)


## Related topics

- [ClearUnorderedAccessViewFloat](/ko/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_clearunorderedaccessviewfloat_public.md)
- [ClearUnorderedAccessViewUint](/ko/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_clearunorderedaccessviewuint_public.md)
- [CreateDescriptorHeap](/ko/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createdescriptorheap_public.md)
- [D3D12_DESCRIPTOR_HEAP_TYPE](/ko/reference/graphics/d3d12/enums/d3d12_descriptor_heap_type_public.md)
- [ID3D12DescriptorHeap](/ko/reference/graphics/d3d12/interfaces/id3d12descriptorheap/id3d12descriptorheap_public.md)
