glsl: Fail to link if inter-stage input/outputs are not assigned to stream 0
authorIago Toral Quiroga <itoral@igalia.com>
Thu, 5 Jun 2014 09:36:56 +0000 (11:36 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Mon, 30 Jun 2014 06:08:49 +0000 (08:08 +0200)
Outputs that are linked to inputs in the next stage must be output to stream 0,
otherwise we should fail to link.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/link_varyings.cpp

index 9725a434f459f059c1690ec2e2ab9b4276462663..3b20594873cdb27174f9106e01558aa8da05f9f9 100644 (file)
@@ -1345,6 +1345,14 @@ assign_varying_locations(struct gl_context *ctx,
          if (input_var || (prog->SeparateShader && consumer == NULL)) {
             matches.record(output_var, input_var);
          }
+
+         /* Only stream 0 outputs can be consumed in the next stage */
+         if (input_var && output_var->data.stream != 0) {
+            linker_error(prog, "output %s is assigned to stream=%d but "
+                         "is linked to an input, which requires stream=0",
+                         output_var->name, output_var->data.stream);
+            return false;
+         }
       }
    } else {
       /* If there's no producer stage, then this must be a separable program.