Graphics Debugging crash on startup

I have made a simple application using SDL 2 which I want to debug with NVidia NSight. It creates a 960x540 window and executes renderInit() before the main loop, render() on every cycle and renderFin() when the application exits. On every render it is supposed to display a tesselated triangle. The source code for these 3 functions and shader code can be found here.

However, when I try to run the application, it crashes.

Nsight’s minidump: here

EDIT: FIXED! I was running with the wrong graphics device.

Hi StelarCF,

seems I can’t download the mindump file you uploaded to, actually, we do received the email from your gmail, could you re-send with minidump attached?

on the other hand, I need more info for investigate:

  • nsight version
  • OS version, driver version, GPU
  • it’s better to have your sample’s binary exe file to do investigate, with source code is even better.


I have resent the email with the minidump, info and the source code. I couldn’t send the binaries, because gmail doesn’t accept executables and I am on a slow, hotel internet right now.

I have resent the email to the other email; has it been received?

Edit: I think I’ve found the place where Nsight crashes (by commenting/decommenting lines):

static const GLchar *vertex_shader_source[] = {
		"#version 430 core														\n"
		"																		\n"
		"layout (location = 0) in vec4 offset;									\n"
		"																		\n"
		"void main(void) {														\n"
		"	const vec4 vertices[3] = vec4[3](vec4(0.25, -0.25, 0.5, 1.0),		\n"
		"									 vec4(-0.25, -0.25, 0.5, 1.0),		\n"
		"									 vec4(0.25, 0.25, 0.5, 1.0));		\n"
		"	gl_Position = vertices[gl_VertexID] + offset;						\n"
		"}																		\n"
	}, *fragment_shader_source[] = {
		"#version 430 core														\n"
		"																		\n"
		"out vec4 color;														\n"
		"																		\n"
		"void main(void) {														\n"
		"	color = vec4(0.0, 0.8, 1.0, 1.0);									\n"
		"}																		\n"

GLuint program;
GLuint vertex_array_object;

void renderInit() {
	GLuint vertex_shader, fragment_shader;
	vertex_shader = glCreateShader(GL_VERTEX_SHADER);
	fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
	glShaderSource(vertex_shader, 1, vertex_shader_source, NULL);
	glShaderSource(fragment_shader, 1, fragment_shader_source, NULL);
	GLint cs;
	program = glCreateProgram();
	glAttachShader(program, vertex_shader);
	glAttachShader(program, fragment_shader);
	glLinkProgram(program); // line of code that causes Nsight to crash when decommented

(third to last line of code in renderInit())

Hi Stelarcf,

I got your dmp file and source files. but hard to say that I can repro your issues locally. Maybe you can package your run-able sample [which crash at startup with nsight] in a zip file, rename it like *.zip_, then send it to me with your gmail. Sorry that I can’t access your google drive. Please note, the zip file should include all exe, dll, and resources files for run it standalone in another machine, like my test machine, otherwise, it will be difficult for me to investigate.

I also checked the source codes you posted here, this really reminds me another case, that may be similar to yours. Previously, a sample create a OGL ES compatible context [WGL_CONTEXT_ES2_PROFILE_BIT_EXT], when launch with nsight, it will also crash at glLinkProgram, since Nsight don’t support ES context. What’s the version of OGL context you are creating and using? Do you add some special tag/attribute for it?


I’ve (re)sent the zip file to the email.

I’ve also attempted setting the context through OpenGL.

However, I think I might have found a potential issue - my laptop has two graphics devices (one Intel HD Graphics 4600 and one GT 750M). It is possible (judging from querying the OpenGL Renderer: ) that this may be causing the crash (since shader compiling and linking is a GPU-dependent task). I’ll attempt to force the GT 750M to run, and I’ll edit/post the results here.

EDIT: It appears that fixed the issue, though it’d still be useful to know how to do this from VS2013 instead of forcing it globally.

EDIT 2: I’ve figured that out too, from the “Program Settings” :)

Hi Stelarcf,

Seems you are using Laptop with Optimus system, although you can force use NV gpu by setting Program Settings, but I have to say Nsight don’t support Optimus system official right now, we have some feature request to support that system in our database.

When I run your sample locally on a desktop machine, it seems using glPolygonMode with mode=0x00000009, which should not be OGL 4.2 core, glPolygonMode’s mode only support GL_POINT[0x1B00], GL_LINE[0x1B01], GL_FILL[0x1B02], 0x0009 seems like GL_POLYGON: