View Single Post
Old 08 November 2017, 19:36   #90
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,094
Currently you do this:
static const D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0 };
...
result = pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, cdflags, levels, 2, D3D11_SDK_VERSION, &d3d->m_device, NULL, &d3d->m_deviceContext);


The MSDN page about D3D11CreateDevice says:
"If you provide a D3D_FEATURE_LEVEL array that contains D3D_FEATURE_LEVEL_11_1 on a computer that doesn't have the Direct3D 11.1 runtime installed, this function immediately fails with E_INVALIDARG."

So D3D11CreateDevice() will fail on machines which don't have the D3D 11.1 runtime. That includes:
- Windows Vista or Server 2008 with KB971512 platform update providing D3D 11.0 runtime
- Windows 7 without KB2670838 platform update

To avoid failing unnecessarily, you could change the above code to
static const D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_0 };
...
result = pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, cdflags, levels, 1, D3D11_SDK_VERSION, &d3d->m_device, NULL, &d3d->m_deviceContext);


Or do that if the initial 11_1/11_0 call fails.
mark_k is offline  
 
Page generated in 0.04084 seconds with 11 queries