title: multisampling and fragment shaders in GLSL 330
body: <p>Im trying to understand how a fragment shader is invoked during a multisampled rendering, Ive carefully read the specs but Im a bit confused..</p>
  
  <p>I setup a multisampled FBO with a color and a depth/stencil renderbuffers.. fine</p>
  
  <p>I setup a simple 1-line vertex shader just for transform and another 1-line fragment shader which just returns a black color.. and its fine</p>
  
  <p>I draw a line - the line is displayed smoothed.. fine</p>
  
  <p>now, If in the fragment shader, instead of dumbly returning a black color, I texelFetch from a multisampled texture, always reading sample number 0 (that is, black), I get a jagged line..</p>
  
  <p>whats the difference between a simple <code>myoutcolor=vec4(0.0)</code> and a <code>myoutcolor=texelFetch(mysampler2DMS,...,0)</code> ?</p>
  
  <p>the specs state that a fragment shader is executed at sample-level only if it statically uses <code>gl_SampleID</code>, <code>gl_Samplemask[]</code>, or has a "sample" storage qualifiers.. (in all these cases this means GLSL <code>#version 400</code> or above), otherwise it gets executed at fragment level.. </p>
  
  <p>but how can that be? in the above example, I got a smoothed line even if I always returned the same color, so I tought the fragment shader was ALWAYS executed at sample level in a multisampled framebuffer.. on the other hand, if it was not the case, I should get smooth results even if returning always the same sample from a MS texture..</p>
  
  <p>can somebody help me figure this out?</p>
  
  <p>PS: Im currently using #version 330, but I found that every multisampling-aware statement Id need to correctly handle MS (<code>gl_SampleID</code>, <code>gl_Samplemask[]</code>, sample..) is only supported in GLSL 400 or above.. so, whats exactly the support GLSL 330 offer for correctly handling multisampling? how can I handle MS textures in GLSL 330?</p>