Hi all I have a pretty odd problem. When I step through my code from the beginning of the program its fine but when I get to the section in my code to create the device and swap chain Visual Studio starts lagging for input and becomes unuseable. My mouse also gives really delayed response. The only way to stop it is to ctrl+alt+del and close Visual Studio.
Here's the code up to the line in question.
HRESULT hr = S_OK;
RECT rc;
GetClientRect((*pWindowHandle), &rc);
UINT width = rc.right - rc.left;
UINT height = rc.bottom - rc.top;
UINT createDeviceFlags = 0;
#ifdef _DEBUG
createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
D3D_DRIVER_TYPE driverTypes[] =
{
D3D_DRIVER_TYPE_HARDWARE,
D3D_DRIVER_TYPE_WARP,
D3D_DRIVER_TYPE_REFERENCE,
};
UINT numDriverTypes = ARRAYSIZE(driverTypes);
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_0
};
UINT numFeatureLevels = ARRAYSIZE(featureLevels);
DXGI_SWAP_CHAIN_DESC sd;
ZeroMemory(&sd, sizeof(sd));
sd.BufferCount = 1;
sd.BufferDesc.Width = width;
sd.BufferDesc.Height = height;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferDesc.RefreshRate.Numerator = 60;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.OutputWindow = (*pWindowHandle);
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.Windowed = TRUE;
sd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; // allow full-screen switching
for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++)
{
m_driverType = driverTypes[driverTypeIndex];
hr = D3D11CreateDeviceAndSwapChain(NULL, m_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels,
D3D11_SDK_VERSION, &sd, &m_pSwapChain, &m_pd3dDevice, &m_featureLevel, &m_pImmediateContext);
if (SUCCEEDED(hr))
break;
}
I've got a feeling it might have to do with visual studio rather than the project since the D3D11 sample projects also do the same. They run fine but as soon as you try to pause or break VS throws a wobbly. I've already tried repairing my version of VS2013 Update2
Is there something that can help me?
Output from the debug folder
Build started 02/11/2014 16:24:14.
1>Project "C:\Users\luckielordie\Source\Repos\3dtut2\Tutorial02_2010.vcxproj" on node 2 (Build target(s)).
1>ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /I..\..\..\DXUT11\Core /I..\..\..\DXUT11\Optional /ZI /nologo /W4 /WX- /Od /Oi /Oy- /D WIN32 /D _DEBUG /D DEBUG /D PROFILE /D _WINDOWS /D D3DXFX_LARGEADDRESS_HANDLE /D _UNICODE /D UNICODE /Gm- /EHsc /RTC1 /MDd /GS /arch:SSE2 /fp:fast /Zc:wchar_t /Zc:forScope /openmp- /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt D3D11.cpp
D3D11.cpp
Link:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\luckielordie\Source\Repos\3dtut2\Debug\D3DApplication.exe" /INCREMENTAL /NOLOGO d3d11.lib d3dcompiler.lib dxguid.lib winmm.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /manifestinput:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\Include\Manifest\dpiaware.manifest" /DEBUG /PDB:"C:\Users\luckielordie\Source\Repos\3dtut2\Debug\D3DApplication.pdb" /SUBSYSTEM:WINDOWS /LARGEADDRESSAWARE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\luckielordie\Source\Repos\3dtut2\Debug\D3DApplication.lib" /MACHINE:X86 /SAFESEH /SAFESEH:NO Debug\Tutorial02.res
Debug\D3D11.obj
Debug\D3D11ResourceBuilder.obj
Debug\Game.obj
Debug\GameObject.obj
Debug\main.obj
Debug\Model.obj
Debug\Shader.obj
Debug\Window.obj
Tutorial02_2010.vcxproj -> C:\Users\luckielordie\Source\Repos\3dtut2\Debug\D3DApplication.exe
1>Done Building Project "C:\Users\luckielordie\Source\Repos\3dtut2\Tutorial02_2010.vcxproj" (Build target(s)).
Build succeeded.
Time Elapsed 00:00:01.42
EDIT: On that line in the Output I get a line
A thread <threadnumber> has exited with code 0(0x0)
I had exactly the same problem and it was solved by updating video drivers (I have nVidia GeForce 660, and now I use 344.75, I installed it using "clean" option). Previous driver was 335 or something. Also if it doesn't help, try disabling nVidia ShadowPlay (it didn't help me though), I think some problem can lie there, if it installs some keyboard hook inside D3D.