0

I have a GLSL program that works on some machines, but fails to link on on one particular machine. I suspect a driver bug, but hope that someone will recognize something I'm doing as being poorly supported, and suggest an alternative.

If I omit the geometry shader, the vertex and fragment shaders link successfully.

The error log after the link error says:

Vertex shader(s) failed to link, fragment shader(s) failed to link, geometry shader(s) failed to link.
ERROR: error(#275) Symbol 'gl_AtiVertexData' is defined with 2 different types between two stages
ERROR: error(#275) Symbol 'gl_AtiVertexData' is defined with 2 different types between two stages
ERROR: error(#275) Symbol 'gl_AtiVertexData' is defined with 2 different types between two stages

My code does not contain the symbol gl_AtiVertexData, and Google finds no hits for it.

The GL_RENDERER string is "ATI Mobility Radeon HD 4670", GL_VERSION is "3.3.11672 Compatibility Profile Context", and GL_SHADING_LANGUAGE_VERSION is 3.30.

I've trimmed down my shader programs as much as possible, so that they no longer pretend to do anything useful, but still reproduce the problem.

Vertex shader:

#version 330
in vec4 quesaVertex;
out VertexData {
    vec4 interpolatedColor;
};
void main()
{
    gl_Position = quesaVertex;
    interpolatedColor = vec4(1.0);
}

Geometry shader:

#version 330
layout (triangles) in;
layout (triangle_strip, max_vertices=3) out;

in VertexData {
    vec4 interpolatedColor;
} gs_in[];
out VertexData {
    vec4 interpolatedColor;
} gs_out;

void main() {
    gl_Position = gl_in[0].gl_Position;
    gs_out.interpolatedColor = gs_in[0].interpolatedColor;
    EmitVertex();
    gl_Position = gl_in[1].gl_Position;
    gs_out.interpolatedColor = gs_in[1].interpolatedColor;
    EmitVertex();
    gl_Position = gl_in[2].gl_Position;
    gs_out.interpolatedColor = gs_in[2].interpolatedColor;
    EmitVertex();
    EndPrimitive();
}

Fragment shader:

#version 330
in VertexData {
    vec4 interpolatedColor;
};
out vec4 fragColor;

void main()
{
    fragColor = interpolatedColor;
}

Later information:

When I tried renaming the interface block VertexData to IBlock, then the error message talked about a symbol gl_AtiIBlock instead of gl_AtiVertexData, so that symbol name was a red herring.

If I don't use interface blocks, then the program links correctly. That's a bother, because I'll need to write the vertex or fragment shader differently depending on whether there is a geometry shader between the vertex and fragment shaders, but maybe that's what I need to do.

JWWalker
  • 22,385
  • 6
  • 55
  • 76
  • Where do you declare the type for `VertexData`? If you want a structure then use `struct` before `VertexData`. Because you say these are "trimed" shaders, I suppose you have a good reason to use structures instead of plain/arrays `in/out` vars. – Ripi2 Dec 13 '19 at 23:20
  • 1
    @Ripi2: "*Where do you declare the type for VertexData?*" It's an interface block, not a struct. It's a standard GLSL named construct. – Nicol Bolas Dec 13 '19 at 23:42
  • Have you tried not using interface blocks where possible? – Andrea Dec 15 '19 at 11:23
  • @Andrea: thanks for the idea, it does work without interface blocks. I added information about that to the question. – JWWalker Dec 16 '19 at 19:25
  • Anything change if you request a Core context? – genpfault Dec 17 '19 at 02:27
  • 1
    @genpfault, same thing happens with a 3.3 or 3.2 core profile context. – JWWalker Dec 17 '19 at 23:46

0 Answers0