title: Duplicate location error when using explicit location for struct uniform
body: <p>This is a part of my VS:</p>
  
  <pre><code>#version 450
  #extension GL_ARB_explicit_uniform_location : enable
  #extension GL_ARB_separate_shader_objects : enable
  #extension GL_ARB_gpu_shader5 : enable
  
  
  //Imports
  #include "/common.glsl"
  #include "/common_structs.glsl"
  
  //Mesh Attributes
  layout(location=0) in vec4 vPosition;
  layout(location=1) in vec2 uvPosition0;
  layout(location=2) in vec4 nPosition; //normals
  layout(location=3) in vec4 tPosition; //tangents
  layout(location=4) in vec4 bPosition; //bitangents
  layout(location=5) in vec4 blendIndices;
  layout(location=6) in vec4 blendWeights;
  
  //Uniform Blocks
  layout (std140) uniform Uniforms
  {
      CommonPerFrameUniforms mpCommonPerFrame;
      CommonPerMeshUniforms mpCommonPerMesh;
  };
  
  //Outputs
  out vec3 E;
  out vec3 N;
  out vec2 uv0;
  out float l_distance;
  out mat3 TBN;
  out vec3 default_color;
  out vec4 finalPos;
  out vec4 finalNormal;
  
  void main()
  {...}
  </code></pre>
  
  <p>This is a part of my FS:</p>
  
  <pre><code>#version 450
  #extension GL_ARB_explicit_uniform_location : enable
  #extension GL_ARB_separate_shader_objects : enable
  #extension GL_ARB_texture_query_lod : enable
  #extension GL_ARB_gpu_shader5 : enable
  
  //Includes
  #include "/common.glsl"
  #include "/common_structs.glsl"
  
  layout(location = 200) uniform MaterialUniforms  mpCustomPerMaterial;
  
  
  //Uniform Blocks
  layout (std140) uniform Uniforms
  {
      CommonPerFrameUniforms mpCommonPerFrame;
      CommonPerMeshUniforms mpCommonPerMesh;
  };
  
  
  in vec3 E;
  in vec3 N;
  in vec2 uv0;
  in float l_distance;
  in mat3 TBN;
  in vec3 default_color;
  in vec4 finalPos;
  
  //Deferred Shading outputs
  out vec4 outcolors[3];
  
  void main
  {...}
  </code></pre>
  
  <p>The <code>#include</code> statements are actually preprocessor statements that I use in order to include common structs and functions to the shaders. One of them is the following:</p>
  
  <pre><code>struct MaterialUniforms 
  {
      bool matflags[64];
  
      sampler2DArray diffuseTex;
      sampler2DArray maskTex;
      sampler2DArray normalTex;
  
      vec4 ColourVec4;
      vec4 ParamsVec4;
  };
  </code></pre>
  
  <p>So the problem is that if I use
  <code>layout(location = 200) uniform MaterialUniforms  mpCustomPerMaterial;</code></p>
  
  <p>then I get the following error from the linker:</p>
  
  <pre><code>Link info
  ---------
  Error Duplicate location 201 for uniform mpCustomPerMaterial.diffuseTex
  Error Duplicate location 202 for uniform mpCustomPerMaterial.maskTex
  Error Duplicate location 203 for uniform mpCustomPerMaterial.normalTex
  Error Duplicate location 204 for uniform mpCustomPerMaterial.gMaterialColourVec4
  Error Duplicate location 205 for uniform mpCustomPerMaterial.gMaterialParamsVec4
  </code></pre>
  
  <p>When I remove the <code>layout(location=200)</code> from the uniform definition, then the shader gets compiled successfully. I've experimented with different values for the location, but I can't understand why this is happening. Is there any chance that the uniform blocks that I use, conflict with the struct uniforms?</p>