#3428·stride

Graphics: a GPU preference API on GraphicsAdapter, and full screen on a hybrid laptop

Author: Nicogo1705Created Sep 13, 2026Updated Sep 13, 2026

Summary

Follow-up to #3388, from @xen2's review there. Stride has no way to choose which GPU a game runs on beyond GraphicsDeviceManager.RequiredAdapterUid. #3388 first proposed a GraphicsAdapterFactory.GpuPreference static (an enum plus Reset()), which was withdrawn from that PR: a mutable static that changes what GraphicsAdapterFactory.Adapters returns, and a Reset() that disposes adapters a live GraphicsDevice may still use, is not the right shape.

Proposed direction (xen2)

GraphicsAdapterFactory reports what the system has, untouched, with facts on each GraphicsAdapter:

csharp
public enum GraphicsAdapterType { Unknown, Integrated, Discrete, Virtual, Software }

public GraphicsAdapterType Type { get; }   // set by each backend
public int AdapterOrder { get; }           // system enumeration order; 0 is the system default
public bool IsDefaultAdapter => AdapterOrder == 0;
public int PerformanceRank { get; }        // platform's fastest-first order; 0 is the fastest
public int PowerEfficiencyRank { get; }    // platform's most-efficient-first order; 0 is the most efficient
  • Direct3D fills the ranks from DXGI EnumAdapterByGpuPreference (HighPerformance and MinimumPower orders).
  • Vulkan fills them from VkPhysicalDeviceType: Discrete > Integrated > Virtual > Cpu for performance, Integrated first for efficiency.
  • The preference itself lives with the other creation settings, in GameGraphicsParameters then GraphicsDeviceManager (e.g. PreferredGpu), and FindBestDevices sorts by the matching rank. Device creation stops depending on a mutable static.

Also to settle

  • Full screen on a hybrid laptop: an adapter with no output produces no full-screen candidate in FindBestDevices, so a game that starts full screen lands on the integrated GPU while the same game windowed lands on the discrete one. Exclusive full screen on an output-less adapter is not possible in DXGI, so the expected behaviour is probably borderless full screen on the chosen adapter rather than an output lookup.

Related

  • #3388 keeps only the bug fix: the discrete GPU of a hybrid laptop is no longer skipped, and Vulkan enumerates the discrete GPU first as Direct3D already did.