IDXGIFactory6::EnumAdapterByGpuPreference method

Enumerates graphics adapters based on a given GPU preference.

Syntax

HRESULT EnumAdapterByGpuPreference(
  UINT                Adapter,
  DXGI_GPU_PREFERENCE GpuPreference,
  REFIID              riid,
  void                **ppvAdapter
);

Parameters

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.

GpuPreference

Type: DXGI_GPU_PREFERENCE

The GPU preference for the app.

riid

Type: REFIID

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

ppvAdapter

Type: void**

        The address of an <a href="https://msdn.microsoft.com/en-us/library/Bb174523(v=VS.85).aspx">IDXGIAdapter</a> 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

   
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