IDXGIFactory6::EnumAdapterByGpuPreference method (dxgi1_6.h)

Enumerates graphics adapters based on a given GPU preference.

Syntax

HRESULT EnumAdapterByGpuPreference(
  [in]  UINT                Adapter,
  [in]  DXGI_GPU_PREFERENCE GpuPreference,
  [in]  REFIID              riid,
  [out] void                **ppvAdapter
);

Parameters

[in] Adapter

Type: UINT

The index of the adapter to enumerate. The indices are in order of the preference specified in GpuPreference—for example, if DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE is specified, then the highest-performing adapter is at index 0, the second-highest is at index 1, and so on.

[in] GpuPreference

Type: DXGI_GPU_PREFERENCE

The GPU preference for the app.

[in] riid

Type: REFIID

The globally unique identifier (GUID) of the IDXGIAdapter object referenced by the ppvAdapter parameter.

[out] ppvAdapter

Type: void**

The address of an IDXGIAdapter interface pointer to the adapter.

This parameter must not be NULL.

Return value

Type: HRESULT

Returns S_OK if successful; an error code otherwise. For a list of error codes, see DXGI_ERROR.

Remarks

This method allows developers to select which GPU they think is most appropriate for each device their app creates and utilizes.

This method is similar to IDXGIFactory1::EnumAdapters1, but it accepts a GPU preference to reorder the adapter enumeration. It returns the appropriate IDXGIAdapter for the given GPU preference. It is meant to be used in conjunction with the D3DCreateDevice functions, which take in an IDXGIAdapter.

When DXGI_GPU_PREFERENCE_UNSPECIFIED is specified for the GpuPreference parameter, this method is equivalent to calling IDXGIFactory1::EnumAdapters1.

When DXGI_GPU_PREFERENCE_MINIMUM_POWER is specified for the GpuPreference parameter, the order of preference for the adapter returned in ppvAdapter will be:

1. iGPUs (integrated GPUs)
2. dGPUs (discrete GPUs)
3. xGPUs (external GPUs)

When DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE is specified for the GpuPreference parameter, the order of preference for the adapter returned in ppvAdapter will be:

1. xGPUs
2. dGPUs
3. iGPUs

Requirements

Requirement Value
Minimum supported client Windows 10, version 1803 [desktop apps only]
Minimum supported server Windows Server, version 1709 [desktop apps only]
Target Platform Windows
Header dxgi1_6.h
Library Dxgi.lib

See also

IDXGIFactory6

xGPU UWP sample

xGPU desktop sample