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

# GetDevice

> 이 인터페이스를 만든 디바이스에 대한 포인터를 가져옵니다.

이 인터페이스를 만든 디바이스에 대한 포인터를 가져옵니다.

## 구문

```cpp theme={null}
void GetDevice(
    const IID & riid,
    void** ppvDevice
)
```

### 매개 변수

*riid*\
형식: const IID &

디바이스 인터페이스의 전역 고유 식별자(**GUID**)입니다.
디바이스 인터페이스에 대한 **REFIID** 또는 **GUID**는 \_\_uuidof() 매크로를 사용하여 얻을 수 있습니다.
예를 들어 \_\_uuidof([ID3D12Device](/reference/graphics/d3d12_x/interfaces/id3d12device/id3d12device))는 디바이스 인터페이스의 **GUID**를 가져옵니다.

*ppvDevice \[out, optional]*\
형식: **void**\*\*

디바이스에 대한 [ID3D12Device](/reference/graphics/d3d12_x/interfaces/id3d12device/id3d12device) 인터페이스에 대한 포인터를 받는 메모리 블록에 대한 포인터입니다.

### 반환 값

형식: void

이 메서드는 [Direct3D 12 반환 코드](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/d3d12-graphics-reference-returnvalues) 중 하나를 반환합니다.

## 설명

반환된 모든 인터페이스는 참조 카운트가 1씩 증가하므로, 해제되기 전에 반환된 포인터에 대해 ::release()를 호출해야 합니다. 그렇지 않으면 메모리 누수가 발생합니다.

#### 예제

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

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

## 함께 보기

[ID3D12DeviceChild](/reference/graphics/d3d12/interfaces/id3d12devicechild/id3d12devicechild_public)


## Related topics

- [IGameInputReading::GetDevice](/ko/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getdevice.md)
- [PartyNetwork::GetDevices](/ko/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_getdevices.md)
- [PartyEndpoint::GetDevice](/ko/services/playfab/multiplayer/networking/reference/classes/PartyEndpoint/methods/partyendpoint_getdevice.md)
- [PartyChatControl::GetDevice](/ko/services/playfab/multiplayer/networking/reference/classes/PartyChatControl/methods/partychatcontrol_getdevice.md)
- [IGameInputForceFeedbackEffect::GetDevice](/ko/reference/input/gameinput/interfaces/igameinputforcefeedbackeffect/methods/igameinputforcefeedbackeffect_getdevice.md)
