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

# RemoveDevice (XBOX Series 本体)

> **RemoveDevice** を呼び出して、GPU デバイスに問題が発生し、これ以上使用できないことを Direct3D 12 ランタイムに示すことができます。

**RemoveDevice** を呼び出して、GPU デバイスに問題が発生し、これ以上使用できないことを Direct3D 12 ランタイムに示すことができます。これを行うと、すべてのデバイスの監視対象フェンスがシグナルされます。通常、アプリケーションが **RemoveDevice** を明示的に呼び出す必要はありません。

## 解説

デバイスの削除によりすべてのフェンスが `UINT64_MAX` にシグナルされるため、イベントを使用してデバイス削除のコールバックを作成できます。

```cpp theme={null}
HANDLE deviceRemovedEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
assert(deviceRemovedEvent != NULL);
_deviceFence->SetEventOnCompletion(UINT64_MAX, deviceRemoved);

HANDLE waitHandle;
RegisterWaitForSingleObject(
&waitHandle,
deviceRemovedEvent,
OnDeviceRemoved,
_device.Get(), // Pass the device as our context
INFINITE, // No timeout
0 // No flags
);

void OnDeviceRemoved(PVOID context, BOOLEAN)
{
ID3D12Device* removedDevice = (ID3D12Device*)context;
HRESULT removedReason = removedDevice->GetDeviceRemovedReason();
// Perform app-specific device removed operation, such as logging or inspecting DRED output
}
```

## 要件

**ヘッダー:** d3d12\_xs.h\
**ライブラリ:** d3d12\_xs.lib\
**サポートされるプラットフォーム**: XBOX Series 本体

## 関連項目


## Related topics

- [GetDeviceRemovedReason](/ja-jp/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_getdeviceremovedreason_public.md)
- [ID3D12DeviceRemovedExtendedData](/ja-jp/reference/graphics/d3d12/interfaces/id3d12deviceremovedextendeddata/id3d12deviceremovedextendeddata_public.md)
- [D3D12_DEVICE_REMOVED_EXTENDED_DATA](/ja-jp/reference/graphics/d3d12/structs/d3d12_device_removed_extended_data_public.md)
- [ID3D12DeviceRemovedExtendedDataSettings](/ja-jp/reference/graphics/d3d12/interfaces/id3d12deviceremovedextendeddatasettings/id3d12deviceremovedextendeddatasettings_public.md)
- [D3D12_VERSIONED_DEVICE_REMOVED_EXTENDED_DATA](/ja-jp/reference/graphics/d3d12/structs/d3d12_versioned_device_removed_extended_data_public.md)
