# After creating DirectX11 Device, enumerating the DXGI Adapters seems to produce invalid results

EDIT: This is part of an upgrade from DirectX10 to DX11.

When I create a DirectX 11 device with D3D11CreateDevice(), it chooses a video adapter for me. I access this object like so:

// removed HRESULT checks for brevity- normally I print errors on failed hr

IDXGIDevice1*  pDXGIDevice = NULL;
HRESULT hr = mpDXDevice->QueryInterface( &pDXGIDevice );



However, later, when I enumerate the adapters, this adapter is not on the list:

IDXGIDevice*  pDXGIDevice = NULL;
HRESULT hr = mpDXDevice->QueryInterface( &pDXGIDevice );

// so far so good: pAdapter matches my current adapter I saved from above

IDXGIFactory* pFactory;

UINT i = 0;
while( SUCCEEDED( hr ) && hr != DXGI_ERROR_NOT_FOUND )
{

// none of these padapters matches the current adapter!!
i++;
}


After this section, I have a list of the enumerated adapters. My current adapter is not in the list! Instead there is a DIFFERENT adapter with the same name as my current one.

Most importantly (this is the part I actually need) if I call D3D11CreateDevice() with this enumerated (different) adapter specified, I get E_INVALIDARG.

What am I doing wrong to generate these alternative, invalid adapters?

• How are you comparing the adapters? Aug 25 '16 at 6:40
• Pointer equality! Maybe that's a mistake - hope it's still relevant though :D Aug 25 '16 at 7:59
• Maybe you can explain why are you doing this? You already have the adapter so you can just query it directly for information without having to look it up in the enumeration. Pointer equality is unreliable with COM objects. The only way to really tell if two DXGI adapters are the same thing is to compare the DXGI_ADAPTER_DESC.AdapterLuid. Aug 25 '16 at 16:38
• The critical part is being able to create a D3D11Device with a specified adapter. My customers need this as an option in case they want to be able to switch from the default one chosen. Sounds like the pointer comparison is a red herring. Aug 25 '16 at 19:39