title: Why can't I add an int member to my GLSL shader input/output block?
body: <p>I'm getting an "invalid operation" error when attempting to call <code>glUseProgram</code> against the fragment shader below. The error only occurs when I try to add an <code>int</code> member to the block definition. Note that I am keeping the block definition the same in both the vertex and fragment shaders. I don't even have to access it! Merely adding that field to the vertex and fragment shader copies of the block definition cause the program to fail.</p>
  
  <pre><code>#version 450
  
  ...
  
  in VSOutput // and of course "out" in the vertex shader
  {
      vec4 color;
      vec4 normal;
      vec2 texCoord;
      //int foo; // uncommenting this line causes "invalid operation"
  } vs_output;
  </code></pre>
  
  <p>I also get the same issue when trying to use free standing in/out variables of the same type, though in those cases, I only get the issue if accessing those variables directly; if I ignore them, I assume the compiler optimizes them away and thus error doesn't occur. It's almost like I'm only allowed to pass around vectors and matrices...</p>
  
  <p>What am I missing here? I haven't been able to find anything in the documentation that would indicate that this should be an issue.</p>
  
  <p><strong>EDIT</strong>: padding it out with  <code>float[2]</code> to force the int member onto the next 16-byte boundary did not work either.</p>
  
  <p><strong>EDIT</strong>: solved, as per the answer below. Turns out I could have figured this out much more quickly if I'd checked the shader program's info log. Here's my code to do that:</p>
  
  <pre><code>bool checkProgramLinkStatus(GLuint programId)
  {
      auto log = logger("Shaders");
  
      GLint status;
      glGetProgramiv(programId, GL_LINK_STATUS, &amp;status);
      if(status == GL_TRUE)
      {
          log &lt;&lt; "Program link successful." &lt;&lt; endlog;
          return true;
      }
      return false;
  }
  
  bool checkProgramInfoLog(GLuint programId)
  {
      auto log = logger("Shaders");
  
      GLint infoLogLength;
      glGetProgramiv(programId, GL_INFO_LOG_LENGTH, &amp;infoLogLength);
      GLchar* strInfoLog = new GLchar[infoLogLength + 1];
      glGetProgramInfoLog(programId, infoLogLength, NULL, strInfoLog);
      if(infoLogLength == 0)
      {
          log &lt;&lt; "No error message was provided" &lt;&lt; endlog;
      }
      else
      {
          log &lt;&lt; "Program link error: " &lt;&lt; std::string(strInfoLog) &lt;&lt; endlog;
      }
  
      return false;
  }
  </code></pre>