glsl: Require geometry shader inputs to be arrays.
authorPaul Berry <stereotype441@gmail.com>
Wed, 10 Apr 2013 14:04:33 +0000 (07:04 -0700)
committerPaul Berry <stereotype441@gmail.com>
Fri, 2 Aug 2013 03:22:48 +0000 (20:22 -0700)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ast_to_hir.cpp

index 4b5645221a404fd06b29a173dc8619ddc000ed66..10c5425e8ee70e9d0d7e59aea73c4180015afaf8 100644 (file)
@@ -2816,7 +2816,20 @@ ast_declarator_list::hir(exec_list *instructions,
                                       "cannot have array type")) {
               error_emitted = true;
            }
-        }
+        } else if (state->target == geometry_shader) {
+            /* From section 4.3.4 (Inputs) of the GLSL 1.50 spec:
+             *
+             *     Geometry shader input variables get the per-vertex values
+             *     written out by vertex shader output variables of the same
+             *     names. Since a geometry shader operates on a set of
+             *     vertices, each input varying variable (or input block, see
+             *     interface blocks below) needs to be declared as an array.
+             */
+            if (!var->type->is_array()) {
+               _mesa_glsl_error(&loc, state,
+                                "geometry shader inputs must be arrays");
+            }
+         }
       }
 
       /* Integer fragment inputs must be qualified with 'flat'.  In GLSL ES,