Geometry Shader and Adjacency Primitive Modes

I’ve come across something strange when using lines with adjacency with a geometry shader. It seems that all varyings except position are being lost.

Vertex shader:

void main()
{
    gl_Position = ftransform();
    gl_FrontColor = vec4(1.0, 1.0, 0.0, 1.0);
}

Geometry shader:

void main()
{
    gl_Position = gl_PositionIn[1];
    gl_FrontColor = gl_FrontColorIn[1];
    EmitVertex();

    gl_Position = gl_PositionIn[2];
    gl_FrontColor = gl_FrontColorIn[2];
    EmitVertex();

    EndPrimitive();
}

Fragment shader:


void main()
{
    gl_FragColor = gl_Color;
}

I’m using the appropriate #extension directives, and the shaders compile without error.

I’m using line strips with adjacency. When I render, I see black lines, which is incorrect. Even more strange is that for the left adjacent vertex (index 0 in the geometry shader), all of the data is there. I looked at the specification and found the following:

Additional “adjacency” primitives are available which also make the
transformed attributes of neighboring vertices available to the shader.
The results of the shader are a new set of transformed vertices, arranged
into primitives by the shader.

I’m using an 8800 GTS in Linux with driver version 177.13. I have reported this to NVIDIA but have not gotten an indication as to whether or not this is a bug.

Has anyone else experienced this problem?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.