glsl parser: reject VS+in & FS+out interface blocks
authorJordan Justen <jordan.l.justen@intel.com>
Sat, 9 Mar 2013 21:01:13 +0000 (13:01 -0800)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 23 May 2013 16:37:11 +0000 (09:37 -0700)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/glsl_parser.yy

index 0a2a77b8f1668e60a31f96803f0fb832306de0a7..dbc25a4840538bed8b25d1e3fe741ca7a8ac4e25 100644 (file)
@@ -1935,6 +1935,20 @@ basic_interface_block:
              }
           }
 
+          /* From the GLSL 1.50.11 spec, section 4.3.7 ("Interface Blocks"):
+           * "It is illegal to have an input block in a vertex shader
+           *  or an output block in a fragment shader"
+           */
+          if ((state->target == vertex_shader) && $1.flags.q.in) {
+             _mesa_glsl_error(& @1, state,
+                              "`in' interface block is not allowed for "
+                              "a vertex shader\n");
+          } else if ((state->target == fragment_shader) && $1.flags.q.out) {
+             _mesa_glsl_error(& @1, state,
+                              "`out' interface block is not allowed for "
+                              "a fragment shader\n");
+          }
+
           /* Since block arrays require names, and both features are added in
            * the same language versions, we don't have to explicitly
            * version-check both things.