walbourn / directx-vs-templates

Direct3D Visual Studio Templates
https://walbourn.github.io/direct3d-game-visual-studio-templates-redux/
MIT License
402 stars 53 forks source link

Fix for when EnumAdapterByGpuPreference returns E_FAIL #30

Closed walbourn closed 5 years ago

walbourn commented 5 years ago

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.

This updates the code to handle this gracefully.