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

# DrawIndexedInstanced

> 인덱싱된 인스턴스 기본 도형을 그립니다.

인덱싱된 인스턴스 기본 도형을 그립니다.

## 구문

```cpp theme={null}
void DrawIndexedInstanced(
    UINT IndexCountPerInstance,
    UINT InstanceCount,
    UINT StartIndexLocation,
    INT BaseVertexLocation,
    UINT StartInstanceLocation
)
```

### 매개 변수

*IndexCountPerInstance \[in]*\
형식: UINT

각 인스턴스에 대해 인덱스 버퍼에서 읽는 인덱스 수입니다.

*InstanceCount \[in]*\
형식: UINT

그릴 인스턴스 수입니다.

*StartIndexLocation \[in]*\
형식: UINT

인덱스 버퍼에서 GPU가 읽는 첫 번째 인덱스의 위치입니다.

*BaseVertexLocation \[in]*\
형식: INT

꼭짓점 버퍼에서 꼭짓점을 읽기 전에 각 인덱스에 더해지는 값입니다.

*StartInstanceLocation \[in]*\
형식: UINT

꼭짓점 버퍼에서 인스턴스별 데이터를 읽기 전에 각 인덱스에 더해지는 값입니다.

### 반환 값

형식: void

없음.

## 설명

Draw API는 렌더링 파이프라인에 작업을 제출합니다.

인스턴싱은 동일한 지오메트리를 재사용하여 장면에서 여러 개체를 그림으로써 성능을 확장할 수 있습니다. 인스턴싱의 한 가지 예는 서로 다른 위치와 색상으로 동일한 개체를 그리는 것입니다.
인스턴싱에는 여러 꼭짓점 버퍼가 필요합니다: 꼭짓점별 데이터에 대한 최소 하나와 인스턴스별 데이터에 대한 두 번째 버퍼입니다.

#### 예제

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

```cpp theme={null}
void FrameResource::PopulateCommandList(ID3D12GraphicsCommandList* pCommandList, ID3D12PipelineState* pPso1, ID3D12PipelineState* pPso2,
UINT frameResourceIndex, UINT numIndices, D3D12_INDEX_BUFFER_VIEW* pIndexBufferViewDesc, D3D12_VERTEX_BUFFER_VIEW* pVertexBufferViewDesc,
ID3D12DescriptorHeap* pCbvSrvDescriptorHeap, UINT cbvSrvDescriptorSize, ID3D12DescriptorHeap* pSamplerDescriptorHeap, ID3D12RootSignature* pRootSignature)
{
// If the root signature matches the root signature of the caller, then
// bindings are inherited, otherwise the bind space is reset.
pCommandList->SetGraphicsRootSignature(pRootSignature);

ID3D12DescriptorHeap* ppHeaps[] = { pCbvSrvDescriptorHeap, pSamplerDescriptorHeap };
pCommandList->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps);
pCommandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

pCommandList->IASetIndexBuffer(pIndexBufferViewDesc);

pCommandList->IASetVertexBuffers(0, 1, pVertexBufferViewDesc);

pCommandList->SetGraphicsRootDescriptorTable(0, pCbvSrvDescriptorHeap->GetGPUDescriptorHandleForHeapStart());
pCommandList->SetGraphicsRootDescriptorTable(1, pSamplerDescriptorHeap->GetGPUDescriptorHandleForHeapStart());

// Calculate the descriptor offset due to multiple frame resources.
// 1 SRV + how many CBVs we have currently.
UINT frameResourceDescriptorOffset = 1 + (frameResourceIndex * m_cityRowCount * m_cityColumnCount);
CD3DX12_GPU_DESCRIPTOR_HANDLE cbvSrvHandle(pCbvSrvDescriptorHeap->GetGPUDescriptorHandleForHeapStart(), frameResourceDescriptorOffset, cbvSrvDescriptorSize);

BOOL usePso1 = TRUE;
for (UINT i = 0; i < m_cityRowCount; i++)
{
for (UINT j = 0; j < m_cityColumnCount; j++)
{
// Alternate which PSO to use; the pixel shader is different on
// each just as a PSO setting demonstration.
pCommandList->SetPipelineState(usePso1 ? pPso1 : pPso2);
usePso1 = !usePso1;

// Set this city's CBV table and move to the next descriptor.
pCommandList->SetGraphicsRootDescriptorTable(2, cbvSrvHandle);
cbvSrvHandle.Offset(cbvSrvDescriptorSize);

pCommandList->DrawIndexedInstanced(numIndices, 1, 0, 0, 0);
}
}
}

```

[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 제품군

## 함께 보기

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


## Related topics

- [D3D12_DRAW_INDEXED_ARGUMENTS](/ko/reference/graphics/d3d12/structs/d3d12_draw_indexed_arguments_public.md)
- [NDA 토픽 디렉터리 - Microsoft Learn 라이브 링크](/ko/nda/nda-topic-directory.md)
- [DrawInstanced](/ko/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_drawinstanced_public.md)
- [D3D12_DRAW_ARGUMENTS](/ko/reference/graphics/d3d12/structs/d3d12_draw_arguments_public.md)
- [XR-007 크로스 네트워크 플레이 — MMO 구현 예제](/ko/publishing/certification/xr/xr-007-mmo.md)
