debugging extremely slow after CreateSwapChain

Started by
0 comments, last by Nick C. 9 years, 6 months ago

Hello everyone

Everything was going well with the project I'm working on, until suddenly it's almost impossible to debug my code.

I can step over all my instructions in Visual Studio just fine, until I try to create a swap chain. From then on, I can barely move my mouse (5+ seconds to see change), and everything in visual studio takes a very long time. Stepping over instructions then take up to 5 seconds and almost 20 seconds to stop debugging (shift + F5). All other programs running on my computer have no problems though.

I've used this code for over two years now, and never had any problems.

At this point, it's just impossible to continue my work if I can't solve this problem. Any help would be greatly appreciated.

Edit: I also notice calling std::exit(0) takes longer than usual.

Code (in case it matters):


bool D3DApp::InitD3D()
{
	UINT createDeviceFlags = 0;
#if defined(DEBUG) || defined(_DEBUG)  
	createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

	D3D_FEATURE_LEVEL featureLevel;
	HR(D3D11CreateDevice(
		0,                 // default adapter
		D3D->md3dDriverType,
		0,                 // no software device
		createDeviceFlags,
		0, 0,              // default feature level array
		D3D11_SDK_VERSION,
		&D3D->md3dDevice,
		&featureLevel,
		&D3D->md3dImmediateContext), "D3D11CreateDevice failed.");

	if (featureLevel != D3D_FEATURE_LEVEL_11_0)
	{
		MessageBox(0, "Direct3D Feature Level 11 unsupported.", 0, 0);
		return false;
	}

	HR(D3D->md3dDevice->CheckMultisampleQualityLevels(
		DXGI_FORMAT_R8G8B8A8_UNORM, 4, &D3D->m4xMsaaQuality), "Multisample quality level not supported by device.");

	DXGI_SWAP_CHAIN_DESC sd;
	sd.BufferDesc.Width = WINDOW->mClientWidth;
	sd.BufferDesc.Height = WINDOW->mClientHeight;
	sd.BufferDesc.RefreshRate.Numerator = 60;
	sd.BufferDesc.RefreshRate.Denominator = 1;
	sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
	sd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
	sd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;


	if (D3D->mEnable4xMsaa)
	{
		sd.SampleDesc.Count = 4;
		sd.SampleDesc.Quality = D3D->m4xMsaaQuality - 1;
	}
	else
	{
		sd.SampleDesc.Count = 1;
		sd.SampleDesc.Quality = 0;
	}

	sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
	sd.BufferCount = 1;
	sd.OutputWindow = mhMainWnd;
	sd.Windowed = true;
	sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
	sd.Flags = 0;

	IDXGIDevice* dxgiDevice = 0;
	HR(D3D->md3dDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice), "D3D::md3dDevice->QueryInterface failed.");
	IDXGIAdapter* dxgiAdapter = 0;
	HR(dxgiDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&dxgiAdapter), "dxgiDevice->GetParent failed.");
	IDXGIFactory* dxgiFactory = 0;
	HR(dxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void**)&dxgiFactory), "dxgiDevice->GetParent failed.");
	HR(dxgiFactory->CreateSwapChain(D3D->md3dDevice, &sd, &D3D->mSwapChain), "dxgiFactory->CreateSwapChain failed.");

	ReleaseCOM(dxgiDevice);
	ReleaseCOM(dxgiAdapter);
	ReleaseCOM(dxgiFactory);

	OnResize();

	return true;
}
Advertisement

I have solved my problem by updating my graphics driver. That was dumb of me, should've been my first thought.
This topic can be closed if needed.

This topic is closed to new replies.

Advertisement