Historically EnumAdapters1 can only return S_OK or ERROR_NOT_FOUND unless the code is bad. I had just copy & pasted that code for EnumAdapterByGpuPreference. There are circumstances (such as when using VS Graphics Diagnostics) where this function can return E_FAIL.
Historically EnumAdapters1 can only return
S_OK
orERROR_NOT_FOUND
unless the code is bad. I had just copy & pasted that code forEnumAdapterByGpuPreference
. There are circumstances (such as when using VS Graphics Diagnostics) where this function can returnE_FAIL
.This updates the code to handle this gracefully.