[DX11] Unable to create device/swapchain

Started by
2 comments, last by w00key 13 years, 1 month ago
[font="Arial"]I've created a sample app to do some testing and I passed it to a friend and it's failing to create the device/swapchain.

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 {
Advertisement
Perhaps he doesn't have the debug layer installed. Try not using D3D11_CREATE_DEVICE_DEBUG.
Ok I will do, it may take a day or so to confirm as I'm giving him test versions via email.

If that is the case is it just breaking on that function because its the first directx function call then? It would explain the weird error.
Confirmed that was the cause, thanks for the help.

This topic is closed to new replies.

Advertisement