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

# CheckFeatureSupport

> 取得目前圖形驅動程式所支援功能的相關資訊。(ID3D12Device.CheckFeatureSupport)

取得目前圖形驅動程式所支援功能的相關資訊。

## 語法

```cpp theme={null}
HRESULT CheckFeatureSupport(
    D3D12_FEATURE Feature,
    void  pFeatureSupportData,
    UINT FeatureSupportDataSize
)
```

### 參數

*Feature*\
類型：D3D12\_FEATURE

[D3D12\_FEATURE](/zh-TW/reference/graphics/d3d12/enums/d3d12_feature_public) 列舉中的常數，描述您要查詢是否支援的功能。

*pFeatureSupportData \[in, out]*\
類型：void \*

指向對應於 <i>Feature</i> 參數值之資料結構的指標。若要判斷每個常數對應的資料結構，請參閱 [D3D12\_FEATURE](/zh-TW/reference/graphics/d3d12/enums/d3d12_feature_public)。

*FeatureSupportDataSize*\
類型：UINT

<i>pFeatureSupportData</i> 參數所指向之結構的大小。

### 傳回值

類型：HRESULT

如果成功，會傳回 **S\_OK**。如果傳遞給 <i>pFeatureSupportData</i> 參數的是不支援的資料類型，或偵測到 <i>FeatureSupportDataSize</i> 參數的大小不符，則會傳回 **E\_INVALIDARG**。

## 備註

以使用範例來說，若要檢查是否支援光線追蹤，請在 <i>pFeatureSupportData</i> 參數中指定 [D3D12\_FEATURE\_DATA\_D3D12\_OPTIONS5](/zh-TW/reference/graphics/d3d12/structs/d3d12_feature_data_d3d12_options5_public) 結構。函式成功完成時，存取已填入之 **D3D12\_FEATURE\_DATA\_D3D12\_OPTIONS5** 結構的 <i>RaytracingTier</i> 欄位 (指定支援的光線追蹤層級)。

如需詳細資訊，請參閱[功能查詢](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/capability-querying)。

<h3><a id="Hardware_support_for_DXGI_Formats" /><a id="hardware_support_for_dxgi_formats" /><a id="HARDWARE_SUPPORT_FOR_DXGI_FORMATS" />DXGI 格式的硬體支援</h3>
若要檢視 DXGI 格式和硬體功能的表格，請參閱：

<ul>
  <li>
    [Direct3D 功能層級 12.1 硬體的 DXGI 格式支援](https://learn.microsoft.com/en-us/windows/desktop/direct3ddxgi/hardware-support-for-direct3d-12-1-formats)
  </li>

  <li>
    [Direct3D 功能層級 12.0 硬體的 DXGI 格式支援](https://learn.microsoft.com/en-us/windows/desktop/direct3ddxgi/hardware-support-for-direct3d-12-0-formats)
  </li>

  <li>
    [Direct3D 功能層級 11.1 硬體的 DXGI 格式支援](https://learn.microsoft.com/en-us/windows/desktop/direct3ddxgi/format-support-for-direct3d-11-1-feature-level-hardware)
  </li>

  <li>
    [Direct3D 功能層級 11.0 硬體的 DXGI 格式支援](https://learn.microsoft.com/en-us/windows/desktop/direct3ddxgi/format-support-for-direct3d-11-0-feature-level-hardware)
  </li>

  <li>
    [Direct3D 10Level9 格式的硬體支援](https://learn.microsoft.com/en-us/previous-versions/ff471324\(v=vs.85\))
  </li>

  <li>
    [Direct3D 功能層級 10.1 硬體的格式支援](https://learn.microsoft.com/en-us/windows/desktop/direct3ddxgi/format-support-for-direct3d-feature-level-10-1-hardware)
  </li>

  <li>
    [Direct3D 功能層級 10.0 硬體的格式支援](https://learn.microsoft.com/en-us/windows/desktop/direct3ddxgi/format-support-for-direct3d-feature-level-10-0-hardware)
  </li>
</ul>

#### 範例

[D3D1211on12](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/working-samples) 範例使用 **ID3D12Device::CheckFeatureSupport** 的方式如下：

```cpp theme={null}
inline UINT8 D3D12GetFormatPlaneCount(
_In_ ID3D12Device* pDevice,
DXGI_FORMAT Format
)
{
D3D12_FEATURE_DATA_FORMAT_INFO formatInfo = {Format};
if (FAILED(pDevice->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &formatInfo, sizeof(formatInfo))))
{
return 0;
}
return formatInfo.PlaneCount;
}

```

## 需求

**標頭：** d3d12\_xs.h 或 d3d12\_x.h\
**程式庫：** d3d12\_xs.lib 或 d3d12\_x.lib\
**支援的平台**：XBOX Series 主機與 XBOX One 系列

## 另請參閱

[ID3D12Device](/zh-TW/reference/graphics/d3d12_x/interfaces/id3d12device/id3d12device)


## Related topics

- [D3D12_FEATURE](/zh-TW/reference/graphics/d3d12/enums/d3d12_feature_public.md)
- [D3D12_FEATURE_DATA_D3D12_OPTIONS5](/zh-TW/reference/graphics/d3d12/structs/d3d12_feature_data_d3d12_options5_public.md)
- [D3D12_FEATURE_DATA_SHADER_CACHE](/zh-TW/reference/graphics/d3d12/structs/d3d12_feature_data_shader_cache_public.md)
- [D3D12_FEATURE_DATA_SHADER_MODEL](/zh-TW/reference/graphics/d3d12/structs/d3d12_feature_data_shader_model_public.md)
- [D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY](/zh-TW/reference/graphics/d3d12/structs/d3d12_feature_data_command_queue_priority_public.md)
