title: Unable to use separate shader programs "<program> object is not successfully linked."
body: <pre><code> const char *vs_source =
        "#version 440\n\
        layout(location = 0) in vec2 position;\n\
        layout(location = 1) in float offset;\n\
        void main() {\n\
          vec2 new_pos = vec2(position.x + offset,position.y);\n\
          gl_Position = vec4(new_pos,0,1);\n\
                    }";
  
   const char *fs_source =
        "#version 440\n\
        out vec4 out_color;\n\
        void main() {\n\
          out_color = vec4(1,0,0,1);\n\
                    }";
  
   auto vsp = createShaderProgram(GL_VERTEX_SHADER,1,&amp;vs_source);
   auto fsp = createShaderProgram(GL_FRAGMENT_SHADER,1,&amp;fs_source);
   GLuint pipeline;
   glGenProgramPipelines(1,&amp;pipeline);
   glUseProgramStages(pipeline, GL_VERTEX_SHADER_BIT  , vsp.handle);
   glUseProgramStages(pipeline, GL_FRAGMENT_SHADER_BIT, fsp.handle);
   glBindProgramPipeline(pipeline);
  </code></pre>
  
  <p>with</p>
  
  <pre><code>  struct Program{
        GLuint handle;
    };
    Program createShaderProgram(GLenum type,
                                GLsizei count,
                                const char **strings){
      const GLuint shader = glCreateShader(type);
      if (shader) {
        glShaderSource(shader, count, strings, NULL);
        glCompileShader(shader);
        const GLuint program = glCreateProgram();
        if (program) {
          GLint compiled = GL_FALSE;
          glGetShaderiv(shader, GL_COMPILE_STATUS, &amp;compiled);
          glProgramParameteri(program, GL_PROGRAM_SEPARABLE, GL_TRUE);
          if (compiled) {
            glAttachShader(program, shader);
            glLinkProgram(program);
            glDetachShader(program, shader);
          }
          else{
            /* append-shader-info-log-to-program-info-log */
            GLint infoLogLength;
            glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &amp;infoLogLength);
  
            GLchar* infoLog = new GLchar[infoLogLength + 1];
            glGetShaderInfoLog(shader, infoLogLength, NULL, infoLog);
  
            std::cout &lt;&lt; "ERROR: Unable to compile shader" &lt;&lt; std::endl &lt;&lt; infoLog &lt;&lt; std::endl;
            delete[] infoLog;
          }
        }
        glDeleteShader(shader);
        return Program{program};
      } else {
        return Program{0};
      }
    }
  </code></pre>
  
  <p>OpenGL tells me that</p>
  
  <pre><code>message: GL_INVALID_OPERATION error generated. &lt;program&gt; object is not successfully linked.
  type: ERROR
  HIGH
  </code></pre>
  
  <p>and I am not sure why. If I link it the old way and only create one program it works perfectly.</p>
  
  <p>I am guessing I have misused the the new pipeline system?</p>
  
  <p>I should also mention that the error only appears when I start to call</p>
  
  <pre><code> glUseProgramStages(pipeline, GL_VERTEX_SHADER_BIT  , vsp.handle);
   glUseProgramStages(pipeline, GL_FRAGMENT_SHADER_BIT, fsp.handle);
  </code></pre>
  
  <p>Could this be a driver bug?</p>