1

I'm using Geometry Shaders for Geometry Amplification. The code runs perfectly with Intel graphics both in Windows and OS X.

I change the configs to use the dedicated NVIDIA GPU from my windows machine aaaaaaaaaaand... nothing.

This code:

    void testError(std::string src) {
        GLenum err = glGetError();
       if (err != GL_NO_ERROR){
           printf("(%s) Error: %s %d\n", src.c_str(), gluErrorString(err), err);
        }
    }

    ...

    printf("glIsProgram: %s\n", glIsProgram(shaderProgram)?"True":"false");
    glUseProgram(shaderProgram);
    testError("GOGO 111");
    GLint isLinked = 0;
    glGetProgramiv(shaderProgram, GL_LINK_STATUS, (int *)&isLinked);
    if (isLinked == GL_FALSE)
    {
        GLint maxLength = 0;
        glGetProgramiv(shaderProgram, GL_INFO_LOG_LENGTH, &maxLength);

        //The maxLength includes the NULL character
        std::vector<GLchar> infoLog(maxLength);
        glGetProgramInfoLog(shaderProgram, maxLength, &maxLength, &infoLog[0]);
        printf("Program Not Linked %d:\n %s\n", maxLength, infoLog);
        //We don't need the program anymore.
        glDeleteProgram(shaderProgram);

        //Use the infoLog as you see fit.

        //In this simple program, we'll just leave
        return 0;
    }

Outputs:

    glIsProgram: True
    (GOGO 111) Error: invalid operation 1282
    Program Not Linked 116:
     ­Ð

Also the Log have a strange behaviour since it is not printing nothing but the length would be 116.

Thank you.

EDIT This:

char * infoLog;
glGetProgramiv(shaderProgram, GL_INFO_LOG_LENGTH, &maxLength);

Printed out the result.

Program Not Linked 116:
 Geometry info
 -------------
 (0) : error C6033: Hardware limitation reached, can only emit 128 vertices of this size

Which comes from:

const GLchar* geometryShaderSrc = GLSL(
    layout(points) in;
    layout(triangle_strip, max_vertices = 256) out;
...

It's just weird that the Intel integrated GPUS have less hardware (memory?) imitations that an NVIDIA GPU. Any solution to go around this without decreasing the vertices?

Alkart
  • 96
  • 1
  • 7
  • Wouldn't you need to convert your std::vector to a char array for `printf` to work with it ? – LJᛃ Mar 01 '16 at 17:52
  • 1
    Use `infoLog.data()` as the last argument of the "Program Not Linked" `printf` call. – Colin Basnett Mar 01 '16 at 18:00
  • When you copied-and-pasted that from the OpenGL Wiki, did you not notice the "Use the infoLog as you see fit." part? "as you see fit" would include useful things like *printing it out*. – Nicol Bolas Mar 01 '16 at 19:49
  • you should use `glGetShaderInfoLog` for each of your shaders separately to see what s really wrong. see [complete GL+VAO/VBO+GLSL+shaders example in C++](http://stackoverflow.com/a/31913542/2521214) for info how to use it... not just for the linked program ... Also if your shader is the problem why you did not copy it here so we can see it ... – Spektre Mar 03 '16 at 13:37
  • Thanks @LJᛃ, that printed the result. – Alkart Mar 04 '16 at 14:45
  • @Spektre I was using that when I compile the shaders without any errors, the error was just n linking time. – Alkart Mar 04 '16 at 14:46

1 Answers1

1

It looks like you're exceeding the GEOMETRY_TOTAL_OUTPUT_COMPONENTS limit.

In the OpenGL 4.4 Spec - Section 11.3.4.5 - page 388

The product of the total number of vertices and the sum of all components of all active output variables may not exceed the value of MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS. LinkProgram will fail if it determines that the total component limit would be violated.

i.e max_vertices cannot exceed MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS / number_of_components

The minimum requirements are detailed in Table 23.60 - page 585

GEOMETRY_TOTAL_OUTPUT_COMPONENTS 1024

It seems like you have 8 components, so can only have 128 vertices. You must either decrease the number of components, or decrease the number of vertices.

Check the value of GEOMETRY_TOTAL_OUTPUT_COMPONENTS on each device to make sure.

Swifter
  • 211
  • 1
  • 5