After looking at the documentation when I first presumed the HRESULT error code would be one of these : MSDN:D3D11ErrorCodes
from here: MSDN:D3D11CreateDeviceAndSwapchain
I just output the HRESULT and found it linked to -2005270524 and DXGI_ERROR_UNSUPPORTED however my friend is running it on an
Nvidia gtx 570 (latest stable drivers, checked for this app) and using vista x64 sp2 (which I thought was supposed to add DX11 support he gave me a screenshot of dxdiag confirming dx11)
Any ideas on why its failing?
It should in theory fallback on versions because its code taken from the samples Microsoft provided.[/font]
const int createDeviceFlags = D3D11_CREATE_DEVICE_DEBUG; //| D3D10_CREATE_DEVICE_SINGLETHREADED;
//const int createDeviceFlags = 0;
const int nDriverTypes = 3;
const int nFeatureLvls = 6;
HRESULT hr = S_OK;
D3D11_VIEWPORT vp;
//Features, drivers to use/fallback to
D3D_DRIVER_TYPE driverTypes[] = { D3D_DRIVER_TYPE_HARDWARE, D3D_DRIVER_TYPE_WARP, D3D_DRIVER_TYPE_REFERENCE };
D3D_FEATURE_LEVEL featureLvls[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_3, D3D_FEATURE_LEVEL_9_2, D3D_FEATURE_LEVEL_9_1 };
//Window size
RECT rc;
GetClientRect(hWnd, &rc );
const int width = rc.right - rc.left;
const int height = rc.bottom - rc.top;
height_ = height;
width_ = width;
//SwapChain
DXGI_SWAP_CHAIN_DESC swapChainDesc;
ZeroMemory( &swapChainDesc, sizeof( swapChainDesc ) );
swapChainDesc.BufferCount = 1;
swapChainDesc.BufferDesc.Width = width;
swapChainDesc.BufferDesc.Height = height;
swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
swapChainDesc.BufferDesc.RefreshRate.Numerator = 0; //users =0, originally 60
swapChainDesc.BufferDesc.RefreshRate.Denominator = 0;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.OutputWindow = hWnd;
swapChainDesc.SampleDesc.Count = 1;
swapChainDesc.SampleDesc.Quality = 0;
swapChainDesc.Windowed = TRUE;
for(int i = 0; i < nDriverTypes; i++ )
{
driverType_ = driverTypes;
hr = D3D11CreateDeviceAndSwapChain( NULL, driverType_, NULL, createDeviceFlags, featureLvls, nFeatureLvls, D3D11_SDK_VERSION, &swapChainDesc, &swapChain_, &device_, &featureLvl_, &context_ );
if(SUCCEEDED(hr))
break;
}
if(FAILED(hr)) //Failed quit function
//Do something {