Why does Visual studio 2015 keep crashing my display driver?

I searched through google for a solution but i can't seem to find it. I am trying to draw a triangle with direct3d 11 but every time i compile the code, my display driver (nvidia) keeps crashing and recovers immediately. This happens when i use the function Draw() from the interface ID3D11DeviceContext in my message loop.

Here is my message loop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
int MessageLoop()
{
	MSG 
	ZeroMemory(&msg, sizeof(MSG));				

	while (true)
	{
		if (PeekMessage(&msg, MainWindow, 0, 0, PM_REMOVE))	
		{
			if (msg.message == WM_QUIT || msg.message == WM_CLOSE)	
				break;												

			TranslateMessage(&msg);							
			DispatchMessage(&msg);							
		}

		else	                                            
		{
			DrawScene();									
		}

	}
	return msg.wParam;

}

and here is my DrawScene() function

1
2
3
4
5
6
7
8
9
void DrawScene()
{	
	D3DXCOLOR bgColor (0.1f, 0.2f, 0.0f, 0.0f);					

	DevContext->ClearRenderTargetView(RenderTarget, bgColor);	
	DevContext->Draw(3, 0);		      /*if i remove this, then the display driver wont crash. But then the triangle wont show in the window */								

	SwapChain->Present(0, 0);								
}


I just recently updated my driver but it still wont work. I already set up my swap chain and a render target, i also set up a vertex buffer with the input layout, as well as the primitive topology type
Last edited on
Topic archived. No new replies allowed.