Sign in to follow this  

Can't pass enumerated adapter in D3D11CreateDeviceAndSwapChain

Recommended Posts

So I have a pretty standard initialization call of D3D11
if(FAILED(hr = D3D11CreateDeviceAndSwapChain(this->m_pAdapter, pArgs->DriverType, pArgs->Software, pArgs->Flags, pArgs->pFeatureLevels, pArgs->numFeatureLevels,
	D3D11_SDK_VERSION, pArgs->pSwapChainDesc, &pSwapChain, &pDevice, pArgs->pFeatureLevel, &pContext))){
		return hr;
where pArgs->stuff is passed to the function via a structure to decrease the complexity of the function call. I got m_pAdapter via an IDXGIFactory (m_pFactory) like this:
this->m_pFactory->EnumAdapters(0, &this->m_pAdapter);
This is odd, because the first argument is supposed to be the the adapter to use and if null, the first enumerated adapter, which is the one I have, and it fails. However, passing NULL does not cause it to fail.

Any ideas on what could be causing my call to fail?

Share this post

Link to post
Share on other sites

If are passing an enumerated adapter, then you should use D3D_DRIVER_TYPE_UNKNOWN for the driver type.  On the other hand, if you are passing nullptr for the adapter, then you can pass the desired driver type as you have shown above.


You can check out the RendererDX11::Initialize(...) function from Hieroglyph 3 for an example. 


Does that help your initialization call?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this