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

# ReportGpuHaltX (XBOX Series 主機)

> 回報 GPU 執行期間的暫停。

回報 GPU 執行期間的暫停。暫停的原因可能是 GPU 停止回應、著色器例外狀況或隨選即時偵錯。

暫停可能是致命的 (例如 GPU 停止回應時)，也可能只是暫時停止 (例如在隨選偵錯和著色器例外狀況的情況下)。遊戲需要據此終止或繼續執行。此 API 可讓開發人員指定要執行的 GPU 偵錯類型，以及遊戲在暫停後應繼續執行還是終止。

## 語法

```cpp theme={null}
void ReportGpuHaltX(  
         D3D12XBOX_REPORT_GPU_HALT_FLAGS Flags  
)  
```

### 參數

*Flags*   \_In\_\
類型：[D3D12XBOX\_REPORT\_GPU\_HALT\_FLAGS](/zh-TW/reference/graphics/d3d12_xs/enums/d3d12xbox_report_gpu_halt_flags)

用於回報 GPU 暫停的選項，以 **D3D12XBOX\_REPORT\_GPU\_HALT\_FLAGS** 列舉常數的位元 OR 組合表示。

### 傳回值

類型：void

<a id="GpuFullStop" />

## 備註

遊戲應檢查 GPU 活動訊號，並向圖形驅動程式回報 GPU 暫停。以下範例程式碼示範如何執行此操作：

```cpp theme={null}
void GpuFullStop(ID3D12Device* device, ID3D12CommandQueue* commandQueue)
{
    Microsoft::WRL::ComPtr<ID3D12Fence> fence = nullptr;
    DX::ThrowIfFailed(device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_GRAPHICS_PPV_ARGS(fence.ReleaseAndGetAddressOf())));

    commandQueue->Signal(fence.Get(), 1);

    auto originalTime = GetTickCount();
    while (0 == fence->GetCompletedValue())
    {
        auto currentTime = GetTickCount();
        auto waitTime = 5000U; // 5 seconds
        if (currentTime > originalTime + waitTime)
        {
            D3D12XBOX_REPORT_GPU_HALT_FLAGS flags = D3D12XBOX_REPORT_GPU_HALT_FLAG_NO_TERMINATION;

            if (m_terminateTitle)
            {
                flags = D3D12XBOX_REPORT_GPU_HALT_FLAG_ALL;
            }

            if (m_noDebugBreak)
            {
                flags |= D3D12XBOX_REPORT_GPU_HALT_FLAG_NO_BREAK;
            }

            if (!m_liveDebug)
            {
                flags |= D3D12XBOX_REPORT_GPU_HALT_FLAG_NO_LIVE_DEBUG;
            }

            if (!m_generateHixDump)
            {
                flags |= D3D12XBOX_REPORT_GPU_HALT_FLAG_NO_DUMP;
            }

            ID3D12Device11* device11 = nullptr;
            DX::ThrowIfFailed(device->QueryInterface(IID_GRAPHICS_PPV_ARGS(&device11)));

            device11->ReportGpuHaltX(flags);
        }
        else
        {
            auto sleepTime = 10U; // 10 ms
            Sleep(sleepTime);
        }
    }
}
```

## 需求

**標頭：** d3d12\_xs.h

**程式庫：** d3d12\_xs.lib

**支援的平台：** XBOX Series 主機

## 另請參閱

[ID3D12Device11](/zh-TW/reference/graphics/d3d12_xs/interfaces/ID3D12Device11/id3d12device11)

[EnableLiveDebuggingX](/zh-TW/reference/graphics/d3d12_xs/interfaces/ID3D12Device11/methods/id3d12device11_enablelivedebuggingx)

[SetHangCallbacksX](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12device/methods/id3d12device_sethangcallbacksx)

[用於 XBOX 停止回應調查的即時著色器偵錯](https://learn.microsoft.com/en-us/gaming/gdk/_content/gc/tools-console/xbox-tools-and-apis/hix/live-debugging)

[PIX 中的著色器例外狀況即時偵錯](https://learn.microsoft.com/en-us/gaming/gdk/_content/gc/tools-console/xbox-tools-and-apis/pix/pix-shader-exceptions-live-debugging)

[PIX 中的隨選即時偵錯](https://learn.microsoft.com/en-us/gaming/gdk/_content/gc/tools-console/xbox-tools-and-apis/pix/pix-on-demand-live-debugging)


## Related topics

- [XBOX 主機遊戲的認證測試 XBOX 需求](/zh-TW/publishing/certification/console-cert-tested-requirements.md)
- [NDA 主題目錄 - Microsoft Learn 線上連結](/zh-TW/nda/nda-topic-directory.md)
- [XBOX Series X|S 總覽](/zh-TW/paths/series-xs/overview.md)
- [Play Anywhere(主機 + PC)總覽](/zh-TW/paths/play-anywhere/overview.md)
- [XR-130 XBOX Series X|S 世代](/zh-TW/publishing/certification/xr/xr-130.md)
