• Advertisement
Sign in to follow this  

Creating device for multiple adapters

This topic is 2068 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

D3D11CreateDevice() can take an optional parameter of the Adapter to use when creating the device, however.. if you have multiple GPU's you can have more than one Adapter on your computer, and AFAIK the only way to retrieve the available adapters is using DXGIFactory::EnumAdapters().

However, If I try to create a Factory and create the device like this:

[CODE]
IDXGIFactory *pFactory;
CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void**>(&pFactory) );

IDXGIAdapter *pAdapter = nullptr;
for( int i=0; pFactory->EnumAdapters( i, &pAdapter ) != DXGI_ERROR_NOT_FOUND; i++ )
{
D3D11CreateDevice( pAdapter, DriverType, 0, creationFlags, 0, 0, D3D11_SDK_VERSION, &m_pDirect3D, &m_featureLevel, &m_pDeviceContext );
}
[/CODE]

The call fails... but if I set the pAdapter parameter to NULL then the device is created correctly...

so, if it's not this way, how is one supposed to retrieve the adapter and pass it to the D3D11CreateDevice() function?

Thanks Edited by ???

Share this post


Link to post
Share on other sites
Advertisement
I've set up code that uses an adapter index to query a certain adapter from a DXGI factory, which is then passed to D3D11CreateDevice to create a device for that adapter. For the life of me I can't remember why, but I had to use D3D_DRIVER_TYPE_UNKNOWN to get it to work. Edited by MJP

Share this post


Link to post
Share on other sites
Thanks [b]MJP[/b],

I have just tested using D3D_DRIVER_TYPE_UNKNOWN as you suggested, however it sends the same E_INVALIDARG error.

and since if I set the first parameter to NULL it works just fine, it makes me think that for some reason the Adapter and Device should be created with the same Factory, but that could become a chicken-egg problem [img]http://public.gamedev.net//public/style_emoticons/default/wacko.png[/img]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement