glsl: Prohibit structs and bools from being used as "varyings".
authorPaul Berry <stereotype441@gmail.com>
Tue, 18 Dec 2012 23:24:39 +0000 (15:24 -0800)
committerPaul Berry <stereotype441@gmail.com>
Tue, 8 Jan 2013 17:09:21 +0000 (09:09 -0800)
commit18720555dd2da779ad6907e8f6aa083e7b4d1841
treeb1db9eaffc0fe79d750877208ec49886b5af32e4
parentc33be485c58dace2a691042703f50cc6defe960d
glsl: Prohibit structs and bools from being used as "varyings".

The GLSL 1.30 spec only allows vertex shader outputs and fragment
shader inputs ("varyings" in pre-GLSL-1.30 parlance) to be of type
int, uint, float, or vectors, matrices, or arrays thereof.  Bools,
bvec's, and structs are prohibited.  (Integral varyings were
prohibited prior to GLSL 1.30).

Previously, Mesa only performed this check on variables declared with
the "varying" keyword, and it always performed the check according to
the pre-GLSL-1.30 rules.  As a result, bools and structs were allowed
to slip through, provided they were declared using the new in/out
syntax.

This patch modifies the error check so that it occurs after "varying"
is converted to "in/out", and corrects it to properly account for GLSL
version.

Fixes piglit tests:
  in-bool-prohibited.frag
  in-bvec2-prohibited.frag
  in-bvec3-prohibited.frag
  in-bvec4-prohibited.frag
  in-struct-prohibited.frag
  out-bool-prohibited.vert
  out-bvec2-prohibited.vert
  out-bvec3-prohibited.vert
  out-bvec4-prohibited.vert
  out-struct-prohibited.vert

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ast_to_hir.cpp