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

# GetDisplayModeListX (XBOX Series 主機)

> GetDisplayModeListX (XBOX Series 主機) — 取得符合所要求格式和其他輸入選項的顯示模式。

取得符合所要求格式和其他輸入選項的顯示模式。

此 API 類似於 [GetDisplayModeList](/zh-TW/reference/graphics/d3d12_xs/interfaces/IDXGIOutput/methods/idxgioutput_getdisplaymodelist)，但會提供更多 XBOX Series X|S 特有的資訊，例如對可變重新整理頻率的支援。

如需詳細資訊，請參閱 [DXGIXBOX\_MODE\_DESC](/zh-TW/reference/graphics/d3d12_xs/structs/dxgixbox_mode_desc)。

此

## 語法

```cpp theme={null}
HRESULT GetDisplayModeListX(  
         DXGI_FORMAT EnumFormat,  
         UINT Flags,  
         UINT* pNumModes,  
         DXGIXBOX_MODE_DESC *pDesc  
)  
```

### 參數

*EnumFormat*   \_In\_\
類型：[DXGI\_FORMAT](/zh-TW/reference/graphics/d3d12_xs/enums/dxgi_format)

背景緩衝區色彩格式 (請參閱 [DXGI\_FORMAT](/zh-TW/reference/graphics/d3d12_xs/enums/dxgi_format))。XBOX Series X|S 上不會使用此參數。請使用背景緩衝區的格式。

*Flags*   \_In\_\
類型：UINT

XBOX Series X|S 上不會使用此參數。請使用值 0。

*pNumModes*   \_Inout\_\
類型：UINT\*

將 pDesc 設定為 NULL，讓 pNumModes 傳回符合格式和選項的顯示模式數目。否則，pNumModes 會傳回 pDesc 中所傳回的顯示模式數目。

\**pDesc*   \_Out\_writes\_to\_opt\_(\*pNumModes,\*pNumModes)\
類型：[DXGIXBOX\_MODE\_DESC](/zh-TW/reference/graphics/d3d12_xs/structs/dxgixbox_mode_desc)

顯示模式清單的指標 (請參閱 [DXGIXBOX\_MODE\_DESC](/zh-TW/reference/graphics/d3d12_xs/structs/dxgixbox_mode_desc))；設定為 NULL 可取得顯示模式的數目。

### 傳回值

類型：HRESULT

成功時傳回 S\_OK；以無效參數呼叫時傳回 E\_INVALIDARG。

## 備註

在 XBOX Series X|S 上，此 API 是設計給想要檢查顯示器是否支援 120hz 的遊戲使用。遊戲應先呼叫此 API 並檢查是否支援 120hz 或 40hz，再以 D3D12XBOX\_FRAME\_INTERVAL\_120\_HZ 或 D3D12XBOX\_FRAME\_INTERVAL\_40\_HZ 呼叫 [ID3D12Device::SetFrameIntervalX](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12device/methods/id3d12device_setframeintervalx)。

如下所示，此 API 設計為呼叫兩次。第一次取得可用的模式數目，第二次傳回模式的描述。

```cpp theme={null}
UINT num = 0;
DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;

pOutput->GetDisplayModeListX( format, 0, &num, 0 );

...

DXGIXBOX_MODE_DESC * pDescs = new DXGIXBOX_MODE_DESC[num];
pOutput->GetDisplayModeListX( format, 0, &num, pDescs );
```

## 需求

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

**程式庫：** d3d12\_xs.lib\
**支援的平台：** XBOX Series 主機

## 另請參閱

[IDXGIOutput](/zh-TW/reference/graphics/d3d12_xs/interfaces/IDXGIOutput/idxgioutput)


## Related topics

- [NDA 主題目錄 - Microsoft Learn 線上連結](/zh-TW/nda/nda-topic-directory.md)
- [使用 GDKX 建置並執行你的第一個主機遊戲](/zh-TW/home/build-first-title/first-console-title-walkthrough.md)
- [XBOX Series X|S 總覽](/zh-TW/paths/series-xs/overview.md)
- [XDisplayHdrModePreference](/reference/system/xdisplay/enums/xdisplayhdrmodepreference.md)
- [XDisplayHdrModeResult](/reference/system/xdisplay/enums/xdisplayhdrmoderesult.md)
