glsl: Compile error if fs uses gl_FragCoord before first redeclaration
authorAnuj Phogat <anuj.phogat@gmail.com>
Fri, 21 Feb 2014 02:32:25 +0000 (18:32 -0800)
committerAnuj Phogat <anuj.phogat@gmail.com>
Thu, 1 May 2014 17:58:39 +0000 (10:58 -0700)
commita751adf07117ec4b3659fe60d0a833ebfcd4f840
tree7ffc1e27b49da12797ba2d8305beef19724bfa7e
parent581e4acb0d68eb1063df3919e19e0ef9d86eebff
glsl: Compile error if fs uses gl_FragCoord before first redeclaration

Section 4.3.8.1, page 39 of GLSL 1.50 spec says:
  "Within any shader, the first redeclarations of gl_FragCoord
   must appear before any use of gl_FragCoord."

GLSL compiler should generate an error in following case:

vec4 p = gl_FragCoord;
layout(origin_upper_left) in vec4 gl_FragCoord;

void main()
{
}

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ast_to_hir.cpp