Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


Creating device for multiple adapters


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 はとぶ   Members   -  Reputation: 320

Like
0Likes
Like

Posted 20 May 2012 - 01:46 PM

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:

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 );
}

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 はとぶ, 20 May 2012 - 01:47 PM.

"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"

Sponsor:

#2 はとぶ   Members   -  Reputation: 320

Like
0Likes
Like

Posted 23 May 2012 - 07:29 PM

nobody has done this before?
"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"

#3 MJP   Moderators   -  Reputation: 11585

Like
0Likes
Like

Posted 23 May 2012 - 07:51 PM

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, 23 May 2012 - 07:52 PM.


#4 はとぶ   Members   -  Reputation: 320

Like
0Likes
Like

Posted 23 May 2012 - 08:57 PM

Thanks MJP,

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 Posted Image
"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS