libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
8.7k stars 1.64k forks source link

[Windows] use EnumAdapterByGpuPreference to find the right gpu #5210

Open bartwe opened 2 years ago

bartwe commented 2 years ago

https://docs.microsoft.com/en-us/windows/win32/api/dxgi1_6/nf-dxgi1_6-idxgifactory6-enumadapterbygpupreference is a replacement for IDXGIFactory2_EnumAdapters that allows choosing of a High Performance or Low Power or default gpu and is the win10+ way of picking the gpu and deprecates the NvOptimusEnablement /AmdPowerXpressRequestHighPerformance hints.

flibitijibibo commented 2 years ago

This is what it ended up looking like in FNA3D: https://github.com/FNA-XNA/FNA3D/commit/392f8cff6b4cbb61ec854272485db99430e529dc

I don't know anything about the D3D stuff in SDL though, so someone more familiar with the SDL_Render implementations will have to integrate this...

slouken commented 2 years ago

Okay, thanks!

slouken commented 1 year ago

Let's do this via a hint in the future.