I'm currently developing a desktop application(c#/wpf) that decodes video using FFmpeg. I would like to give the user the option to select an adapter for video decoding. I'm using Direct3D method EnumAdapters
to list available adapters on current device which works fine. The list of available adapters looks something like this:
Adapter 0
Description: Intel(R) HD Graphics 630
Vendor ID: 0x8086
Device ID: 0x5912
SubSys ID: 0x86941043
Revision: 4
Luid: 46459
Flags: None
Dedicated Video Memory: 128 MB
Dedicated System Memory: 0 MB
Shared System Memory: 8092 MB
Adapter 2
Description: Microsoft Basic Render Driver
Vendor ID: 0x1414
Device ID: 0x8C
SubSys ID: 0x0
Revision: 0
Luid: 50158
Flags: Software
Dedicated Video Memory: 0 MB
Dedicated System Memory: 0 MB
Shared System Memory: 8092 MB
I have noticed that an additional adapter appears in the list of available adapters when RDP is used. The additional adapter has the same properties as the physical one; the only difference is in the LUID. The output looks something like this:
Adapter 0
Description: Intel(R) HD Graphics 630
Vendor ID: 0x8086
Device ID: 0x5912
SubSys ID: 0x86941043
Revision: 4
Luid: 46459
Flags: None
Dedicated Video Memory: 128 MB
Dedicated System Memory: 0 MB
Shared System Memory: 8092 MB
Adapter 1 // <- additional addapter
Description: Intel(R) HD Graphics 630
Vendor ID: 0x8086
Device ID: 0x5912
SubSys ID: 0x86941043
Revision: 4
Luid: 1322913970
Flags: None
Dedicated Video Memory: 128 MB
Dedicated System Memory: 0 MB
Shared System Memory: 8092 MB
Adapter 2
Description: Microsoft Basic Render Driver
Vendor ID: 0x1414
Device ID: 0x8C
SubSys ID: 0x0
Revision: 0
Luid: 50158
Flags: Software
Dedicated Video Memory: 0 MB
Dedicated System Memory: 0 MB
Shared System Memory: 8092 MB
I'm aware that the additional adapter is some kind of virtual adapter used by RDP. I have tried both of them, and it seems that both are suitable for video decoding using FFmpeg.
However, from a UX perspective, it doesn't look or feel right that the combo box contains two adapters with the same name. So my question is: how can I distinguish a physical adapter from a virtual adapter used by the Remote Desktop Protocol?
Provided question How to check if a true hardware video adapter is used by Simon Mourier helped me figure out exactly what I needed. Much appreciated!
It appears that the registry key "SOFTWARE\Microsoft\DirectX" holds a collection of subkeys representing real adapters. There is no key for the additional adapter used by RDP. Therefore, it's enough to compare the output from the D3D EnumAdapters with the list of adapters in the registry (and omit those that are not present in the registry).
My solution looks something like this:
I didn't find any documentation that would confirm my findings, so please take that into consideration.