glsl: Fix merging of layout(invocations) with other qualifiers
authorChris Forbes <chrisf@ijw.co.nz>
Fri, 27 Jun 2014 09:09:43 +0000 (21:09 +1200)
committerChris Forbes <chrisf@ijw.co.nz>
Fri, 4 Jul 2014 21:42:17 +0000 (09:42 +1200)
If another layout qualifier appeared to the left of `invocations` in the
GS input layout declaration, the invocation count would be dropped on
the floor.

Fixes the piglit tests:

spec/ARB_transform_feedback3/arb_transform_feedback3-ext_interleaved_two_bufs_gs_max
spec/ARB_gpu_shader5/arb_gpu_shader5-invocation-id
spec/ARB_gpu_shader5/compiler/correct-multiple-layout-qualifier-invocations.geom
spec/ARB_gpu_shader5/execution/invocations-conflicting

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/glsl/ast_type.cpp

index de4c1a410f6ae2b481226024f27d9db155c4ce6e..b596cd59ecf8ce7d614f63fc823fd19ea412dd5d 100644 (file)
@@ -168,6 +168,16 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
       this->max_vertices = q.max_vertices;
    }
 
+   if (q.flags.q.invocations) {
+      if (this->flags.q.invocations && this->invocations != q.invocations) {
+         _mesa_glsl_error(loc, state,
+                          "geometry shader set conflicting invocations "
+                          "(%d and %d)", this->invocations, q.invocations);
+         return false;
+      }
+      this->invocations = q.invocations;
+   }
+
    if (state->stage == MESA_SHADER_GEOMETRY &&
        state->has_explicit_attrib_stream()) {
       if (q.flags.q.stream && q.stream >= state->ctx->Const.MaxVertexStreams) {