Win 10 x64, GTX 970, Nsight 5.6.0.18146
Win 10 x64, GTX 650, Nsight 5.5
Starting app with a “Start graphics debugging” option causes following compilation error on geometry shader:
fatal error C9999: *** exception during compilation ***
When running the app without Nsight debugger, the shader compiles without any problems.
I’ve found following:
The geometry shader writes to an “out” variable (a vec3 array) that is not used in a linked fragment shader (however, it’s still declared as an “in”). If I remove the assignment statement (“unused[i] = … ;”) from the geometry shader code, the problem goes away.
//Vertex shader
#version 410
layout(location = 0) in vec3 vertexPosition;
out VS
{
vec3 unused[2];
} output;
void main()
{
gl_Position = vec4(vertexPosition, 1.0);
for (int i = 0; i < 2; i++)
{
output.unused[i] = vertexPosition;
}
}
//Geometry shader
#version 410
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
in VS
{
vec3 unused[2];
} input[];
out FS
{
vec3 unused[2];
} output;
void main()
{
for (int vertexIndex = 0; vertexIndex < gl_in.length(); vertexIndex++)
{
gl_Position = gl_in[vertexIndex].gl_Position.xyzw;
for (int i = 0; i < 2; i++)
{
output.unused[i] = input[vertexIndex].unused[i]; // <-- This line causes the problem
}
EmitVertex();
}
}
//Fragment shader
#version 410
in FS
{
vec3 unused[2];
} input;
out vec4 fragmentColor;
void main()
{
vec3 color = vec3(0, 0, 0);
fragmentColor = vec4(color, 1.0);
}
Also, the shader links normally if I replace following line in the fragment shader:
vec3 color = vec3(0, 0, 0);
with
vec3 color = input.unused[0] + input.unused[1] + vec3(0, 0, 0);
I’d suggest disabling shader debugging to see if that eliminates the problem. It’s under the Nsight options.
If that doesn’t help, try the latest version, 6.0, and see if that still has the issue.
Thank you
Indeed, the problem doesn’t occur on NSight 5.6 with shader debugging option set to “Disabled”